mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-12-24 14:06:23 +01:00
Disable animation control while exporting.
This commit is contained in:
parent
a344c06035
commit
09eeea9a03
30 changed files with 289 additions and 261 deletions
Binary file not shown.
|
@ -128,7 +128,7 @@ draw_sprite_ext(s_noti_icon_error, 0, 18, 18, 0.5, 0.5, 0, c_white, 1);
|
|||
if(point_in_rectangle(mouse_mx, mouse_my, bx0, by0, bx0 + bw, by0 + bh)) {
|
||||
if(mouse_check_button_pressed(mb_left)) {
|
||||
var path = executable_get_pathname();
|
||||
shell_execute(path, "--crashed");
|
||||
shell_execute_async(path, "--crashed");
|
||||
}
|
||||
|
||||
if(mouse_check_button(mb_left))
|
||||
|
|
|
@ -46,7 +46,7 @@ if !ready exit;
|
|||
if(buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sFOCUS, sHOVER, __txtx("color_selector_open_palette", "Open palette folder"), THEME.folder) == 2) {
|
||||
var _realpath = environment_get_variable("LOCALAPPDATA") + "/Pixels_Composer/Palettes";
|
||||
var _windir = environment_get_variable("WINDIR") + "/explorer.exe";
|
||||
shell_execute(_windir, _realpath);
|
||||
shell_execute_async(_windir, _realpath);
|
||||
}
|
||||
bx -= ui(32);
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ draw_set_alpha(1);
|
|||
|
||||
if(directory_exists(_o)) {
|
||||
var shell = "/E /I " + _o + " " + _n;
|
||||
shell_execute("Xcopy", shell);
|
||||
shell_execute_async("Xcopy", shell);
|
||||
}
|
||||
}
|
||||
instance_destroy();
|
||||
|
|
|
@ -63,7 +63,7 @@ event_inherited();
|
|||
}
|
||||
|
||||
function onDestroy() {
|
||||
if(!content) return;
|
||||
if(content == noone) return;
|
||||
content.onClose();
|
||||
}
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ if !ready exit;
|
|||
var b = buttonInstant(THEME.button, bx0, by0, bw, bh, mouse_ui, sFOCUS, sHOVER);
|
||||
draw_text(bx0 + bw / 2, by0 + bh / 2, __txtx("run", "Run"));
|
||||
if(b == 2) {
|
||||
shell_execute(prog, cmd);
|
||||
shell_execute_async(prog, cmd);
|
||||
node.trusted = true;
|
||||
|
||||
instance_destroy();
|
||||
|
|
|
@ -91,10 +91,10 @@
|
|||
environment_set_variable("IMGUI_DIALOG_WIDTH", string(800));
|
||||
|
||||
var cmd = ".pxc=\"" + string(program_directory) + "PixelComposer.exe\"";
|
||||
shell_execute("assoc", cmd);
|
||||
shell_execute_async("assoc", cmd);
|
||||
|
||||
var cmd = ".pxcc=\"" + string(program_directory) + "PixelComposer.exe\"";
|
||||
shell_execute("assoc", cmd);
|
||||
shell_execute_async("assoc", cmd);
|
||||
|
||||
//print($"Setup time: {(current_time - t)/1000}s");
|
||||
#endregion
|
||||
|
|
|
@ -18,7 +18,7 @@ if(string(ev_id) == string(STEAM_UGC_ITEM_ID) && ev_type == "ugc_create_item") {
|
|||
}
|
||||
|
||||
steam_ugc_set_item_tags(STEAM_UGC_UPDATE_HANDLE, tgs);
|
||||
steam_ugc_set_item_preview(STEAM_UGC_UPDATE_HANDLE, "steamUGCthumbnail.png");
|
||||
steam_ugc_set_item_preview(STEAM_UGC_UPDATE_HANDLE, TEMPDIR + "steamUGCthumbnail.png");
|
||||
steam_ugc_set_item_content(STEAM_UGC_UPDATE_HANDLE, "steamUGC");
|
||||
|
||||
STEAM_UGC_SUBMIT_ID = steam_ugc_submit_item_update(STEAM_UGC_UPDATE_HANDLE, "Initial upload");
|
||||
|
@ -30,7 +30,7 @@ if(string(ev_id) == string(STEAM_UGC_SUBMIT_ID)) {
|
|||
|
||||
var type = "";
|
||||
switch(STEAM_UGC_TYPE) {
|
||||
case STEAM_UGC_FILE_TYPE.collection : type = "Collection"; break;
|
||||
case STEAM_UGC_FILE_TYPE.collection : type = "Collection"; break;
|
||||
case STEAM_UGC_FILE_TYPE.project : type = "Project"; break;
|
||||
case STEAM_UGC_FILE_TYPE.node_preset : type = "Node preset"; break;
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ _HOVERING_ELEMENT = noone;
|
|||
_k = ds_map_find_next(PROJECT.nodeMap, _k);
|
||||
}
|
||||
|
||||
if(PROJECT.animator.is_playing || PROJECT.animator.rendering) {
|
||||
if(IS_PLAYING || RENDERING) {
|
||||
if(PROJECT.animator.frame_progress) {
|
||||
__addon_preAnim();
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ function addonPanel(_addon, pane) : PanelContent() constructor {
|
|||
var runResult = lua_call(_addon.thread, drawFn);
|
||||
}
|
||||
|
||||
function onClose() {
|
||||
static onClose = function() {
|
||||
if(closeFn == "") return;
|
||||
if(!_addon.ready) return;
|
||||
var runResult = lua_call(_addon.thread, closeFn);
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#macro IS_PLAYING PROJECT.animator.is_playing
|
||||
#macro CURRENT_FRAME PROJECT.animator.current_frame
|
||||
#macro TOTAL_FRAMES PROJECT.animator.frames_total
|
||||
#macro RENDERING PROJECT.animator.rendering
|
||||
#endregion
|
||||
|
||||
#region animation class
|
||||
|
@ -23,8 +24,8 @@
|
|||
frame_progress = false;
|
||||
play_freeze = 0;
|
||||
|
||||
rendering = false;
|
||||
playback = ANIMATOR_END.loop;
|
||||
rendering = 0;
|
||||
playback = ANIMATOR_END.loop;
|
||||
|
||||
static setFrame = function(frame, resetTime = true) {
|
||||
//if(frame == 0) resetAnimation();
|
||||
|
@ -37,8 +38,6 @@
|
|||
if(current_frame == frames_total) {
|
||||
if(rendering) {
|
||||
is_playing = false;
|
||||
rendering = false;
|
||||
|
||||
setFrame(0);
|
||||
} else if(playback == ANIMATOR_END.stop)
|
||||
is_playing = false;
|
||||
|
|
|
@ -5,8 +5,11 @@ function __Node_Cache(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
|
|||
|
||||
attributes.cache_group = [];
|
||||
cache_group_members = [];
|
||||
group_vertex = [];
|
||||
vertex_hash = "";
|
||||
group_vertex = [];
|
||||
group_dragging = false;
|
||||
group_adding = false;
|
||||
group_alpha = 0;
|
||||
vertex_hash = "";
|
||||
|
||||
insp1UpdateTooltip = "Generate cache group";
|
||||
insp1UpdateIcon = [ THEME.cache_group, 0, COLORS._main_icon ];
|
||||
|
@ -47,8 +50,7 @@ function __Node_Cache(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
|
|||
} #endregion
|
||||
|
||||
static getCacheGroup = function(node) { #region
|
||||
if(node != self)
|
||||
array_push(attributes.cache_group, node.node_id);
|
||||
if(node != self) array_push(attributes.cache_group, node.node_id);
|
||||
|
||||
for( var i = 0, n = ds_list_size(node.inputs); i < n; i++ ) {
|
||||
var _from = node.inputs[| i].value_from;
|
||||
|
@ -71,29 +73,32 @@ function __Node_Cache(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
|
|||
static ccw = function(a, b, c) { return (b[0] - a[0]) * (c[1] - a[1]) - (c[0] - a[0]) * (b[1] - a[1]); }
|
||||
|
||||
static getNodeBorder = function(_i, _vertex, _node) { #region
|
||||
var _rad = 8;
|
||||
var _rad = 4;
|
||||
var _stp = 15;
|
||||
|
||||
var _nx0 = _node.x - 32 + _rad;
|
||||
var _ny0 = _node.y - 32 + _rad;
|
||||
var _nx1 = _node.x + _node.w + 32 - _rad;
|
||||
var _nx1 = _node.x + (_node == self? _node.w / 2 : _node.w + 32 - _rad);
|
||||
var _ny1 = _node.y + _node.h + 32 - _rad;
|
||||
|
||||
var _ind = 0;
|
||||
for( var i = 0; i <= 90; i += _stp )
|
||||
_vertex[_i * 7 * 4 + _ind++] = [ _nx1 + lengthdir_x(_rad, i), _ny0 + lengthdir_y(_rad, i) ];
|
||||
|
||||
for( var i = 90; i <= 180; i += _stp )
|
||||
_vertex[_i * 7 * 4 + _ind++] = [ _nx0 + lengthdir_x(_rad, i), _ny0 + lengthdir_y(_rad, i) ];
|
||||
|
||||
for( var i = 180; i <= 270; i += _stp )
|
||||
_vertex[_i * 7 * 4 + _ind++] = [ _nx0 + lengthdir_x(_rad, i), _ny1 + lengthdir_y(_rad, i) ];
|
||||
|
||||
for( var i = 270; i <= 360; i += _stp )
|
||||
_vertex[_i * 7 * 4 + _ind++] = [ _nx1 + lengthdir_x(_rad, i), _ny1 + lengthdir_y(_rad, i) ];
|
||||
for( var i = 0; i <= 90; i += _stp ) _vertex[_i * 7 * 4 + _ind++] = [ _nx1 + lengthdir_x(_rad, i), _ny0 + lengthdir_y(_rad, i) ];
|
||||
for( var i = 90; i <= 180; i += _stp ) _vertex[_i * 7 * 4 + _ind++] = [ _nx0 + lengthdir_x(_rad, i), _ny0 + lengthdir_y(_rad, i) ];
|
||||
for( var i = 180; i <= 270; i += _stp ) _vertex[_i * 7 * 4 + _ind++] = [ _nx0 + lengthdir_x(_rad, i), _ny1 + lengthdir_y(_rad, i) ];
|
||||
for( var i = 270; i <= 360; i += _stp ) _vertex[_i * 7 * 4 + _ind++] = [ _nx1 + lengthdir_x(_rad, i), _ny1 + lengthdir_y(_rad, i) ];
|
||||
} #endregion
|
||||
|
||||
static refrshGroupBG = function() { #region
|
||||
static refreshGroupBG = function() { #region
|
||||
var _hash = "";
|
||||
for( var i = -1, n = array_length(cache_group_members); i < n; i++ ) {
|
||||
var _node = i == -1? self : cache_group_members[i];
|
||||
_hash += $"{_node.x},{_node.y},{_node.w},{_node.h}|";
|
||||
}
|
||||
_hash = md5_string_utf8(_hash);
|
||||
|
||||
if(vertex_hash == _hash) return;
|
||||
vertex_hash = _hash;
|
||||
|
||||
group_vertex = [];
|
||||
|
||||
if(array_empty(cache_group_members)) return;
|
||||
|
@ -138,22 +143,60 @@ function __Node_Cache(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
|
|||
}
|
||||
} #endregion
|
||||
|
||||
static drawNodeBG = function(_x, _y, _mx, _my, _s) { #region
|
||||
var _hash = "";
|
||||
for( var i = -1, n = array_length(cache_group_members); i < n; i++ ) {
|
||||
var _node = i == -1? self : cache_group_members[i];
|
||||
_hash += $"{_node.x},{_node.y},{_node.w},{_node.h}|";
|
||||
static groupCheck = function(_x, _y, _s, _mx, _my) { #region
|
||||
if(array_length(group_vertex) < 3) return;
|
||||
var _inGroup = true;
|
||||
var _m = [ _mx / _s - _x, _my / _s - _y ];
|
||||
|
||||
group_adding = false;
|
||||
|
||||
if(PANEL_GRAPH.node_dragging && key_mod_press(SHIFT)) {
|
||||
var side = undefined;
|
||||
for( var i = 1, n = array_length(group_vertex); i < n; i++ ) {
|
||||
var a = group_vertex[i - 1];
|
||||
var b = group_vertex[i - 0];
|
||||
|
||||
var _side = sign(ccw(a, b, _m));
|
||||
if(side == undefined) side = _side;
|
||||
else if(side != _side) _inGroup = false;
|
||||
}
|
||||
|
||||
var _list = PANEL_GRAPH.nodes_selecting;
|
||||
|
||||
if(_inGroup) {
|
||||
group_adding = true;
|
||||
for( var i = 0, n = array_length(_list); i < n; i++ )
|
||||
array_push_unique(attributes.cache_group, _list[i].node_id);
|
||||
} else {
|
||||
for( var i = 0, n = array_length(_list); i < n; i++ )
|
||||
array_remove(attributes.cache_group, _list[i].node_id);
|
||||
}
|
||||
|
||||
if(!group_dragging) {
|
||||
for( var i = 0, n = array_length(_list); i < n; i++ )
|
||||
array_remove(attributes.cache_group, _list[i].node_id);
|
||||
refreshCacheGroup();
|
||||
refreshGroupBG();
|
||||
}
|
||||
group_dragging = true;
|
||||
}
|
||||
_hash = md5_string_utf8(_hash);
|
||||
|
||||
if(vertex_hash != _hash) refrshGroupBG();
|
||||
vertex_hash = _hash;
|
||||
if(group_dragging && mouse_release(mb_left)) {
|
||||
refreshCacheGroup();
|
||||
refreshGroupBG();
|
||||
|
||||
group_dragging = false;
|
||||
}
|
||||
} #endregion
|
||||
|
||||
static drawNodeBG = function(_x, _y, _mx, _my, _s) { #region
|
||||
refreshGroupBG();
|
||||
if(array_length(group_vertex) < 3) return;
|
||||
|
||||
var _color = getColor();
|
||||
draw_set_color(_color);
|
||||
draw_set_alpha(0.025);
|
||||
group_alpha = lerp_float(group_alpha, group_adding, 4);
|
||||
draw_set_alpha(0.025 + 0.025 * group_alpha);
|
||||
draw_primitive_begin(pr_trianglelist);
|
||||
var a = group_vertex[0];
|
||||
var b = group_vertex[1];
|
||||
|
|
|
@ -173,6 +173,8 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
|
|||
preview_mx = 0;
|
||||
preview_my = 0;
|
||||
|
||||
graph_preview_alpha = 1;
|
||||
|
||||
getPreviewingNode = noone;
|
||||
#endregion
|
||||
|
||||
|
@ -1078,7 +1080,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
|
|||
var bbox = drawGetBbox(xx, yy, _s);
|
||||
var aa = 0.5 + 0.5 * renderActive;
|
||||
|
||||
draw_surface_bbox(preview_surface, bbox, c_white, aa);
|
||||
draw_surface_bbox(preview_surface, bbox, c_white, aa * graph_preview_alpha);
|
||||
} #endregion
|
||||
|
||||
static getNodeDimension = function(showFormat = true) { #region
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
function Node_create_Export(_x, _y, _group = noone) {
|
||||
function Node_create_Export(_x, _y, _group = noone) { #region
|
||||
var path = "";
|
||||
if(!LOADING && !APPENDING && !CLONING) {
|
||||
path = get_save_filename(@"Portable Network Graphics (.png)|*.png|
|
||||
|
@ -20,9 +20,9 @@ MPEG-4 (.mp4)|*.mp4",
|
|||
}
|
||||
|
||||
function exportAll() {
|
||||
PROJECT.animator.rendering = true;
|
||||
if(RENDERING) return;
|
||||
|
||||
Render();
|
||||
PROJECT.animator.rendering = false;
|
||||
|
||||
var key = ds_map_find_first(PROJECT.nodeMap);
|
||||
repeat(ds_map_size(PROJECT.nodeMap)) {
|
||||
|
@ -34,7 +34,7 @@ function exportAll() {
|
|||
|
||||
node.doInspectorAction();
|
||||
}
|
||||
}
|
||||
} #endregion
|
||||
|
||||
enum NODE_EXPORT_FORMAT {
|
||||
single,
|
||||
|
@ -207,6 +207,10 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
|
|||
["Quality", false], 6, 7, 10, 13,
|
||||
];
|
||||
|
||||
render_process_id = undefined;
|
||||
render_type = "";
|
||||
render_target = "";
|
||||
|
||||
directory = TEMPDIR + string(irandom_range(100000, 999999));
|
||||
converter = filepath_resolve(PREFERENCES.ImageMagick_path) + "convert.exe";
|
||||
magick = filepath_resolve(PREFERENCES.ImageMagick_path) + "magick.exe";
|
||||
|
@ -283,12 +287,12 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
|
|||
var frames = [];
|
||||
|
||||
while(_path != "") {
|
||||
var _frame = "\"" + temp_path + string_replace_all(_path, ".png", "") + ".webp\"";
|
||||
var _pathTemp = "\"" + temp_path + _path + "\"";
|
||||
var _frame = string_quote(temp_path + string_replace_all(_path, ".png", "") + ".webp");
|
||||
var _pathTemp = string_quote(temp_path + _path);
|
||||
var shell_cmd = _pathTemp + " -define webp:lossless=true " + _frame;
|
||||
|
||||
array_push(frames, _frame);
|
||||
shell_execute(magick, shell_cmd, self);
|
||||
shell_execute_async(magick, shell_cmd, self);
|
||||
|
||||
_path = file_find_next();
|
||||
}
|
||||
|
@ -297,22 +301,17 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
|
|||
if(rate == 0) rate = 1;
|
||||
|
||||
var framerate = round(1 / rate * 1000);
|
||||
|
||||
var cmd = "";
|
||||
|
||||
for( var i = 0, n = array_length(frames); i < n; i++ )
|
||||
cmd += "-frame " + frames[i] + " +" + string(framerate) + "+0+0+1 ";
|
||||
|
||||
cmd += "-bgcolor 0,0,0,0 ";
|
||||
cmd += "-o \"" + target_path + "\"";
|
||||
cmd += "-o " + string_quote(target_path);
|
||||
|
||||
shell_execute(webp, cmd, self);
|
||||
|
||||
var noti = log_message("EXPORT", "Export webp as " + target_path, THEME.noti_icon_tick, COLORS._main_value_positive, false);
|
||||
noti.path = filename_dir(target_path);
|
||||
noti.setOnClick(function() { shellOpenExplorer(self.path); }, "Open in explorer", THEME.explorer);
|
||||
|
||||
PANEL_MENU.setNotiIcon(THEME.noti_icon_tick);
|
||||
render_process_id = shell_execute_async(webp, cmd, self);
|
||||
render_type = "webp";
|
||||
render_target = target_path;
|
||||
} #endregion
|
||||
|
||||
static renderGif = function(temp_path, target_path) { #region
|
||||
|
@ -329,25 +328,21 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
|
|||
var use_gifski = false;
|
||||
|
||||
if(use_gifski) {
|
||||
var shell_cmd = $"-o {target_path} -r {rate} --repeat {loop_str} -Q {qual} ";
|
||||
shell_cmd += temp_path;
|
||||
var shell_cmd = $"-o {string_quote(target_path)} -r {rate} --repeat {loop_str} -Q {qual} {string_quote(temp_path)}";
|
||||
|
||||
//print($"{gifski} {shell_cmd}");
|
||||
shell_execute(gifski, shell_cmd, self);
|
||||
render_process_id = shell_execute_async(gifski, shell_cmd, self);
|
||||
} else {
|
||||
var shell_cmd = $"-delay {framerate} -alpha set -dispose previous -loop {loop_str}";
|
||||
if(opti) shell_cmd += $" -fuzz {fuzz * 100}% -layers OptimizeFrame -layers OptimizeTransparency";
|
||||
shell_cmd += " " + temp_path + " " + target_path;
|
||||
shell_cmd += $" {string_quote(temp_path)} {string_quote(target_path)}";
|
||||
|
||||
//print($"{converter} {shell_cmd}");
|
||||
shell_execute(converter, shell_cmd, self);
|
||||
render_process_id = shell_execute_async(converter, shell_cmd, self);
|
||||
}
|
||||
|
||||
var noti = log_message("EXPORT", "Export gif as " + target_path, THEME.noti_icon_tick, COLORS._main_value_positive, false);
|
||||
noti.path = filename_dir(target_path);
|
||||
noti.setOnClick(function() { shellOpenExplorer(self.path); }, "Open in explorer", THEME.explorer);
|
||||
|
||||
PANEL_MENU.setNotiIcon(THEME.noti_icon_tick);
|
||||
render_type = "gif";
|
||||
render_target = target_path;
|
||||
} #endregion
|
||||
|
||||
static renderMp4 = function(temp_path, target_path) { #region
|
||||
|
@ -359,15 +354,12 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
|
|||
temp_path = string_replace_all(temp_path, "/", "\\");
|
||||
target_path = string_replace_all(target_path, "/", "\\");
|
||||
|
||||
var shell_cmd = $"-hide_banner -loglevel quiet -framerate {rate} -i {temp_path}%05d.png -c:v libx264 -r {rate} -pix_fmt yuv420p {target_path}";
|
||||
var shell_cmd = $"-hide_banner -loglevel quiet -framerate {rate} -i \"{temp_path}%05d.png\" -c:v libx264 -r {rate} -pix_fmt yuv420p {string_quote(target_path)}";
|
||||
print($"{ffmpeg} {shell_cmd}")
|
||||
|
||||
shell_execute_async(ffmpeg, shell_cmd, self);
|
||||
|
||||
var noti = log_message("EXPORT", "Export mp4 as " + target_path, THEME.noti_icon_tick, COLORS._main_value_positive, false);
|
||||
noti.path = filename_dir(target_path);
|
||||
noti.setOnClick(function() { shellOpenExplorer(self.path); }, "Open in explorer", THEME.explorer);
|
||||
|
||||
PANEL_MENU.setNotiIcon(THEME.noti_icon_tick);
|
||||
render_process_id = shell_execute_async(ffmpeg, shell_cmd, self);
|
||||
render_type = "mp4";
|
||||
render_target = target_path;
|
||||
} #endregion
|
||||
|
||||
static pathString = function(path, index = 0, _array = false) { #region
|
||||
|
@ -494,14 +486,14 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
|
|||
case 0 :
|
||||
surface_save_safe(_surf, _pathTemp);
|
||||
|
||||
var shell_cmd = $"convert \"{_pathTemp}\" \"{_pathOut}\"";
|
||||
shell_execute(magick, shell_cmd, self);
|
||||
var shell_cmd = $"convert {string_quote(_pathTemp)} {string_quote(_pathOut)}";
|
||||
shell_execute_async(magick, shell_cmd, self);
|
||||
break;
|
||||
case 1 :
|
||||
surface_save_safe(_surf, _pathTemp);
|
||||
|
||||
var shell_cmd = $"convert {_pathTemp} PNG8:\"{_pathOut}\"";
|
||||
shell_execute(magick, shell_cmd, self);
|
||||
var shell_cmd = $"convert {string_quote(_pathTemp)} PNG8:{string_quote(_pathOut)}";
|
||||
shell_execute_async(magick, shell_cmd, self);
|
||||
break;
|
||||
case 2 :
|
||||
surface_save_safe(_surf, _pathOut);
|
||||
|
@ -513,18 +505,18 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
|
|||
surface_save_safe(_surf, _pathTemp);
|
||||
|
||||
_pathOut = $"\"{string_replace_all(_path, ".png", "")}.jpg\"";
|
||||
var shell_cmd = $"\"{_pathTemp}\" -quality {qual} {_pathOut}";
|
||||
var shell_cmd = $"{string_quote(_pathTemp)} -quality {qual} {string_quote(_pathOut)}";
|
||||
|
||||
shell_execute(magick, shell_cmd, self);
|
||||
shell_execute_async(magick, shell_cmd, self);
|
||||
break;
|
||||
|
||||
case ".webp":
|
||||
surface_save_safe(_surf, _pathTemp);
|
||||
|
||||
_pathOut = $"\"{string_replace_all(_path, ".png", "")}.webp\"";
|
||||
var shell_cmd = $"\"{_pathTemp}\" -quality {qual} -define webp:lossless=true {_pathOut}";
|
||||
var shell_cmd = $"{string_quote(_pathTemp)} -quality {qual} -define webp:lossless=true {string_quote(_pathOut)}";
|
||||
|
||||
shell_execute(magick, shell_cmd, self);
|
||||
shell_execute_async(magick, shell_cmd, self);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -611,7 +603,7 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
|
|||
switch(extd) {
|
||||
case 0 :
|
||||
target_path = string_replace(target_path, ".png", ".gif");
|
||||
renderGif(string_quote(temp_path), string_quote(target_path));
|
||||
renderGif(temp_path, target_path);
|
||||
break;
|
||||
case 1 :
|
||||
target_path = string_replace(target_path, ".png", ".webp");
|
||||
|
@ -629,7 +621,7 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
|
|||
switch(extd) {
|
||||
case 0 :
|
||||
target_path = string_replace(target_path, ".png", ".gif");
|
||||
renderGif(string_quote(directory + "/*.png"), string_quote(target_path));
|
||||
renderGif(directory + "/*.png", target_path);
|
||||
break;
|
||||
case 1 :
|
||||
target_path = string_replace(target_path, ".png", ".webp");
|
||||
|
@ -652,11 +644,16 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
|
|||
insp2UpdateIcon = [ THEME.play_all, 0, COLORS._main_value_positive ];
|
||||
|
||||
static onInspector1Update = function() { #region
|
||||
if(RENDERING) return;
|
||||
|
||||
if(isInLoop()) RENDER_ALL
|
||||
else doInspectorAction();
|
||||
} #endregion
|
||||
|
||||
static onInspector2Update = function() { exportAll(); }
|
||||
static onInspector2Update = function() {
|
||||
if(RENDERING) return;
|
||||
exportAll();
|
||||
}
|
||||
|
||||
static doInspectorAction = function() { #region
|
||||
if(LOADING || APPENDING) return;
|
||||
|
@ -666,9 +663,9 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
|
|||
var form = getInputData(3);
|
||||
|
||||
if(form == NODE_EXPORT_FORMAT.single) {
|
||||
PROJECT.animator.rendering = true;
|
||||
RENDERING++;
|
||||
Render();
|
||||
PROJECT.animator.rendering = false;
|
||||
RENDERING--;
|
||||
|
||||
export();
|
||||
updatedOutTrigger.setValue(true);
|
||||
|
@ -679,8 +676,8 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
|
|||
played = 0;
|
||||
PROJECT.animator.real_frame = -1;
|
||||
CURRENT_FRAME = -1;
|
||||
PROJECT.animator.is_playing = true;
|
||||
PROJECT.animator.rendering = true;
|
||||
IS_PLAYING = true;
|
||||
RENDERING++;
|
||||
|
||||
if(directory_exists(directory))
|
||||
directory_destroy(directory);
|
||||
|
@ -688,6 +685,9 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
|
|||
} #endregion
|
||||
|
||||
static step = function() { #region
|
||||
insp1UpdateIcon[2] = RENDERING? COLORS._main_icon_dark : COLORS._main_value_positive;
|
||||
insp2UpdateIcon[2] = RENDERING? COLORS._main_icon_dark : COLORS._main_value_positive;
|
||||
|
||||
var surf = getInputData( 0);
|
||||
var pngf = getInputData(13);
|
||||
|
||||
|
@ -725,6 +725,19 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
|
|||
}
|
||||
|
||||
outputs[| 0].visible = isInLoop();
|
||||
|
||||
if(render_process_id != undefined) {
|
||||
var res = ProcIdExists(render_process_id);
|
||||
if(res == 0) {
|
||||
var noti = log_message("EXPORT", $"Export {render_type} as {render_target}", THEME.noti_icon_tick, COLORS._main_value_positive, false);
|
||||
noti.path = filename_dir(render_target);
|
||||
noti.setOnClick(function() { shellOpenExplorer(self.path); }, "Open in explorer", THEME.explorer);
|
||||
PANEL_MENU.setNotiIcon(THEME.noti_icon_tick);
|
||||
render_process_id = undefined;
|
||||
|
||||
RENDERING--;
|
||||
}
|
||||
}
|
||||
} #endregion
|
||||
|
||||
static update = function(frame = CURRENT_FRAME) { #region
|
||||
|
@ -748,5 +761,13 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
|
|||
renderCompleted();
|
||||
} #endregion
|
||||
|
||||
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region
|
||||
graph_preview_alpha = 1;
|
||||
if(render_process_id != undefined) {
|
||||
graph_preview_alpha = 0.5;
|
||||
draw_sprite_ui(THEME.loading, 0, xx + w * _s / 2, yy + h * _s / 2, _s, _s, current_time / 2, COLORS._main_icon, 1);
|
||||
}
|
||||
} #endregion
|
||||
|
||||
static doApplyDeserialize = function() { onValueUpdate(3); }
|
||||
}
|
|
@ -4,17 +4,17 @@ function Node_Frame(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
|||
name = "Frame";
|
||||
w = 240;
|
||||
h = 160;
|
||||
alpha = 1;
|
||||
bg_spr = THEME.node_frame_bg;
|
||||
alpha = 1;
|
||||
bg_spr = THEME.node_frame_bg;
|
||||
|
||||
size_dragging = false;
|
||||
size_dragging_w = w;
|
||||
size_dragging_h = h;
|
||||
size_dragging = false;
|
||||
size_dragging_w = w;
|
||||
size_dragging_h = h;
|
||||
size_dragging_mx = w;
|
||||
size_dragging_my = h;
|
||||
|
||||
auto_height = false;
|
||||
name_hover = false;
|
||||
auto_height = false;
|
||||
name_hover = false;
|
||||
hover_progress = 0;
|
||||
|
||||
color = c_white;
|
||||
|
@ -41,11 +41,11 @@ function Node_Frame(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
|||
.setDisplay(VALUE_DISPLAY.slider)
|
||||
.rejectArray();
|
||||
|
||||
static onValueUpdate = function(index = 3) {
|
||||
static onValueUpdate = function(index = 3) { #region
|
||||
global.__FRAME_LABEL_SCALE = getInputData(3);
|
||||
}
|
||||
} #endregion
|
||||
|
||||
static step = function() {
|
||||
static step = function() { #region
|
||||
var si = getInputData(0);
|
||||
w = si[0];
|
||||
h = si[1];
|
||||
|
@ -54,9 +54,9 @@ function Node_Frame(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
|||
alpha = getInputData(2);
|
||||
scale = getInputData(3);
|
||||
label_color = getInputData(4);
|
||||
}
|
||||
} #endregion
|
||||
|
||||
static drawNodeBase = function(xx, yy, _s) {
|
||||
static drawNodeBase = function(xx, yy, _s) { #region
|
||||
draw_sprite_stretched_ext(bg_spr, 0, xx, yy, w * _s, h * _s, color, alpha);
|
||||
var txt = display_name == ""? name : display_name;
|
||||
|
||||
|
@ -66,10 +66,10 @@ function Node_Frame(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
|||
draw_set_alpha(clamp(alpha + name_hover * 0.5, 0, 1));
|
||||
draw_text_cut(xx + 8 + 16 * hover_progress, yy + 4 * _s, txt, (w - 8) * _s - 24, scale);
|
||||
draw_set_alpha(1);
|
||||
}
|
||||
} #endregion
|
||||
|
||||
draw_scale = 1;
|
||||
static drawNodeBG = function(_x, _y, _mx, _my, _s) {
|
||||
static drawNodeBG = function(_x, _y, _mx, _my, _s) { #region
|
||||
draw_scale = _s;
|
||||
|
||||
if(size_dragging) {
|
||||
|
@ -119,9 +119,9 @@ function Node_Frame(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
|||
}
|
||||
}
|
||||
return noone;
|
||||
}
|
||||
} #endregion
|
||||
|
||||
static pointIn = function(_x, _y, _mx, _my, _s) {
|
||||
static pointIn = function(_x, _y, _mx, _my, _s) { #region
|
||||
var xx = x * _s + _x;
|
||||
var yy = y * _s + _y;
|
||||
|
||||
|
@ -134,5 +134,5 @@ function Node_Frame(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
|||
name_hover = hover;
|
||||
|
||||
return hover;
|
||||
}
|
||||
} #endregion
|
||||
}
|
|
@ -21,7 +21,7 @@ function Node_IsoSurf(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
|
|||
drag_sv = 0;
|
||||
drag_sa = 0;
|
||||
|
||||
angle_renderer = new Inspector_Custom_Renderer(function(_x, _y, _w, _m, _hover, _focus) {
|
||||
angle_renderer = new Inspector_Custom_Renderer(function(_x, _y, _w, _m, _hover, _focus) { #region
|
||||
var hh = ui(240);
|
||||
var _surfs = getInputData(1);
|
||||
var _angle = getInputData(3);
|
||||
|
@ -86,7 +86,7 @@ function Node_IsoSurf(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
|
|||
}
|
||||
|
||||
return hh;
|
||||
});
|
||||
}); #endregion
|
||||
|
||||
input_display_list = [
|
||||
["Iso", false], 0, 2, angle_renderer,
|
||||
|
|
|
@ -87,7 +87,7 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group)
|
|||
if(grup != SPRITE_ANIM_GROUP.animation) {
|
||||
initRender();
|
||||
return;
|
||||
} else if(PROJECT.animator.rendering && PROJECT.animator.frame_progress && CURRENT_FRAME == 0 && !refreshSurface) {
|
||||
} else if(RENDERING && PROJECT.animator.frame_progress && CURRENT_FRAME == 0 && !refreshSurface) {
|
||||
var skip = getInputData(2);
|
||||
|
||||
var arr = is_array(inpt);
|
||||
|
|
|
@ -81,24 +81,24 @@ function Node_Scatter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
|
|||
|
||||
scatter_data = [];
|
||||
|
||||
static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) {
|
||||
static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { #region
|
||||
if(process_amount > 1) return;
|
||||
|
||||
var _distType = current_data[6];
|
||||
if(_distType < 3)
|
||||
inputs[| 5].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny);
|
||||
}
|
||||
} #endregion
|
||||
|
||||
static onValueUpdate = function(index) {
|
||||
static onValueUpdate = function(index) { #region
|
||||
if(index == 15) {
|
||||
var _arr = getInputData(15);
|
||||
inputs[| 0].array_depth = _arr;
|
||||
|
||||
update();
|
||||
}
|
||||
}
|
||||
} #endregion
|
||||
|
||||
static step = function() {
|
||||
static step = function() { #region
|
||||
var _dis = getInputData(6);
|
||||
var _arr = getInputData(15);
|
||||
inputs[| 0].array_depth = _arr;
|
||||
|
@ -111,9 +111,9 @@ function Node_Scatter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
|
|||
inputs[| 20].setVisible(_dis == 4);
|
||||
inputs[| 21].setVisible(_dis == 4);
|
||||
inputs[| 22].setVisible(_dis == 4);
|
||||
}
|
||||
} #endregion
|
||||
|
||||
static processData = function(_outSurf, _data, _output_index, _array_index) {
|
||||
static processData = function(_outSurf, _data, _output_index, _array_index) { #region
|
||||
if(_output_index == 1) return scatter_data;
|
||||
if(_output_index == 0 && _array_index == 0) scatter_data = [];
|
||||
|
||||
|
@ -287,12 +287,12 @@ function Node_Scatter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
|
|||
surface_reset_target();
|
||||
|
||||
return _outSurf;
|
||||
}
|
||||
} #endregion
|
||||
|
||||
static doApplyDeserialize = function() {
|
||||
static doApplyDeserialize = function() { #region
|
||||
var _arr = getInputData(15);
|
||||
inputs[| 0].array_depth = _arr;
|
||||
|
||||
doUpdate();
|
||||
}
|
||||
} #endregion
|
||||
}
|
|
@ -26,7 +26,7 @@ function Node_Shell(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
|||
if(_pro == "" || _scr == "") return;
|
||||
|
||||
if(trusted) {
|
||||
shell_execute(_pro, _scr);
|
||||
shell_execute_async(_pro, _scr);
|
||||
} else {
|
||||
var dia = dialogCall(o_dialog_run_shell);
|
||||
dia.setData(self, _pro, _scr);
|
||||
|
|
|
@ -1979,15 +1979,6 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
} #endregion
|
||||
|
||||
static drawJunction = function(_s, _mx, _my, sca = 1) { #region
|
||||
if(!isVisible()) return false;
|
||||
|
||||
var ss = max(0.25, _s / 2);
|
||||
var hov = PANEL_GRAPH.pHOVER && (PANEL_GRAPH.node_hovering == noone || PANEL_GRAPH.node_hovering == node);
|
||||
var is_hover = hov && point_in_circle(_mx, _my, x, y, 10 * _s * sca);
|
||||
|
||||
var _bgS = THEME.node_junctions_bg;
|
||||
var _fgS = is_hover? THEME.node_junctions_outline_hover : THEME.node_junctions_outline;
|
||||
|
||||
var _bgC, _fgC;
|
||||
|
||||
if(color == -1) {
|
||||
|
@ -1998,13 +1989,22 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
_fgC = color;
|
||||
}
|
||||
|
||||
color_display = type == VALUE_TYPE.action? #8fde5d : _fgC;
|
||||
|
||||
if(!isVisible()) return false;
|
||||
|
||||
var ss = max(0.25, _s / 2);
|
||||
var hov = PANEL_GRAPH.pHOVER && (PANEL_GRAPH.node_hovering == noone || PANEL_GRAPH.node_hovering == node);
|
||||
var is_hover = hov && point_in_circle(_mx, _my, x, y, 10 * _s * sca);
|
||||
|
||||
var _bgS = THEME.node_junctions_bg;
|
||||
var _fgS = is_hover? THEME.node_junctions_outline_hover : THEME.node_junctions_outline;
|
||||
|
||||
if(type == VALUE_TYPE.action) {
|
||||
draw_sprite_ext(THEME.node_junction_inspector, is_hover, x, y, ss, ss, 0, c_white, 1);
|
||||
color_display = #8fde5d;
|
||||
} else {
|
||||
draw_sprite_ext(_bgS, draw_junction_index, x, y, ss, ss, 0, _bgC, 1);
|
||||
draw_sprite_ext(_fgS, draw_junction_index, x, y, ss, ss, 0, _fgC, 1);
|
||||
color_display = _fgC;
|
||||
}
|
||||
|
||||
return is_hover;
|
||||
|
|
|
@ -132,53 +132,54 @@ function Panel_Animation() : PanelContent() constructor {
|
|||
|
||||
#region ++++ control_buttons ++++
|
||||
control_buttons = [
|
||||
[ function() { return __txt("Stop"); },
|
||||
[
|
||||
function() { return __txt("Stop"); },
|
||||
function() { return 4; },
|
||||
function() { return PROJECT.animator.is_playing? COLORS._main_accent : COLORS._main_icon; },
|
||||
function() { PROJECT.animator.stop(); } ],
|
||||
[ function() { return PROJECT.animator.is_playing? __txt("Pause") : __txt("Play"); },
|
||||
function() { if(RENDERING) return COLORS._main_icon_dark; return PROJECT.animator.is_playing? COLORS._main_accent : COLORS._main_icon; },
|
||||
function() { if(RENDERING) return; PROJECT.animator.stop(); }
|
||||
],
|
||||
[
|
||||
function() { return PROJECT.animator.is_playing? __txt("Pause") : __txt("Play"); },
|
||||
function() { return !PROJECT.animator.is_playing; },
|
||||
function() { return PROJECT.animator.is_playing? COLORS._main_accent : COLORS._main_icon; },
|
||||
function() {
|
||||
if(PROJECT.animator.is_playing) PROJECT.animator.pause();
|
||||
else PROJECT.animator.resume();
|
||||
} ],
|
||||
[ function() { return __txtx("panel_animation_go_to_first_frame", "Go to first frame"); },
|
||||
function() { if(RENDERING) return COLORS._main_icon_dark; return PROJECT.animator.is_playing? COLORS._main_accent : COLORS._main_icon; },
|
||||
function() { if(RENDERING) return; if(PROJECT.animator.is_playing) PROJECT.animator.pause(); else PROJECT.animator.resume(); }
|
||||
],
|
||||
[
|
||||
function() { return __txtx("panel_animation_go_to_first_frame", "Go to first frame"); },
|
||||
function() { return 3; },
|
||||
function() { return COLORS._main_icon; },
|
||||
function() { PROJECT.animator.setFrame(0); }
|
||||
function() { if(RENDERING) return COLORS._main_icon_dark; return COLORS._main_icon; },
|
||||
function() { if(RENDERING) return; PROJECT.animator.setFrame(0); }
|
||||
],
|
||||
[ function() { return __txtx("panel_animation_go_to_last_frame", "Go to last frame"); },
|
||||
[
|
||||
function() { return __txtx("panel_animation_go_to_last_frame", "Go to last frame"); },
|
||||
function() { return 2; },
|
||||
function() { return COLORS._main_icon; },
|
||||
function() { PROJECT.animator.setFrame(TOTAL_FRAMES - 1); }
|
||||
function() { if(RENDERING) return COLORS._main_icon_dark; return COLORS._main_icon; },
|
||||
function() { if(RENDERING) return; PROJECT.animator.setFrame(TOTAL_FRAMES - 1); }
|
||||
],
|
||||
[ function() { return __txtx("panel_animation_previous_frame", "Previous frame"); },
|
||||
[
|
||||
function() { return __txtx("panel_animation_previous_frame", "Previous frame"); },
|
||||
function() { return 5; },
|
||||
function() { return COLORS._main_icon; },
|
||||
function() { PROJECT.animator.setFrame(PROJECT.animator.real_frame - 1); }
|
||||
function() { if(RENDERING) return COLORS._main_icon_dark; return COLORS._main_icon; },
|
||||
function() { if(RENDERING) return; PROJECT.animator.setFrame(PROJECT.animator.real_frame - 1); }
|
||||
],
|
||||
[ function() { return __txtx("panel_animation_next_frame", "Next frame"); },
|
||||
[
|
||||
function() { return __txtx("panel_animation_next_frame", "Next frame"); },
|
||||
function() { return 6; },
|
||||
function() { return COLORS._main_icon; },
|
||||
function() { PROJECT.animator.setFrame(PROJECT.animator.real_frame + 1); }
|
||||
function() { if(RENDERING) return COLORS._main_icon_dark; return COLORS._main_icon; },
|
||||
function() { if(RENDERING) return; PROJECT.animator.setFrame(PROJECT.animator.real_frame + 1); }
|
||||
],
|
||||
];
|
||||
#endregion
|
||||
|
||||
#region ++++ hotkeys ++++
|
||||
addHotkey("", "Play/Pause", vk_space, MOD_KEY.none, function() { if(PROJECT.animator.is_playing) PROJECT.animator.pause() else PROJECT.animator.play(); });
|
||||
addHotkey("", "Play/Pause", vk_space, MOD_KEY.none, function() { if(RENDERING) return; if(IS_PLAYING) PROJECT.animator.pause() else PROJECT.animator.play(); });
|
||||
addHotkey("", "Resume/Pause", vk_space, MOD_KEY.shift,function() { if(RENDERING) return; if(PROJECT.animator.is_playing) PROJECT.animator.pause() else PROJECT.animator.resume(); });
|
||||
|
||||
addHotkey("", "Resume/Pause", vk_space, MOD_KEY.shift, function() { if(PROJECT.animator.is_playing) PROJECT.animator.pause() else PROJECT.animator.resume(); });
|
||||
addHotkey("", "First frame", vk_home, MOD_KEY.none, function() { if(RENDERING) return; PROJECT.animator.setFrame(0); });
|
||||
addHotkey("", "Last frame", vk_end, MOD_KEY.none, function() { if(RENDERING) return; PROJECT.animator.setFrame(TOTAL_FRAMES - 1); });
|
||||
addHotkey("", "Next frame", vk_right, MOD_KEY.none, function() { if(RENDERING) return; PROJECT.animator.setFrame(min(PROJECT.animator.real_frame + 1, TOTAL_FRAMES - 1)); });
|
||||
addHotkey("", "Previous frame", vk_left, MOD_KEY.none, function() { if(RENDERING) return; PROJECT.animator.setFrame(max(PROJECT.animator.real_frame - 1, 0)); });
|
||||
|
||||
addHotkey("", "First frame", vk_home, MOD_KEY.none, function() { PROJECT.animator.setFrame(0); });
|
||||
addHotkey("", "Last frame", vk_end, MOD_KEY.none, function() { PROJECT.animator.setFrame(TOTAL_FRAMES - 1); });
|
||||
addHotkey("", "Next frame", vk_right, MOD_KEY.none, function() {
|
||||
PROJECT.animator.setFrame(min(PROJECT.animator.real_frame + 1, TOTAL_FRAMES - 1));
|
||||
});
|
||||
addHotkey("", "Previous frame", vk_left, MOD_KEY.none, function() {
|
||||
PROJECT.animator.setFrame(max(PROJECT.animator.real_frame - 1, 0));
|
||||
});
|
||||
addHotkey("Animation", "Delete keys", vk_delete, MOD_KEY.none, function() { PANEL_ANIMATION.deleteKeys(); });
|
||||
addHotkey("Animation", "Duplicate", "D", MOD_KEY.ctrl, function() { PANEL_ANIMATION.doDuplicate(); });
|
||||
addHotkey("Animation", "Copy", "C", MOD_KEY.ctrl, function() { PANEL_ANIMATION.doCopy(); });
|
||||
|
|
|
@ -924,7 +924,7 @@ function PanelContent() constructor {
|
|||
|
||||
static checkClosable = function() { return true; }
|
||||
|
||||
function onClose() {}
|
||||
static onClose = function() {}
|
||||
}
|
||||
|
||||
function setFocus(target, fstring = noone) {
|
||||
|
|
|
@ -70,7 +70,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
node_drag_oy = 0;
|
||||
|
||||
selection_block = 0;
|
||||
nodes_selecting = [];
|
||||
nodes_selecting = [];
|
||||
nodes_select_drag = false;
|
||||
nodes_select_mx = 0;
|
||||
nodes_select_my = 0;
|
||||
|
@ -125,10 +125,10 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
|
||||
toolbar_height = ui(40);
|
||||
|
||||
function toCenterNode() { #region
|
||||
function toCenterNode(_list = nodes_list) { #region
|
||||
if(!project.active) return;
|
||||
|
||||
if(ds_list_empty(nodes_list)) {
|
||||
if(ds_list_empty(_list)) {
|
||||
graph_x = round(w / 2 / graph_s);
|
||||
graph_y = round(h / 2 / graph_s);
|
||||
return;
|
||||
|
@ -139,8 +139,8 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
var miny = 99999;
|
||||
var maxy = -99999;
|
||||
|
||||
for(var i = 0; i < ds_list_size(nodes_list); i++) {
|
||||
var _node = nodes_list[| i];
|
||||
for(var i = 0; i < ds_list_size(_list); i++) {
|
||||
var _node = _list[| i];
|
||||
if(!is_struct(_node) || !is_instanceof(_node, Node) || !_node.active)
|
||||
continue;
|
||||
|
||||
|
@ -156,8 +156,6 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
|
||||
graph_x = round(graph_x);
|
||||
graph_y = round(graph_y);
|
||||
|
||||
//print(title + ": Center " + string(graph_x) + ", " + string(graph_y));
|
||||
} #endregion
|
||||
|
||||
function initSize() { toCenterNode(); } initSize();
|
||||
|
@ -549,29 +547,14 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
}
|
||||
|
||||
nodes_selecting = [ _node ];
|
||||
|
||||
var cx = _node.x + _node.w / 2;
|
||||
var cy = _node.y + _node.h / 2;
|
||||
|
||||
graph_x = w / 2 / graph_s - cx;
|
||||
graph_y = (h - toolbar_height) / 2 / graph_s - cy;
|
||||
|
||||
graph_x = round(graph_x);
|
||||
graph_y = round(graph_y);
|
||||
fullView();
|
||||
} #endregion
|
||||
|
||||
function fullView() { #region
|
||||
var _node = getFocusingNode();
|
||||
if(_node == noone) {
|
||||
toCenterNode();
|
||||
return;
|
||||
}
|
||||
|
||||
graph_x = -(_node.x + _node.w / 2) + w / 2 / graph_s;
|
||||
graph_y = -(_node.y + _node.h / 2) + h / 2 / graph_s;
|
||||
|
||||
graph_x = round(graph_x);
|
||||
graph_y = round(graph_y);
|
||||
gml_pragma("forceinline");
|
||||
var _l = ds_list_create_from_array(nodes_selecting);
|
||||
toCenterNode(array_empty(nodes_selecting)? nodes_list : _l);
|
||||
ds_list_destroy(_l);
|
||||
} #endregion
|
||||
|
||||
function dragGraph() { #region
|
||||
|
@ -834,7 +817,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
break;
|
||||
}
|
||||
if(!hover_selected)
|
||||
nodes_selecting = [];
|
||||
nodes_selecting = [ node_hovering ];
|
||||
}
|
||||
|
||||
array_foreach(nodes_selecting, function(node) { bringNodeToFront(node); });
|
||||
|
@ -991,24 +974,10 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
if(mouse_press(mb_left))
|
||||
node_dragging = noone;
|
||||
|
||||
for(var i = 0; i < ds_list_size(nodes_list); i++)
|
||||
nodes_list[| i].groupCheck(gr_x, gr_y, graph_s, mx, my);
|
||||
|
||||
if(node_dragging && !key_mod_press(ALT)) {
|
||||
if(key_mod_press(SHIFT)) { ////////////// Group dragging
|
||||
for(var i = 0; i < ds_list_size(nodes_list); i++) {
|
||||
var _node = nodes_list[| i];
|
||||
|
||||
_node.groupCheck(gr_x, gr_y, graph_s, mx, my);
|
||||
}
|
||||
|
||||
if(node_dragging && node_dragging.cache_group != noone)
|
||||
node_dragging.cache_group.removeNode(node_dragging);
|
||||
|
||||
for(var i = 0; i < array_length(nodes_selecting); i++) {
|
||||
var _node = nodes_selecting[i];
|
||||
if(_node.cache_group != noone)
|
||||
_node.cache_group.removeNode(_node);
|
||||
}
|
||||
}
|
||||
|
||||
var nx = node_drag_sx + (mouse_graph_x - node_drag_mx);
|
||||
var ny = node_drag_sy + (mouse_graph_y - node_drag_my);
|
||||
|
||||
|
@ -1862,7 +1831,8 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
} #endregion
|
||||
|
||||
function doDelete(_merge = false) { #region
|
||||
array_foreach(nodes_selecting, function(node) { if(node.manual_deletable) nodeDelete(node, _merge); });
|
||||
__temp_merge = _merge;
|
||||
array_foreach(nodes_selecting, function(node) { if(node.manual_deletable) nodeDelete(node, __temp_merge); });
|
||||
nodes_selecting = [];
|
||||
} #endregion
|
||||
|
||||
|
|
|
@ -502,21 +502,11 @@ function Panel_Preview() : PanelContent() constructor {
|
|||
} #endregion
|
||||
|
||||
function fullView() { #region
|
||||
var node = getNodePreview();
|
||||
if(node == noone) {
|
||||
canvas_s = 1;
|
||||
canvas_x = w / 2;
|
||||
canvas_y = (h - toolbar_height * 2) / 2;
|
||||
return;
|
||||
}
|
||||
var bbox = noone;
|
||||
|
||||
var bbox = node.getPreviewBoundingBox();
|
||||
if(bbox == noone) {
|
||||
canvas_s = 1;
|
||||
canvas_x = w / 2;
|
||||
canvas_y = (h - toolbar_height * 2) / 2;
|
||||
return;
|
||||
}
|
||||
var node = getNodePreview();
|
||||
if(node != noone) bbox = node.getPreviewBoundingBox();
|
||||
if(bbox == noone) bbox = BBOX().fromWH(0, 0, PROJECT.attributes.surface_dimension[0], PROJECT.attributes.surface_dimension[1]);
|
||||
|
||||
var ss = min((w - 32 - tool_side_drawing * 40) / bbox.w, (h - 32 - toolbar_height * 2) / bbox.h);
|
||||
canvas_s = ss;
|
||||
|
@ -768,7 +758,7 @@ function Panel_Preview() : PanelContent() constructor {
|
|||
function draw3D() { #region
|
||||
var _prev_node = getNodePreview();
|
||||
if(_prev_node == noone) return;
|
||||
if(!_prev_node.is_3D) return;
|
||||
if(!_prev_node.is_3D) return
|
||||
|
||||
_prev_node.previewing = 1;
|
||||
|
||||
|
@ -1435,7 +1425,7 @@ function Panel_Preview() : PanelContent() constructor {
|
|||
dragCanvas();
|
||||
drawNodePreview();
|
||||
}
|
||||
}
|
||||
} else dragCanvas();
|
||||
|
||||
drawPreviewOverlay();
|
||||
|
||||
|
|
|
@ -6,9 +6,10 @@ function Panel_Test() : PanelContent() constructor {
|
|||
test_dir = "D:\\Project\\MakhamDev\\LTS-PixelComposer\\TEST";
|
||||
tb_test_dir = new textBox(TEXTBOX_INPUT.text, function(txt) { test_dir = txt; });
|
||||
|
||||
testing = false;
|
||||
test_files = [];
|
||||
test_index = 0;
|
||||
testing = false;
|
||||
test_files = [];
|
||||
start_index = 0;
|
||||
test_index = start_index;
|
||||
|
||||
test_button_surface = surface_create(1, 1);
|
||||
|
||||
|
@ -40,20 +41,20 @@ function Panel_Test() : PanelContent() constructor {
|
|||
if(testing) return;
|
||||
|
||||
testing = true;
|
||||
test_index = 0;
|
||||
test_index = start_index;
|
||||
|
||||
test_files = [];
|
||||
scanDir(test_dir);
|
||||
|
||||
for( var i = 0, n = array_length(test_files); i < n; i++ ) {
|
||||
run_in(1 + i * 3, function(i) {
|
||||
for( var i = start_index, n = array_length(test_files); i < n; i++ ) {
|
||||
run_in(1 + (i - start_index) * 3, function(i) {
|
||||
try {
|
||||
print($"TESTING: {test_files[i]}");
|
||||
show_debug_message($"TESTING {i}/{array_length(test_files)}: {test_files[i]}");
|
||||
TEST_PATH(test_files[i]);
|
||||
test_index = i;
|
||||
print($" > Test complete");
|
||||
show_debug_message($" > Test complete");
|
||||
} catch(e) {
|
||||
print($" > Test failed");
|
||||
show_debug_message($" > Test failed");
|
||||
exception_print(e);
|
||||
}
|
||||
}, [i]);
|
||||
|
|
|
@ -1,33 +1,35 @@
|
|||
function shellOpenExplorer(path) {
|
||||
var _windir = environment_get_variable("WINDIR") + "/explorer.exe";
|
||||
path = string_replace_all(path, "/", "\\");
|
||||
shell_execute(_windir, path);
|
||||
shell_execute_async(_windir, path);
|
||||
}
|
||||
|
||||
function shell_execute(path, command, ref = noone) {
|
||||
gml_pragma("forceinline");
|
||||
|
||||
var txt = $"{path} {command}";
|
||||
if(global.PROC_ID == 0) noti_status(txt, THEME.noti_icon_console,, ref);
|
||||
|
||||
try {
|
||||
var res = execute_shell(path, command);
|
||||
if(global.PROC_ID == 0) noti_status("Execute shell complete", THEME.noti_icon_console,, ref);
|
||||
var res = ProcessExecute(txt);
|
||||
//if(global.PROC_ID == 0) noti_status("Execute shell complete", THEME.noti_icon_console,, ref);
|
||||
} catch(e) {
|
||||
if(global.PROC_ID == 0) noti_warning($"Execute shell failed: {e}", THEME.noti_icon_console_failed, COLORS._main_value_negative, ref);
|
||||
//if(global.PROC_ID == 0) noti_warning($"Execute shell failed: {e}", THEME.noti_icon_console_failed, ref);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
function shell_execute_async(path, command, ref = noone) {
|
||||
gml_pragma("forceinline");
|
||||
|
||||
var txt = $"{path} {command}";
|
||||
if(global.PROC_ID == 0) noti_status(txt, THEME.noti_icon_console,, ref);
|
||||
|
||||
try {
|
||||
var res = ProcessExecuteAsync(txt);
|
||||
if(global.PROC_ID == 0) noti_status("Execute shell complete", THEME.noti_icon_console,, ref);
|
||||
//if(global.PROC_ID == 0) noti_status("Execute shell complete", THEME.noti_icon_console,, ref);
|
||||
} catch(e) {
|
||||
if(global.PROC_ID == 0) noti_warning($"Execute shell failed: {e}", THEME.noti_icon_console_failed, COLORS._main_value_negative, ref);
|
||||
//if(global.PROC_ID == 0) noti_warning($"Execute shell failed: {e}", THEME.noti_icon_console_failed, ref);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
|
@ -46,7 +46,7 @@ function steam_ugc_update_collection(file, update_preview = false, update_note =
|
|||
STEAM_UGC_SUBMIT_ID = steam_ugc_submit_item_update(STEAM_UGC_UPDATE_HANDLE, update_note);
|
||||
}
|
||||
|
||||
function steam_ugc_collection_generate(file, dest_path = DIRECTORY + "steamUGCthumbnail.png") {
|
||||
function steam_ugc_collection_generate(file, dest_path = TEMPDIR + "steamUGCthumbnail.png") {
|
||||
file_delete(dest_path);
|
||||
var spr = STEAM_UGC_ITEM_FILE.getSpr();
|
||||
var prev_size = 512;
|
||||
|
|
|
@ -18,8 +18,6 @@ function steam_ugc_create_project() {
|
|||
var preview_surface = PANEL_PREVIEW.getNodePreviewSurface();
|
||||
surface_save_safe(preview_surface, DIRECTORY + "steamUGC/thumbnail.png");
|
||||
|
||||
print(filename_dir(DIRECTORY + "steamUGCthumbnail.png"))
|
||||
|
||||
STEAM_UGC_ITEM_ID = steam_ugc_create_item(STEAM_APP_ID, ugc_filetype_community);
|
||||
}
|
||||
|
||||
|
@ -53,7 +51,7 @@ function steam_ugc_update_project(update_preview = false, update_note = "Updated
|
|||
STEAM_UGC_SUBMIT_ID = steam_ugc_submit_item_update(STEAM_UGC_UPDATE_HANDLE, update_note);
|
||||
}
|
||||
|
||||
function steam_ugc_project_generate(dest_path = DIRECTORY + "steamUGCthumbnail.png") {
|
||||
function steam_ugc_project_generate(dest_path = TEMPDIR + "steamUGCthumbnail.png") {
|
||||
file_delete(dest_path);
|
||||
|
||||
var preview_surface = PANEL_PREVIEW.getNodePreviewSurface();
|
||||
|
|
|
@ -9,7 +9,7 @@ function draw_surface_safe(surface, _x = 0, _y = 0) {
|
|||
} else if(is_instanceof(surface, SurfaceAtlas))
|
||||
surface = surface.getSurface();
|
||||
}
|
||||
if(!is_surface(surface)) return;
|
||||
if(!surface_exists(surface)) return;
|
||||
|
||||
__channel_pre(surface);
|
||||
draw_surface(surface, _x, _y);
|
||||
|
@ -26,7 +26,7 @@ function draw_surface_stretched_safe(surface, _x, _y, _w, _h) {
|
|||
} else if(is_instanceof(surface, SurfaceAtlas))
|
||||
surface = surface.getSurface();
|
||||
}
|
||||
if(!is_surface(surface)) return;
|
||||
if(!surface_exists(surface)) return;
|
||||
|
||||
__channel_pre(surface);
|
||||
draw_surface_stretched(surface, _x, _y, _w, _h);
|
||||
|
@ -43,7 +43,8 @@ function draw_surface_ext_safe(surface, _x, _y, _xs = 1, _ys = 1, _rot = 0, _col
|
|||
} else if(is_instanceof(surface, SurfaceAtlas))
|
||||
surface = surface.getSurface();
|
||||
}
|
||||
if(!is_surface(surface)) return;
|
||||
|
||||
if(!surface_exists(surface)) return;
|
||||
|
||||
__channel_pre(surface);
|
||||
draw_surface_ext(surface, _x, _y, _xs, _ys, _rot, _col, _alpha);
|
||||
|
@ -60,7 +61,7 @@ function draw_surface_tiled_safe(surface, _x, _y) {
|
|||
} else if(is_instanceof(surface, SurfaceAtlas))
|
||||
surface = surface.getSurface();
|
||||
}
|
||||
if(!is_surface(surface)) return;
|
||||
if(!surface_exists(surface)) return;
|
||||
|
||||
__channel_pre(surface);
|
||||
draw_surface_tiled(surface, _x, _y);
|
||||
|
@ -77,7 +78,7 @@ function draw_surface_tiled_ext_safe(surface, _x, _y, _xs = 1, _ys = 1, _col = c
|
|||
} else if(is_instanceof(surface, SurfaceAtlas))
|
||||
surface = surface.getSurface();
|
||||
}
|
||||
if(!is_surface(surface)) return;
|
||||
if(!surface_exists(surface)) return;
|
||||
|
||||
__channel_pre(surface);
|
||||
draw_surface_tiled_ext(surface, _x, _y, _xs, _ys, _col, _alpha);
|
||||
|
@ -94,7 +95,7 @@ function draw_surface_part_ext_safe(surface, _l, _t, _w, _h, _x, _y, _xs = 1, _y
|
|||
} else if(is_instanceof(surface, SurfaceAtlas))
|
||||
surface = surface.getSurface();
|
||||
}
|
||||
if(!is_surface(surface)) return;
|
||||
if(!surface_exists(surface)) return;
|
||||
|
||||
__channel_pre(surface);
|
||||
draw_surface_part_ext(surface, _l, _t, _w, _h, _x, _y, _xs, _ys, _col, _alpha);
|
||||
|
|
Loading…
Reference in a new issue