From 6e315222852fbdd1a33bfc6ecaabe6b312837924 Mon Sep 17 00:00:00 2001 From: Tanasart Date: Mon, 12 Feb 2024 19:59:43 +0700 Subject: [PATCH] headless animation --- PixelComposer.resource_order | 4 +- PixelComposer.yyp | 4 +- fonts/_f_sdf/_f_sdf.old.png | Bin 82361 -> 82361 bytes fonts/_f_sdf/_f_sdf.png | Bin 82361 -> 82361 bytes fonts/_f_sdf_medium/_f_sdf_medium.old.png | Bin 59906 -> 59906 bytes fonts/_f_sdf_medium/_f_sdf_medium.png | Bin 59906 -> 59906 bytes objects/o_main/Create_0.gml | 17 +++-- objects/o_main/Step_1.gml | 24 ++++--- scripts/__node_custom/__node_custom.gml | 3 +- .../animation_controller.gml | 7 +- scripts/debug/debug.gml | 10 +-- scripts/load_function/load_function.gml | 2 +- scripts/node_data/node_data.gml | 4 +- scripts/node_export/node_export.gml | 11 +++- scripts/node_image/node_image.gml | 2 - scripts/node_registry/node_registry.gml | 61 ++++++++++-------- scripts/save_function/save_function.gml | 1 - scripts/shell_functions/shell_functions.gml | 2 + 18 files changed, 90 insertions(+), 62 deletions(-) diff --git a/PixelComposer.resource_order b/PixelComposer.resource_order index 343c4c565..9c74f2d7b 100644 --- a/PixelComposer.resource_order +++ b/PixelComposer.resource_order @@ -134,6 +134,8 @@ {"name":"for sort","order":11,"path":"folders/nodes/data/iterate/for sort.yy",}, {"name":"lua","order":12,"path":"folders/nodes/data/lua.yy",}, {"name":"misc","order":10,"path":"folders/nodes/data/misc.yy",}, + {"name":"lovify","order":26,"path":"folders/nodes/data/misc/lovify.yy",}, + {"name":"spr","order":6,"path":"folders/nodes/data/misc/lovify/spr.yy",}, {"name":"MK effects","order":24,"path":"folders/nodes/data/MK effects.yy",}, {"name":"mk flare","order":13,"path":"folders/nodes/data/MK effects/mk flare.yy",}, {"name":"src","order":1,"path":"folders/nodes/data/MK effects/mk flare/src.yy",}, @@ -268,8 +270,6 @@ {"name":"button","order":34,"path":"folders/widgets/button.yy",}, {"name":"rotator","order":35,"path":"folders/widgets/rotator.yy",}, {"name":"text","order":36,"path":"folders/widgets/text.yy",}, - {"name":"lovify","order":26,"path":"folders/nodes/data/misc/lovify.yy",}, - {"name":"spr","order":6,"path":"folders/nodes/data/misc/lovify/spr.yy",}, ], "ResourceOrderSettings": [ {"name":"s_node_corner","order":13,"path":"sprites/s_node_corner/s_node_corner.yy",}, diff --git a/PixelComposer.yyp b/PixelComposer.yyp index 4bd5568f1..b45467c1d 100644 --- a/PixelComposer.yyp +++ b/PixelComposer.yyp @@ -162,6 +162,8 @@ {"resourceType":"GMFolder","resourceVersion":"1.0","name":"for","folderPath":"folders/nodes/data/iterate/for.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"lua","folderPath":"folders/nodes/data/lua.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"misc","folderPath":"folders/nodes/data/misc.yy",}, + {"resourceType":"GMFolder","resourceVersion":"1.0","name":"lovify","folderPath":"folders/nodes/data/misc/lovify.yy",}, + {"resourceType":"GMFolder","resourceVersion":"1.0","name":"spr","folderPath":"folders/nodes/data/misc/lovify/spr.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"MK effects","folderPath":"folders/nodes/data/MK effects.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"mk flare","folderPath":"folders/nodes/data/MK effects/mk flare.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"src","folderPath":"folders/nodes/data/MK effects/mk flare/src.yy",}, @@ -304,8 +306,6 @@ {"resourceType":"GMFolder","resourceVersion":"1.0","name":"button","folderPath":"folders/widgets/button.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"rotator","folderPath":"folders/widgets/rotator.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"text","folderPath":"folders/widgets/text.yy",}, - {"resourceType":"GMFolder","resourceVersion":"1.0","name":"lovify","folderPath":"folders/nodes/data/misc/lovify.yy",}, - {"resourceType":"GMFolder","resourceVersion":"1.0","name":"spr","folderPath":"folders/nodes/data/misc/lovify/spr.yy",}, ], "IncludedFiles": [ {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"ApolloHelp.html","ConfigValues":{"Itch":{"CopyToMask":"0",},},"CopyToMask":-1,"filePath":"datafiles",}, diff --git a/fonts/_f_sdf/_f_sdf.old.png b/fonts/_f_sdf/_f_sdf.old.png index 163402c711e9c478d9c734a8747477ac99460a2b..8ec22ab00318944795a1eb40e12d0cb785b0b4fc 100644 GIT binary patch delta 96 zcmdnl%(}CgwP6dRiKB>7h=HM%shO35p|*j6m4Sh>y0G|k4@X8>44I&+)vKphIx;FK VpzC4H?zmvv4FO#q$t7y|$R delta 96 zcmdnl%(}CgwP6dRiKB>Nh=HY*k*SrbfwqBxm4QJ``TZNyJscTjF=TkP(o?2aIx;FK VpzDdUciYVX1fH&bF6*2Ung9u28CC!Q diff --git a/fonts/_f_sdf/_f_sdf.png b/fonts/_f_sdf/_f_sdf.png index 8ec22ab00318944795a1eb40e12d0cb785b0b4fc..84d3e9ce0091cfed15506e6c0c6eee7fa11c9d51 100644 GIT binary patch delta 90 zcmdnl%(}CgwP6dRnWK=Qk(G&=m9eR|fq|8Q!HzXa^QU__GRmWgpZs`Bd3vQIqmmq| U`gu=&|6u?EPgg&ebxsLQ0KVB9761SM delta 90 zcmdnl%(}CgwP6dRnWK<_p_Qqbm4TtQfq|8QfwH==_;e3PMtL;xpsLlYr&l^MD#@X$ TXU*>_VE_V8S3j3^P65u*?TLn~7=D+5Dq0|P4q17&q#@yQck%7&mz1XZnG&A`B*QQ{g= ul9E`GYE_b%n_66wm|MVLWME{XYha{nh^~h5yKDzODiK&D^mk)0|P4qgPQXDHzrSfDI0<=!K;;?!oa|wQQ{g= ul9E`GYE_b%n_66wm|MVLWME{XYha{nh^{Bf-fcHf4}+(xpUXO@geCyJ(;}Jx diff --git a/fonts/_f_sdf_medium/_f_sdf_medium.png b/fonts/_f_sdf_medium/_f_sdf_medium.png index 14a29a262d05b4eed17b844d2acddc4029b4f6c3..ffbddf141c6fff1c631b036b3e501de3c33bafe4 100644 GIT binary patch delta 86 zcmZp=!rXL)c|-k6Awwf86EiDgQ*8qSD+7ZaYm(+qp7>H8P59);TgsCUy;PDzRXy*? R?>`Jc;OXk;vd$@?2>>1O9f|+| delta 86 zcmZp=!rXL)c|-k6Ap=7zQ!^_ALu~^CD+2>%bz$+z6JN@s2?tfJUOoBHOC>o})vWnl QB@95|>FVdQ&MBb@0B+P6>> params {i}: {param}"); + //print($" >>> params {i}: {param}"); if(string_starts_with(param, "--")) { switch(param) { @@ -341,7 +346,6 @@ break; case "--h" : - debug_event("OutputDebugOn"); PROGRAM_ARGUMENTS._cmd = true; PROGRAM_ARGUMENTS._run = true; break; @@ -365,11 +369,12 @@ } } - if(struct_exists(PROGRAM_ARGUMENTS, "_path")) { + if(struct_has(PROGRAM_ARGUMENTS, "_path")) { var path = PROGRAM_ARGUMENTS._path; if(PROJECT == noone || PROJECT.path != path) { file_open_parameter = path; + run_in(1, function() { load_file_path(file_open_parameter); }); } } diff --git a/objects/o_main/Step_1.gml b/objects/o_main/Step_1.gml index 3c45aa9b3..445c20657 100644 --- a/objects/o_main/Step_1.gml +++ b/objects/o_main/Step_1.gml @@ -88,26 +88,29 @@ _HOVERING_ELEMENT = noone; PROJECT.animator.is_simulating = false; array_foreach(PROJECT.nodeArray, function(_node) { if(!_node.active) return; _node.stepBegin(); }); - if(IS_PLAYING || IS_RENDERING) { + if(PROGRAM_ARGUMENTS._run) { + if(PROJECT != noone && PROJECT.path != "") { + exportAll(); + PROGRAM_ARGUMENTS._run = false; + } + + } else if(IS_PLAYING || IS_RENDERING) { if(PROJECT.animator.frame_progress) { __addon_preAnim(); if(IS_FIRST_FRAME) ResetAllNodesRender(); - Render(true); + + if(IS_CMD) Render(false); + else Render(true); __addon_postAnim(); } PROJECT.animator.frame_progress = false; + } else { if(UPDATE & RENDER_TYPE.full) { - if(PROGRAM_ARGUMENTS._run) { - exportAll(); - PROGRAM_ARGUMENTS._run = false; - - if(!IS_RENDERING && !PROGRAM_ARGUMENTS._persist) game_end(); - } else - Render(); + Render(); } else if(UPDATE & RENDER_TYPE.partial) Render(true); @@ -116,6 +119,9 @@ _HOVERING_ELEMENT = noone; } } + if(IS_CMD && PROGRAM_ARGUMENTS._run == false && array_empty(PROGRAM_ARGUMENTS._exporting) && !PROGRAM_ARGUMENTS._persist) + game_end(); + UPDATE = RENDER_TYPE.none; #endregion diff --git a/scripts/__node_custom/__node_custom.gml b/scripts/__node_custom/__node_custom.gml index e2b6c1606..2d4c0004a 100644 --- a/scripts/__node_custom/__node_custom.gml +++ b/scripts/__node_custom/__node_custom.gml @@ -187,8 +187,7 @@ function __initNodeCustom(list) { #region if(_info == noone) continue; var _spr = sprite_add_center(_dir + _info.icon); - var _n = new NodeObject(_info.name, _spr, "Node_Custom", [ 0, Node_create_Custom, { path: _dir_raw } ], _info.tags); - _n.tooltip = _info.tooltip; + var _n = new NodeObject(_info.name, _spr, "Node_Custom", [ 0, Node_create_Custom, { path: _dir_raw } ], _info.tooltip, _info.tags); var _tol = _dir + _info.tooltip_spr; if(file_exists_empty(_tol)) _n.tooltip_spr = sprite_add(_tol, 0, false, false, 0, 0); diff --git a/scripts/animation_controller/animation_controller.gml b/scripts/animation_controller/animation_controller.gml index 9d7841b0d..5a17a0227 100644 --- a/scripts/animation_controller/animation_controller.gml +++ b/scripts/animation_controller/animation_controller.gml @@ -153,7 +153,10 @@ time_since_last_frame += delta_time / 1_000_000; var tslf = time_since_last_frame; - if(time_since_last_frame >= _frTime) { + if(0 && IS_CMD) { + setFrame(real_frame + 1); + + } else if(time_since_last_frame >= _frTime) { var dt = time_since_last_frame - _frTime; setFrame(real_frame + 1); time_since_last_frame = dt; @@ -166,8 +169,6 @@ is_playing = false; is_rendering = false; time_since_last_frame = 0; - - if(PROGRAM_ARGUMENTS._cmd && !PROGRAM_ARGUMENTS._persist) game_end(); } } diff --git a/scripts/debug/debug.gml b/scripts/debug/debug.gml index ee1adcad1..841f9fdc2 100644 --- a/scripts/debug/debug.gml +++ b/scripts/debug/debug.gml @@ -26,16 +26,16 @@ function __log(title, str, fname = "log/log.txt") { #region function log_message(title, str, icon = noone, flash = false, write = true) { #region if(TEST_ERROR) return; - if(IS_CMD) return; + if(IS_CMD) { show_debug_message($"{title}: {str}"); return; } - if(write) __log("[MESSAGE] ", string(title) + ": " + string(str)); + if(write) __log("[MESSAGE] ", $"{title}: {str}"); - return noti_status(string(title) + ": " + string(str), icon, flash); + return noti_status($"{title}: {str}", icon, flash); } #endregion function log_warning(title, str, ref = noone) { #region if(TEST_ERROR) return; - if(IS_CMD) return; + if(IS_CMD) { show_debug_message($"{title}: {str}"); return; } __log("[WARNING] ", string(title) + ": " + string(str)); @@ -44,7 +44,7 @@ function log_warning(title, str, ref = noone) { #region function log_crash(str) { #region if(TEST_ERROR) return; - if(IS_CMD) return; + if(IS_CMD) { show_debug_message($"{title}: {str}"); return; } __log("[ERROR] ", string(str)); diff --git a/scripts/load_function/load_function.gml b/scripts/load_function/load_function.gml index 961aa9545..4c6c9f68d 100644 --- a/scripts/load_function/load_function.gml +++ b/scripts/load_function/load_function.gml @@ -259,7 +259,7 @@ function LOAD_AT(path, readonly = false, override = false) { #region if(!IS_CMD) run_in(1, PANEL_GRAPH.toCenterNode); - //print($"========== Load completed in {(get_timer() - t) / 1000} ms =========="); + //print($"========== Load {ds_map_size(PROJECT.nodeMap)} nodes completed in {(get_timer() - t) / 1000} ms =========="); return true; } #endregion diff --git a/scripts/node_data/node_data.gml b/scripts/node_data/node_data.gml index 94cbec2e0..d3b89eda0 100644 --- a/scripts/node_data/node_data.gml +++ b/scripts/node_data/node_data.gml @@ -263,7 +263,9 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { static createNewInput = noone; static initTooltip = function() { #region - var type_self/*:string*/ = instanceof(self); + if(IS_CMD) return; + + var type_self = instanceof(self); if(!struct_has(global.NODE_GUIDE, type_self)) return; var _n = global.NODE_GUIDE[$ type_self]; diff --git a/scripts/node_export/node_export.gml b/scripts/node_export/node_export.gml index d9aa88686..6d5060db3 100644 --- a/scripts/node_export/node_export.gml +++ b/scripts/node_export/node_export.gml @@ -23,13 +23,14 @@ function exportAll() { if(IS_RENDERING) return; var key = ds_map_find_first(PROJECT.nodeMap); + repeat(ds_map_size(PROJECT.nodeMap)) { - var node = PROJECT.nodeMap[? key]; + var node = PROJECT.nodeMap[? key]; key = ds_map_find_next(PROJECT.nodeMap, key); if(!node.active) continue; if(!is_instanceof(node, Node_Export)) continue; - + node.doInspectorAction(); } } #endregion @@ -550,6 +551,8 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor } #endregion static export = function() { #region + //print($">>>>>>>>>>>>>>>>>>>> export {CURRENT_FRAME} <<<<<<<<<<<<<<<<<<<<"); + var surf = getInputData( 0); var path = getInputData( 1); var suff = getInputData( 2); @@ -713,6 +716,8 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor PROJECT.animator.render(); + if(IS_CMD) array_push(PROGRAM_ARGUMENTS._exporting, node_id); + if(directory_exists(directory)) directory_destroy(directory); directory_create(directory); @@ -807,6 +812,8 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor } render_process_id = 0; + + if(IS_CMD) array_remove(PROGRAM_ARGUMENTS._exporting, node_id); } } } #endregion diff --git a/scripts/node_image/node_image.gml b/scripts/node_image/node_image.gml index bff5402c4..2ec016456 100644 --- a/scripts/node_image/node_image.gml +++ b/scripts/node_image/node_image.gml @@ -116,8 +116,6 @@ function Node_Image(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { draw_sprite(spr, 0, pad[2], pad[1]); surface_reset_shader(); - //print($"Image: {spr} | {_outsurf} | {surface_exists(_outsurf)}"); - if(!first_update) return; first_update = false; diff --git a/scripts/node_registry/node_registry.gml b/scripts/node_registry/node_registry.gml index a790f3bc1..8f5342b4f 100644 --- a/scripts/node_registry/node_registry.gml +++ b/scripts/node_registry/node_registry.gml @@ -1,14 +1,15 @@ -function NodeObject(_name, _spr, _node, _create, tags = []) constructor { #region +function NodeObject(_name, _spr, _node, _create, tooltip = "", tags = []) constructor { #region name = _name; spr = _spr; node = _node; icon = noone; createNode = _create; - self.tags = tags; - new_node = false; - tooltip = ""; + self.tags = tags; + self.tooltip = tooltip; + + new_node = false; tooltip_spr = noone; deprecated = false; @@ -17,20 +18,22 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor { #regio is_patreon_extra = false; - if(!IS_CMD) { + if(!IS_CMD) { #region var pth = DIRECTORY + "Nodes/tooltip/" + node + ".png"; if(file_exists_empty(pth)) tooltip_spr = sprite_add(pth, 0, false, false, 0, 0); - } - - if(!IS_CMD && struct_has(global.NODE_GUIDE, node)) { #region - var _n = global.NODE_GUIDEarn[$ node]; - name = _n.name; - if(_n.tooltip != "") - tooltip = _n.tooltip; + + if(struct_has(global.NODE_GUIDE, node)) { + var _n = global.NODE_GUIDEarn[$ node]; + name = _n.name; + if(_n.tooltip != "") + tooltip = _n.tooltip; + } } #endregion static setVersion = function(version) { #region INLINE + if(!IS_CMD) return self; + new_node = version >= LATEST_VERSION; if(new_node) { @@ -46,30 +49,40 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor { #regio static setIcon = function(icon) { #region INLINE + if(!IS_CMD) return self; + self.icon = icon; return self; } #endregion static isDeprecated = function() { #region INLINE + if(!IS_CMD) return self; + deprecated = true; return self; } #endregion static hideRecent = function() { #region INLINE + if(!IS_CMD) return self; + show_in_recent = false; return self; } #endregion static hideGlobal = function() { #region INLINE + if(!IS_CMD) return self; + show_in_global = false; return self; } #endregion static patreonExtra = function() { #region INLINE + if(!IS_CMD) return self; + is_patreon_extra = true; ds_list_add(SUPPORTER_NODES, self); @@ -185,13 +198,12 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor { #regio } #endregion #region globalvar - globalvar ALL_NODES, ALL_NODE_LIST, NODE_CATEGORY, NODE_PB_CATEGORY, NODE_PCX_CATEGORY; + globalvar ALL_NODES, NODE_CATEGORY, NODE_PB_CATEGORY, NODE_PCX_CATEGORY; globalvar SUPPORTER_NODES, NEW_NODES; globalvar NODE_PAGE_DEFAULT; ALL_NODES = ds_map_create(); - ALL_NODE_LIST = ds_list_create(); NODE_CATEGORY = ds_list_create(); NODE_PB_CATEGORY = ds_list_create(); NODE_PCX_CATEGORY = ds_list_create(); @@ -213,18 +225,15 @@ function nodeBuild(_name, _x, _y, _group = PANEL_GRAPH.getCurrentContext()) { #r } #endregion function addNodeObject(_list, _name, _spr, _node, _fun, _tag = [], tooltip = "") { #region - var _n; - - if(ds_map_exists(ALL_NODES, _node)) - _n = ALL_NODES[? _node]; - else { - _n = new NodeObject(_name, _spr, _node, _fun, _tag); - if(!ds_map_exists(ALL_NODES, _node)) - ds_list_add(ALL_NODE_LIST, _n); - ALL_NODES[? _node] = _n; + if(ds_map_exists(ALL_NODES, _node)) { + var _n = ALL_NODES[? _node]; + ds_list_add(_list, _n); + return _n; } - if(tooltip != "") _n.tooltip = tooltip; + var _n = new NodeObject(_name, _spr, _node, _fun, tooltip, _tag); + ALL_NODES[? _node] = _n; + ds_list_add(_list, _n); return _n; } #endregion @@ -439,7 +448,7 @@ function __initNodes() { addNodeObject(strandSim, "Strand Collision", s_node_strandSim_collide, "Node_Strand_Collision", [1, Node_Strand_Collision],, "Create solid object for strands to collides to.").hideRecent().setVersion(1140); #endregion - //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ + ////\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ var input = ds_list_create(); #region addNodeCatagory("IO", input); @@ -496,7 +505,7 @@ function __initNodes() { addNodeObject(transform, "Composite", s_node_compose, "Node_Composite", [1, Node_Composite], ["merge"], "Combine multiple images with controllable position, rotation, scale."); addNodeObject(transform, "Nine Slice", s_node_9patch, "Node_9Slice", [1, Node_9Slice], ["9 slice", "splice"], "Cut image into 3x3 parts, and scale/repeat only the middle part."); addNodeObject(transform, "Padding", s_node_padding, "Node_Padding", [1, Node_Padding],, "Make image bigger by adding space in 4 directions."); - //addNodeObject(transform, "Tile Random", s_node_padding, "Node_Tile_Random", [1, Node_Tile_Random]); + addNodeObject(transform, "Tile Random", s_node_padding, "Node_Tile_Random", [1, Node_Tile_Random]); #endregion var filter = ds_list_create(); #region diff --git a/scripts/save_function/save_function.gml b/scripts/save_function/save_function.gml index 8f762cefb..f1163235b 100644 --- a/scripts/save_function/save_function.gml +++ b/scripts/save_function/save_function.gml @@ -86,7 +86,6 @@ function SAVE_ALL() { #region function SAVE(project = PROJECT) { #region if(DEMO) return false; - print("SAVE"); if(project.path == "" || project.readonly) return SAVE_AS(project); return SAVE_AT(project, project.path); diff --git a/scripts/shell_functions/shell_functions.gml b/scripts/shell_functions/shell_functions.gml index b95c71a48..1626811fc 100644 --- a/scripts/shell_functions/shell_functions.gml +++ b/scripts/shell_functions/shell_functions.gml @@ -27,6 +27,8 @@ function shell_execute(path, command, ref = noone) { #region function shell_execute_async(path, command, ref = noone) { #region INLINE + if(IS_CMD) return shell_execute(path, command, ref); + if(OS == os_macosx) { path = string_replace_all(path, "\\", "/"); command = string_replace_all(command, "\\", "/");