headless animation

This commit is contained in:
Tanasart 2024-02-12 19:59:43 +07:00
parent fcb50a51d8
commit 6e31522285
18 changed files with 90 additions and 62 deletions

View file

@ -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",},

View file

@ -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",},

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 58 KiB

View file

@ -319,19 +319,24 @@
globalvar PROGRAM_ARGUMENTS;
PROGRAM_ARGUMENTS = {
_cmd : false,
_run : false,
_persist : false,
_cmd : false,
_run : false,
_exporting : [],
_persist : false,
};
//.\PixelComposer.exe "D:/Project/MakhamDev/LTS-PixelComposer/TEST/terminal/outline.pxc" --h -image "D:/Project/MakhamDev/LTS-PixelComposer/TEST/terminal/05.png"
PROGRAM_ARGUMENTS._path = "D:/Project/MakhamDev/LTS-PixelComposer/TEST/terminal/moveup.pxc";
PROGRAM_ARGUMENTS.image = "D:/Project/MakhamDev/LTS-PixelComposer/TEST/terminal/05.png";
PROGRAM_ARGUMENTS._cmd = true;
PROGRAM_ARGUMENTS._run = true;
var paramCount = parameter_count();
var paramType = "_path";
for( var i = 0; i < paramCount; i++ ) {
var param = parameter_string(i);
print($" >>> 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); });
}
}

View file

@ -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

View file

@ -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);

View file

@ -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();
}
}

View file

@ -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));

View file

@ -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

View file

@ -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];

View file

@ -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

View file

@ -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;

View file

@ -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

View file

@ -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);

View file

@ -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, "\\", "/");