Add auto execute separate shape

This commit is contained in:
Tanasart 2023-03-24 11:55:34 +07:00
parent fde00230b8
commit 02a5b3bd0f
22 changed files with 184 additions and 139 deletions

View file

@ -47,7 +47,6 @@
{"name":"lua","order":24,"path":"folders/functions/lua.yy",}, {"name":"lua","order":24,"path":"folders/functions/lua.yy",},
{"name":"packing","order":32,"path":"folders/functions/packing.yy",}, {"name":"packing","order":32,"path":"folders/functions/packing.yy",},
{"name":"physics","order":21,"path":"folders/functions/physics.yy",}, {"name":"physics","order":21,"path":"folders/functions/physics.yy",},
{"name":"regex","order":11,"path":"folders/functions/regex.yy",},
{"name":"shader","order":16,"path":"folders/functions/shader.yy",}, {"name":"shader","order":16,"path":"folders/functions/shader.yy",},
{"name":"string","order":4,"path":"folders/functions/string.yy",}, {"name":"string","order":4,"path":"folders/functions/string.yy",},
{"name":"surface","order":8,"path":"folders/functions/surface.yy",}, {"name":"surface","order":8,"path":"folders/functions/surface.yy",},
@ -404,7 +403,7 @@
{"name":"sh_twirl","order":3,"path":"shaders/sh_twirl/sh_twirl.yy",}, {"name":"sh_twirl","order":3,"path":"shaders/sh_twirl/sh_twirl.yy",},
{"name":"s_node_shape","order":14,"path":"sprites/s_node_shape/s_node_shape.yy",}, {"name":"s_node_shape","order":14,"path":"sprites/s_node_shape/s_node_shape.yy",},
{"name":"time_source","order":25,"path":"scripts/time_source/time_source.yy",}, {"name":"time_source","order":25,"path":"scripts/time_source/time_source.yy",},
{"name":"string_formatting","order":7,"path":"scripts/string_formatting/string_formatting.yy",}, {"name":"string_formatting","order":5,"path":"scripts/string_formatting/string_formatting.yy",},
{"name":"node_level_selector","order":8,"path":"scripts/node_level_selector/node_level_selector.yy",}, {"name":"node_level_selector","order":8,"path":"scripts/node_level_selector/node_level_selector.yy",},
{"name":"node_posterize","order":13,"path":"scripts/node_posterize/node_posterize.yy",}, {"name":"node_posterize","order":13,"path":"scripts/node_posterize/node_posterize.yy",},
{"name":"o_dialog_image_array_edit","order":4,"path":"objects/o_dialog_image_array_edit/o_dialog_image_array_edit.yy",}, {"name":"o_dialog_image_array_edit","order":4,"path":"objects/o_dialog_image_array_edit/o_dialog_image_array_edit.yy",},
@ -445,7 +444,7 @@
{"name":"node_mirror","order":3,"path":"scripts/node_mirror/node_mirror.yy",}, {"name":"node_mirror","order":3,"path":"scripts/node_mirror/node_mirror.yy",},
{"name":"node_corner","order":6,"path":"scripts/node_corner/node_corner.yy",}, {"name":"node_corner","order":6,"path":"scripts/node_corner/node_corner.yy",},
{"name":"s_node_path_wave","order":7,"path":"sprites/s_node_path_wave/s_node_path_wave.yy",}, {"name":"s_node_path_wave","order":7,"path":"sprites/s_node_path_wave/s_node_path_wave.yy",},
{"name":"string_function","order":8,"path":"scripts/string_function/string_function.yy",}, {"name":"string_function","order":6,"path":"scripts/string_function/string_function.yy",},
{"name":"o_dialog_palette","order":2,"path":"objects/o_dialog_palette/o_dialog_palette.yy",}, {"name":"o_dialog_palette","order":2,"path":"objects/o_dialog_palette/o_dialog_palette.yy",},
{"name":"sh_blend_hue","order":17,"path":"shaders/sh_blend_hue/sh_blend_hue.yy",}, {"name":"sh_blend_hue","order":17,"path":"shaders/sh_blend_hue/sh_blend_hue.yy",},
{"name":"s_node_threshold","order":45,"path":"sprites/s_node_threshold/s_node_threshold.yy",}, {"name":"s_node_threshold","order":45,"path":"sprites/s_node_threshold/s_node_threshold.yy",},
@ -735,7 +734,7 @@
{"name":"node_fluid_domain","order":1,"path":"scripts/node_fluid_domain/node_fluid_domain.yy",}, {"name":"node_fluid_domain","order":1,"path":"scripts/node_fluid_domain/node_fluid_domain.yy",},
{"name":"s_node_repeat","order":23,"path":"sprites/s_node_repeat/s_node_repeat.yy",}, {"name":"s_node_repeat","order":23,"path":"sprites/s_node_repeat/s_node_repeat.yy",},
{"name":"s_node_array_length","order":5,"path":"sprites/s_node_array_length/s_node_array_length.yy",}, {"name":"s_node_array_length","order":5,"path":"sprites/s_node_array_length/s_node_array_length.yy",},
{"name":"string_splice","order":5,"path":"scripts/string_splice/string_splice.yy",}, {"name":"string_splice","order":3,"path":"scripts/string_splice/string_splice.yy",},
{"name":"s_node_vfx_input","order":12,"path":"sprites/s_node_vfx_input/s_node_vfx_input.yy",}, {"name":"s_node_vfx_input","order":12,"path":"sprites/s_node_vfx_input/s_node_vfx_input.yy",},
{"name":"node_strand_force_apply","order":6,"path":"scripts/node_strand_force_apply/node_strand_force_apply.yy",}, {"name":"node_strand_force_apply","order":6,"path":"scripts/node_strand_force_apply/node_strand_force_apply.yy",},
{"name":"sh_seperate_shape_ite","order":2,"path":"shaders/sh_seperate_shape_ite/sh_seperate_shape_ite.yy",}, {"name":"sh_seperate_shape_ite","order":2,"path":"shaders/sh_seperate_shape_ite/sh_seperate_shape_ite.yy",},
@ -884,6 +883,7 @@
{"name":"node_local_analyze","order":17,"path":"scripts/node_local_analyze/node_local_analyze.yy",}, {"name":"node_local_analyze","order":17,"path":"scripts/node_local_analyze/node_local_analyze.yy",},
{"name":"s_node_blur_contrast","order":8,"path":"sprites/s_node_blur_contrast/s_node_blur_contrast.yy",}, {"name":"s_node_blur_contrast","order":8,"path":"sprites/s_node_blur_contrast/s_node_blur_contrast.yy",},
{"name":"fd_y","order":5,"path":"scripts/fd_y/fd_y.yy",}, {"name":"fd_y","order":5,"path":"scripts/fd_y/fd_y.yy",},
{"name":"node_string_regex_search","order":23,"path":"scripts/node_string_regex_search/node_string_regex_search.yy",},
{"name":"s_node_text_render","order":17,"path":"sprites/s_node_text_render/s_node_text_render.yy",}, {"name":"s_node_text_render","order":17,"path":"sprites/s_node_text_render/s_node_text_render.yy",},
{"name":"__init_global","order":8,"path":"scripts/__init_global/__init_global.yy",}, {"name":"__init_global","order":8,"path":"scripts/__init_global/__init_global.yy",},
{"name":"sh_trail_filler_pass2","order":51,"path":"shaders/sh_trail_filler_pass2/sh_trail_filler_pass2.yy",}, {"name":"sh_trail_filler_pass2","order":51,"path":"shaders/sh_trail_filler_pass2/sh_trail_filler_pass2.yy",},
@ -891,7 +891,7 @@
{"name":"node_scale_algo","order":12,"path":"scripts/node_scale_algo/node_scale_algo.yy",}, {"name":"node_scale_algo","order":12,"path":"scripts/node_scale_algo/node_scale_algo.yy",},
{"name":"node_alpha_hash","order":11,"path":"scripts/node_alpha_hash/node_alpha_hash.yy",}, {"name":"node_alpha_hash","order":11,"path":"scripts/node_alpha_hash/node_alpha_hash.yy",},
{"name":"mouse_input","order":1,"path":"scripts/mouse_input/mouse_input.yy",}, {"name":"mouse_input","order":1,"path":"scripts/mouse_input/mouse_input.yy",},
{"name":"string_cut","order":4,"path":"scripts/string_cut/string_cut.yy",}, {"name":"string_cut","order":2,"path":"scripts/string_cut/string_cut.yy",},
{"name":"node_3d_prim_cylinder","order":7,"path":"scripts/node_3d_prim_cylinder/node_3d_prim_cylinder.yy",}, {"name":"node_3d_prim_cylinder","order":7,"path":"scripts/node_3d_prim_cylinder/node_3d_prim_cylinder.yy",},
{"name":"panel_nodes","order":2,"path":"scripts/panel_nodes/panel_nodes.yy",}, {"name":"panel_nodes","order":2,"path":"scripts/panel_nodes/panel_nodes.yy",},
{"name":"sh_gradient_points","order":19,"path":"shaders/sh_gradient_points/sh_gradient_points.yy",}, {"name":"sh_gradient_points","order":19,"path":"shaders/sh_gradient_points/sh_gradient_points.yy",},
@ -1038,6 +1038,7 @@
{"name":"fd_rectangle_add_material","order":4,"path":"scripts/fd_rectangle_add_material/fd_rectangle_add_material.yy",}, {"name":"fd_rectangle_add_material","order":4,"path":"scripts/fd_rectangle_add_material/fd_rectangle_add_material.yy",},
{"name":"fd_rectangle_set_target","order":18,"path":"scripts/fd_rectangle_set_target/fd_rectangle_set_target.yy",}, {"name":"fd_rectangle_set_target","order":18,"path":"scripts/fd_rectangle_set_target/fd_rectangle_set_target.yy",},
{"name":"draw_line_dashed","order":7,"path":"scripts/draw_line_dashed/draw_line_dashed.yy",}, {"name":"draw_line_dashed","order":7,"path":"scripts/draw_line_dashed/draw_line_dashed.yy",},
{"name":"pseudo_regex","order":7,"path":"scripts/pseudo_regex/pseudo_regex.yy",},
{"name":"node_invert","order":6,"path":"scripts/node_invert/node_invert.yy",}, {"name":"node_invert","order":6,"path":"scripts/node_invert/node_invert.yy",},
{"name":"o_dialog_history","order":3,"path":"objects/o_dialog_history/o_dialog_history.yy",}, {"name":"o_dialog_history","order":3,"path":"objects/o_dialog_history/o_dialog_history.yy",},
{"name":"draw_background_stretched","order":5,"path":"scripts/draw_background_stretched/draw_background_stretched.yy",}, {"name":"draw_background_stretched","order":5,"path":"scripts/draw_background_stretched/draw_background_stretched.yy",},
@ -1048,7 +1049,7 @@
{"name":"s_node_group_output","order":15,"path":"sprites/s_node_group_output/s_node_group_output.yy",}, {"name":"s_node_group_output","order":15,"path":"sprites/s_node_group_output/s_node_group_output.yy",},
{"name":"node_path_l_system","order":10,"path":"scripts/node_path_l_system/node_path_l_system.yy",}, {"name":"node_path_l_system","order":10,"path":"scripts/node_path_l_system/node_path_l_system.yy",},
{"name":"sh_channel_S","order":5,"path":"shaders/sh_channel_S/sh_channel_S.yy",}, {"name":"sh_channel_S","order":5,"path":"shaders/sh_channel_S/sh_channel_S.yy",},
{"name":"string_scale","order":6,"path":"scripts/string_scale/string_scale.yy",}, {"name":"string_scale","order":4,"path":"scripts/string_scale/string_scale.yy",},
{"name":"s_node_cache","order":27,"path":"sprites/s_node_cache/s_node_cache.yy",}, {"name":"s_node_cache","order":27,"path":"sprites/s_node_cache/s_node_cache.yy",},
{"name":"node_repeat","order":26,"path":"scripts/node_repeat/node_repeat.yy",}, {"name":"node_repeat","order":26,"path":"scripts/node_repeat/node_repeat.yy",},
{"name":"sh_fd_advect_velocity_1_glsl","order":7,"path":"shaders/sh_fd_advect_velocity_1_glsl/sh_fd_advect_velocity_1_glsl.yy",}, {"name":"sh_fd_advect_velocity_1_glsl","order":7,"path":"shaders/sh_fd_advect_velocity_1_glsl/sh_fd_advect_velocity_1_glsl.yy",},

View file

@ -65,7 +65,6 @@
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"migration","folderPath":"folders/functions/migration.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"migration","folderPath":"folders/functions/migration.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"packing","folderPath":"folders/functions/packing.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"packing","folderPath":"folders/functions/packing.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"physics","folderPath":"folders/functions/physics.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"physics","folderPath":"folders/functions/physics.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"regex","folderPath":"folders/functions/regex.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"shader","folderPath":"folders/functions/shader.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"shader","folderPath":"folders/functions/shader.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"string","folderPath":"folders/functions/string.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"string","folderPath":"folders/functions/string.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"surface","folderPath":"folders/functions/surface.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"surface","folderPath":"folders/functions/surface.yy",},
@ -1383,6 +1382,7 @@
{"id":{"name":"node_local_analyze","path":"scripts/node_local_analyze/node_local_analyze.yy",},}, {"id":{"name":"node_local_analyze","path":"scripts/node_local_analyze/node_local_analyze.yy",},},
{"id":{"name":"s_node_blur_contrast","path":"sprites/s_node_blur_contrast/s_node_blur_contrast.yy",},}, {"id":{"name":"s_node_blur_contrast","path":"sprites/s_node_blur_contrast/s_node_blur_contrast.yy",},},
{"id":{"name":"fd_y","path":"scripts/fd_y/fd_y.yy",},}, {"id":{"name":"fd_y","path":"scripts/fd_y/fd_y.yy",},},
{"id":{"name":"node_string_regex_search","path":"scripts/node_string_regex_search/node_string_regex_search.yy",},},
{"id":{"name":"s_node_text_render","path":"sprites/s_node_text_render/s_node_text_render.yy",},}, {"id":{"name":"s_node_text_render","path":"sprites/s_node_text_render/s_node_text_render.yy",},},
{"id":{"name":"__init_global","path":"scripts/__init_global/__init_global.yy",},}, {"id":{"name":"__init_global","path":"scripts/__init_global/__init_global.yy",},},
{"id":{"name":"sh_trail_filler_pass2","path":"shaders/sh_trail_filler_pass2/sh_trail_filler_pass2.yy",},}, {"id":{"name":"sh_trail_filler_pass2","path":"shaders/sh_trail_filler_pass2/sh_trail_filler_pass2.yy",},},
@ -1561,7 +1561,7 @@
{"id":{"name":"fd_rectangle_add_material","path":"scripts/fd_rectangle_add_material/fd_rectangle_add_material.yy",},}, {"id":{"name":"fd_rectangle_add_material","path":"scripts/fd_rectangle_add_material/fd_rectangle_add_material.yy",},},
{"id":{"name":"fd_rectangle_set_target","path":"scripts/fd_rectangle_set_target/fd_rectangle_set_target.yy",},}, {"id":{"name":"fd_rectangle_set_target","path":"scripts/fd_rectangle_set_target/fd_rectangle_set_target.yy",},},
{"id":{"name":"draw_line_dashed","path":"scripts/draw_line_dashed/draw_line_dashed.yy",},}, {"id":{"name":"draw_line_dashed","path":"scripts/draw_line_dashed/draw_line_dashed.yy",},},
{"id":{"name":"regex","path":"scripts/regex/regex.yy",},}, {"id":{"name":"pseudo_regex","path":"scripts/pseudo_regex/pseudo_regex.yy",},},
{"id":{"name":"node_invert","path":"scripts/node_invert/node_invert.yy",},}, {"id":{"name":"node_invert","path":"scripts/node_invert/node_invert.yy",},},
{"id":{"name":"o_dialog_history","path":"objects/o_dialog_history/o_dialog_history.yy",},}, {"id":{"name":"o_dialog_history","path":"objects/o_dialog_history/o_dialog_history.yy",},},
{"id":{"name":"draw_background_stretched","path":"scripts/draw_background_stretched/draw_background_stretched.yy",},}, {"id":{"name":"draw_background_stretched","path":"scripts/draw_background_stretched/draw_background_stretched.yy",},},

View file

@ -288,6 +288,8 @@ event_inherited();
var cProg = 0; var cProg = 0;
hh += grid_space; hh += grid_space;
grid_width = (content_pane.surface_w - grid_space) / col - grid_space;
for(var index = 0; index < node_count; index++) { for(var index = 0; index < node_count; index++) {
var _node = _list[| index]; var _node = _list[| index];
if(is_string(_node)) { if(is_string(_node)) {
@ -565,6 +567,7 @@ event_inherited();
var index = 0; var index = 0;
var name_height = 0; var name_height = 0;
grid_width = (search_pane.surface_w - grid_space) / col - grid_space;
hh += (grid_space + grid_size) * 2; hh += (grid_space + grid_size) * 2;
for(var i = 0; i < amo; i++) { for(var i = 0; i < amo; i++) {

View file

@ -33,7 +33,7 @@
globalvar VERSION, SAVEFILE_VERSION, VERSION_STRING; globalvar VERSION, SAVEFILE_VERSION, VERSION_STRING;
VERSION = 1140; VERSION = 1140;
SAVEFILE_VERSION = 1400; SAVEFILE_VERSION = 1400;
VERSION_STRING = "1.14.0pr3"; VERSION_STRING = "1.14.0pr4";
globalvar NODES, NODE_MAP, APPEND_MAP, HOTKEYS, HOTKEY_CONTEXT, NODE_INSTANCES; globalvar NODES, NODE_MAP, APPEND_MAP, HOTKEYS, HOTKEY_CONTEXT, NODE_INSTANCES;

View file

@ -116,15 +116,6 @@ function __LOAD_PATH(path, readonly = false, safe_mode = false) {
log_warning("LOAD, global", exception_print(e)); log_warning("LOAD, global", exception_print(e));
} }
//try {
// if(ds_map_exists(_map, "graph")) {
// PANEL_GRAPH.graph_x = ds_map_try_get(_map[? "graph"], "graph_x");
// PANEL_GRAPH.graph_y = ds_map_try_get(_map[? "graph"], "graph_y");
// }
//} catch(e) {
// log_warning("LOAD, graph", exception_print(e));
//}
ds_queue_clear(CONNECTION_CONFLICT); ds_queue_clear(CONNECTION_CONFLICT);
try { try {

View file

@ -36,6 +36,7 @@ function Node_Array_Get(_x, _y, _group = noone) : Node(_x, _y, _group) construct
switch(_ovf) { switch(_ovf) {
case 0 : case 0 :
if(index < 0) index = _len + index;
index = clamp(index, 0, _len - 1); index = clamp(index, 0, _len - 1);
break; break;
case 1 : case 1 :

View file

@ -86,12 +86,8 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc
inspUpdateTooltip = get_text("panel_inspector_execute", "Execute node contents"); inspUpdateTooltip = get_text("panel_inspector_execute", "Execute node contents");
inspUpdateIcon = [ THEME.sequence_control, 1, COLORS._main_value_positive ]; inspUpdateIcon = [ THEME.sequence_control, 1, COLORS._main_value_positive ];
static inspectorUpdate = function() { static inspectorUpdate = function() { onInspectorUpdate(); }
onInspectorUpdate(); static onInspectorUpdate = function() { RenderListAction(nodes, group); }
}
static onInspectorUpdate = function() {
RenderListAction(nodes, group);
}
static hasInspectorUpdate = function(group = false) { static hasInspectorUpdate = function(group = false) {
if(!group) return false; if(!group) return false;

View file

@ -860,14 +860,18 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
var _in = inputs[| j]; var _in = inputs[| j];
if( _in.type == VALUE_TYPE.node) continue; if( _in.type == VALUE_TYPE.node) continue;
if(trigger) if(trigger) triggerRender();
triggerRender();
var val_from = _in.value_from; var val_from = _in.value_from;
if(val_from != noone && !val_from.node.rendered && val_from.node.active && val_from.node.renderActive) if( val_from == noone) continue;
_startNode = false; if(!val_from.node.active) continue;
if(!val_from.node.renderActive) continue;
if( val_from.node.rendered == noone) continue;
return false;
} }
return _startNode;
return true;
} }
static getNextNodes = function() { static getNextNodes = function() {

View file

@ -14,16 +14,13 @@ function Node_Palette_Extract(_x, _y, _group = noone) : Node(_x, _y, _group) con
.setDisplay(VALUE_DISPLAY.enum_scroll, [ "K-mean", "Frequency", "All colors" ]) .setDisplay(VALUE_DISPLAY.enum_scroll, [ "K-mean", "Frequency", "All colors" ])
.rejectArray(); .rejectArray();
inputs[| 4] = nodeValue("Animated surface", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false)
.rejectArray();
outputs[| 0] = nodeValue("Palette", self, JUNCTION_CONNECT.output, VALUE_TYPE.color, [ ]) outputs[| 0] = nodeValue("Palette", self, JUNCTION_CONNECT.output, VALUE_TYPE.color, [ ])
.setDisplay(VALUE_DISPLAY.palette); .setDisplay(VALUE_DISPLAY.palette);
static getPreviewValue = function() { return inputs[| 0]; } static getPreviewValue = function() { return inputs[| 0]; }
input_display_list = [ input_display_list = [
["Surface", true], 0, 4, ["Surface", true], 0,
["Palette", false], 3, 1, 2, ["Palette", false], 3, 1, 2,
] ]
@ -31,6 +28,7 @@ function Node_Palette_Extract(_x, _y, _group = noone) : Node(_x, _y, _group) con
current_color = 0; current_color = 0;
attribute_surface_depth(); attribute_surface_depth();
attribute_auto_execute(true);
function sortPalette(pal) { function sortPalette(pal) {
array_sort(pal, function(c0, c1) { array_sort(pal, function(c0, c1) {
@ -309,8 +307,8 @@ function Node_Palette_Extract(_x, _y, _group = noone) : Node(_x, _y, _group) con
static onValueFromUpdate = function() { extractPalettes(); } static onValueFromUpdate = function() { extractPalettes(); }
function update() { function update() {
var willUpdate = inputs[| 4].getValue(); if(attributes[? "auto_exe"])
if(willUpdate) extractPalettes(); extractPalettes();
} }
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {

View file

@ -676,4 +676,13 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor {
triggerRender(); triggerRender();
}, false)]); }, false)]);
} }
function attribute_auto_execute(label = false) {
attributes[? "auto_exe"] = false;
if(label) array_push(attributeEditors, "Node");
array_push(attributeEditors, ["Auto execute", "auto_exe",
new checkBox(function() {
attributes[? "auto_exe"] = !attributes[? "auto_exe"];
})]);
}
#endregion #endregion

View file

@ -1,11 +1,6 @@
enum NODE_SEP_SHAPE_OUTPUT_TYPE {
node,
array
}
function Node_Seperate_Shape(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { function Node_Seperate_Shape(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
name = "Separate Shape"; name = "Separate Shape";
error_update_enabled = true; //error_update_enabled = true;
inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0) inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0)
.rejectArray(); .rejectArray();
@ -25,9 +20,7 @@ function Node_Seperate_Shape(_x, _y, _group = noone) : Node(_x, _y, _group) cons
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
outputs[| 1] = nodeValue("Shape map", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); outputs[| 1] = nodeValue("Boundary data", self, JUNCTION_CONNECT.output, VALUE_TYPE.integer, []);
outputs[| 2] = nodeValue("Boundary data", self, JUNCTION_CONNECT.output, VALUE_TYPE.integer, []);
input_display_list = [ input_display_list = [
["Shape", false], 0, 1, 4, ["Shape", false], 0, 1, 4,
@ -35,6 +28,7 @@ function Node_Seperate_Shape(_x, _y, _group = noone) : Node(_x, _y, _group) cons
] ]
attribute_surface_depth(); attribute_surface_depth();
attribute_auto_execute(true);
temp_surface = [ surface_create(1, 1), surface_create(1, 1) ]; temp_surface = [ surface_create(1, 1), surface_create(1, 1) ];
surface_buffer = buffer_create(1 * 1 * 4, buffer_fixed, 2); surface_buffer = buffer_create(1 * 1 * 4, buffer_fixed, 2);
@ -53,7 +47,14 @@ function Node_Seperate_Shape(_x, _y, _group = noone) : Node(_x, _y, _group) cons
_prev_type = -1; _prev_type = -1;
static onInspectorUpdate = function() { static onInspectorUpdate = function() { separateShape(); }
static update = function() {
if(attributes[? "auto_exe"])
separateShape();
}
static separateShape = function() {
var _inSurf = inputs[| 0].getValue(); var _inSurf = inputs[| 0].getValue();
var _thres = inputs[| 1].getValue(); var _thres = inputs[| 1].getValue();
var _ovr = inputs[| 2].getValue(); var _ovr = inputs[| 2].getValue();
@ -182,6 +183,6 @@ function Node_Seperate_Shape(_x, _y, _group = noone) : Node(_x, _y, _group) cons
surface_reset_target(); surface_reset_target();
} }
outputs[| 2].setValue(_boundary,,, false); outputs[| 1].setValue(_boundary,,, false);
} }
} }

View file

@ -0,0 +1,39 @@
function Node_String_Regex_Search(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
name = "RegEx Search";
previewable = false;
w = 96;
inputs[| 0] = nodeValue("Text", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "")
.setVisible(true, true);
inputs[| 1] = nodeValue("Regex", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "");
outputs[| 0] = nodeValue("Results", self, JUNCTION_CONNECT.output, VALUE_TYPE.text, "");
input_display_list = [
["Text", false], 0,
["RegEx", false], 1,
];
function step() {
var mode = inputs[| 4].getValue();
}
function process_data(_output, _data, _index = 0) {
var str = _data[0];
return str;
}
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
var str = outputs[| 0].getValue();
if(is_array(str) && array_length(str))
str = str[0];
draw_set_text(f_h5, fa_center, fa_center, COLORS._main_text);
var bbox = drawGetBbox(xx, yy, _s);
var ss = string_scale(str, bbox.w, bbox.h);
draw_text_transformed(bbox.xc, bbox.yc, str, ss, ss, 0);
}
}

View file

@ -0,0 +1,11 @@
{
"resourceType": "GMScript",
"resourceVersion": "1.0",
"name": "node_string_regex_search",
"isCompatibility": false,
"isDnD": false,
"parent": {
"name": "texts",
"path": "folders/nodes/data/value/texts.yy",
},
}

View file

@ -143,6 +143,8 @@ function Panel_Collection() : PanelContent() constructor {
var yy = _y + grid_space; var yy = _y + grid_space;
var name_height = 0; var name_height = 0;
grid_width = (contentPane.surface_w - grid_space) / col - grid_space;
hh += grid_space; hh += grid_space;
for(var i = 0; i < row; i++) { for(var i = 0; i < row; i++) {

View file

@ -88,6 +88,8 @@ function Panel_Graph() : PanelContent() constructor {
connection_aa = 2; connection_aa = 2;
connection_surface = surface_create(1, 1); connection_surface = surface_create(1, 1);
toolbar_height = ui(40);
function toCenterNode() { function toCenterNode() {
if(ds_list_empty(nodes_list)) { if(ds_list_empty(nodes_list)) {
graph_x = round(w / 2 / graph_s); graph_x = round(w / 2 / graph_s);
@ -121,7 +123,6 @@ function Panel_Graph() : PanelContent() constructor {
function initSize() { toCenterNode(); } function initSize() { toCenterNode(); }
initSize(); initSize();
toolbar_height = ui(40);
toolbars = [ toolbars = [
[ [
THEME.icon_center_canvas, THEME.icon_center_canvas,

View file

@ -320,7 +320,7 @@ function Panel_Inspector() : PanelContent() constructor {
switch(instanceof(edt[2])) { switch(instanceof(edt[2])) {
case "textBox" : edt[2].draw(wx0, yy, ww, hg, val, _m); break; case "textBox" : edt[2].draw(wx0, yy, ww, hg, val, _m); break;
case "checkBox" : edt[2].draw(wx0 + ww / 2 - hg / 2, yy - hg / 2, val, _m, hg); break; case "checkBox" : edt[2].draw(wx0 + ww / 2 - ui(28) / 2, yy + ui(2), val, _m, ui(28)); break;
case "scrollBox" : edt[2].draw(wx0, yy, ww, hg, edt[2].data_list[val], _m, x + contentPane.x, y + contentPane.y); break; case "scrollBox" : edt[2].draw(wx0, yy, ww, hg, edt[2].data_list[val], _m, x + contentPane.x, y + contentPane.y); break;
} }

View file

@ -23,7 +23,7 @@ function paths_to_array(paths, recur = false, _filter = "") {
var file_full = curr_path + "/" + file; var file_full = curr_path + "/" + file;
if(directory_exists(file_full) && recur) { if(directory_exists(file_full) && recur) {
ds_stack_push(st, file_full); ds_stack_push(st, file_full);
} else if(path_is_image(file_full) && regx.eval(file_full)) { } else if(path_is_image(file_full) && regx.isMatch(file_full)) {
array_push(_paths, file_full); array_push(_paths, file_full);
} }
@ -32,8 +32,6 @@ function paths_to_array(paths, recur = false, _filter = "") {
file_find_close(); file_find_close();
} }
regx.free();
delete regx;
ds_stack_destroy(st); ds_stack_destroy(st);
} else if(file_exists(paths)) } else if(file_exists(paths))
array_push(_paths, paths); array_push(_paths, paths);

View file

@ -0,0 +1,55 @@
function regex_node(val, accept = false) constructor {
self.val = val;
self.accept = accept;
states = {};
static setNext = function(key, node) {
states[$ key] = node;
}
static consume = function(key) {
return struct_has(states, key)? states[$ key] : self;
}
}
function regex_tree(regx) constructor {
static delim = ["*", "(", ")", "|", "+", "?", "[", "]", "{", "}", "^", "-"];
self.regx = regx;
nodes = [];
var prev = noone;
var delm = "";
var len = string_length(regx);
for( var i = 1; i <= len; i++ ) {
var _chr = string_char_at(regx, i);
if(array_exists(_chr, delim)) {
if(prev != noone)
switch(_chr) {
case "*" : prev.setNext(_chr, prev); break;
}
} else {
var node = new regex_node(_chr, i == len);
if(prev != noone)
prev.setNext(_chr, node);
prev = node;
array_push(nodes, node);
}
}
static isMatch = function(str) {
if(array_length(nodes) == 0) return true;
var pntr = nodes[0];
var len = string_length(str);
for( var i = 1; i <= len; i++ ) {
var _chr = string_char_at(str, i);
pntr = pntr.consume(_chr);
}
return pntr.accept;
}
}

View file

@ -1,11 +1,11 @@
{ {
"resourceType": "GMScript", "resourceType": "GMScript",
"resourceVersion": "1.0", "resourceVersion": "1.0",
"name": "regex", "name": "pseudo_regex",
"isCompatibility": false, "isCompatibility": false,
"isDnD": false, "isDnD": false,
"parent": { "parent": {
"name": "regex", "name": "string",
"path": "folders/functions/regex.yy", "path": "folders/functions/string.yy",
}, },
} }

View file

@ -1,63 +0,0 @@
function regex_node(val, accept = false) constructor {
self.val = val;
self.accept = accept;
states = ds_map_create();
static free = function() {
ds_map_destroy(states);
}
static setNext = function(key, node) {
states[? key] = node;
}
static consume = function(key) {
if(ds_map_exists(states, key)) return states[? key];
if(ds_map_exists(states, "*")) return states[? "*"];
return self;
}
}
function regex_tree(regx) constructor {
self.regx = regx;
graph = ds_list_create();
var prev = noone;
var len = string_length(regx);
for( var i = 1; i <= len; i++ ) {
var _chr = string_char_at(regx, i);
var node = new regex_node(_chr, i == len);
if(_chr == "*") {
} else {
}
if(i > 1) prev.setNext(_chr, node);
prev = node;
ds_list_add(graph, node);
}
static eval = function(str) {
if(ds_list_empty(graph)) return true;
var pntr = graph[| 0];
var len = string_length(str);
for( var i = 1; i <= len; i++ ) {
var _chr = string_char_at(str, i);
pntr = pntr.consume(_chr);
}
return pntr.accept;
}
static free = function() {
for( var i = 0; i < ds_list_size( graph ); i++ ) {
graph[| i].free();
}
ds_list_destroy(graph);
}
}

View file

@ -4,7 +4,7 @@ enum RENDER_TYPE {
full = 2 full = 2
} }
global.RENDER_LOG = false; global.RENDER_LOG = true;
global.group_inputs = [ "Node_Group_Input", "Node_Feedback_Input", "Node_Iterator_Input", "Node_Iterator_Each_Input" ]; global.group_inputs = [ "Node_Group_Input", "Node_Feedback_Input", "Node_Iterator_Input", "Node_Iterator_Each_Input" ];
function __nodeLeafList(_list, _queue) { function __nodeLeafList(_list, _queue) {
@ -25,6 +25,7 @@ function __nodeIsLoop(_node) {
switch(instanceof(_node)) { switch(instanceof(_node)) {
case "Node_Iterate" : case "Node_Iterate" :
case "Node_Iterate_Each" : case "Node_Iterate_Each" :
case "Node_Iterate_Filter" :
case "Node_Feedback" : case "Node_Feedback" :
return true; return true;
} }
@ -107,17 +108,19 @@ function Render(partial = false, runAction = false) {
function __renderListReset(list) { function __renderListReset(list) {
for( var i = 0; i < ds_list_size(list); i++ ) { for( var i = 0; i < ds_list_size(list); i++ ) {
list[| i].setRenderStatus(false); list[| i].setRenderStatus(false);
if(struct_has(list[| i], "nodes")) if(struct_has(list[| i], "nodes"))
__renderListReset(list[| i].nodes); __renderListReset(list[| i].nodes);
} }
} }
function RenderListAction(list, context = PANEL_GRAPH.getCurrentContext()) { function RenderListAction(list, context = PANEL_GRAPH.getCurrentContext()) {
printIf(global.RENDER_LOG, "=== RENDER LIST ACTION START [frame " + string(ANIMATOR.current_frame) + "] ===");
try { try {
var rendering = noone; var rendering = noone;
var error = 0; var error = 0;
var t = current_time; var t = current_time;
printIf(global.RENDER_LOG, "=== RENDER ACTION START [frame " + string(ANIMATOR.current_frame) + "] ===");
__renderListReset(list); __renderListReset(list);
@ -132,10 +135,8 @@ function RenderListAction(list, context = PANEL_GRAPH.getCurrentContext()) {
if(!_node.active) continue; if(!_node.active) continue;
if(!_node.renderActive) continue; if(!_node.renderActive) continue;
if(_node.rendered) continue; if(_node.rendered) continue;
if(__nodeInLoop(_node)) continue;
var _startNode = _node.isRenderable(); if(_node.isRenderable()) {
if(_startNode) {
ds_queue_enqueue(RENDER_QUEUE, _node); ds_queue_enqueue(RENDER_QUEUE, _node);
printIf(global.RENDER_LOG, " > Push " + _node.name + " (" + _node.display_name + ") node to stack"); printIf(global.RENDER_LOG, " > Push " + _node.name + " (" + _node.display_name + ") node to stack");
} }
@ -149,8 +150,10 @@ function RenderListAction(list, context = PANEL_GRAPH.getCurrentContext()) {
var txt = rendering.rendered? " [Skip]" : " [Update]"; var txt = rendering.rendered? " [Skip]" : " [Update]";
if(!rendering.rendered) { if(!rendering.rendered) {
rendering.doUpdate(); rendering.doUpdate();
if(rendering.hasInspectorUpdate()) if(rendering.hasInspectorUpdate()) {
rendering.inspectorUpdate(); rendering.inspectorUpdate();
printIf(global.RENDER_LOG, " > Toggle manual execution " + rendering.name + " (" + rendering.display_name + ")");
}
rendering.setRenderStatus(true); rendering.setRenderStatus(true);
rendering.getNextNodes(); rendering.getNextNodes();

View file

@ -44,11 +44,6 @@ function save_serialize() {
_anim_map[? "framerate"] = ANIMATOR.framerate; _anim_map[? "framerate"] = ANIMATOR.framerate;
ds_map_add_map(_map, "animator", _anim_map); ds_map_add_map(_map, "animator", _anim_map);
var _graph_map = ds_map_create();
_graph_map[? "graph_x"] = PANEL_GRAPH.graph_x;
_graph_map[? "graph_y"] = PANEL_GRAPH.graph_y;
ds_map_add_map(_map, "graph", _graph_map);
ds_map_add_map(_map, "metadata", METADATA.serialize()); ds_map_add_map(_map, "metadata", METADATA.serialize());
ds_map_add_map(_map, "global", GLOBAL.serialize()); ds_map_add_map(_map, "global", GLOBAL.serialize());