From 02a5b3bd0facb34a7a2bed21902c3afcbe1389a0 Mon Sep 17 00:00:00 2001 From: Tanasart <22589759+Ttanasart-pt@users.noreply.github.com> Date: Fri, 24 Mar 2023 11:55:34 +0700 Subject: [PATCH] Add auto execute separate shape --- PixelComposer.resource_order | 13 ++-- PixelComposer.yyp | 4 +- objects/o_dialog_add_node/Create_0.gml | 3 + scripts/globals/globals.gml | 2 +- scripts/load_function/load_function.gml | 9 --- scripts/node_array_get/node_array_get.gml | 1 + scripts/node_collection/node_collection.gml | 8 +-- scripts/node_data/node_data.gml | 24 ++++--- .../node_palette_extract.gml | 10 ++- scripts/node_registry/node_registry.gml | 9 +++ .../node_seperate_shapes.gml | 23 +++---- .../node_string_regex_search.gml | 39 ++++++++++++ .../node_string_regex_search.yy | 11 ++++ scripts/panel_collection/panel_collection.gml | 2 + scripts/panel_graph/panel_graph.gml | 3 +- scripts/panel_inspector/panel_inspector.gml | 2 +- scripts/path_reader/path_reader.gml | 4 +- scripts/pseudo_regex/pseudo_regex.gml | 55 ++++++++++++++++ .../regex.yy => pseudo_regex/pseudo_regex.yy} | 6 +- scripts/regex/regex.gml | 63 ------------------- scripts/render_data/render_data.gml | 27 ++++---- scripts/save_function/save_function.gml | 5 -- 22 files changed, 184 insertions(+), 139 deletions(-) create mode 100644 scripts/node_string_regex_search/node_string_regex_search.gml create mode 100644 scripts/node_string_regex_search/node_string_regex_search.yy create mode 100644 scripts/pseudo_regex/pseudo_regex.gml rename scripts/{regex/regex.yy => pseudo_regex/pseudo_regex.yy} (58%) delete mode 100644 scripts/regex/regex.gml diff --git a/PixelComposer.resource_order b/PixelComposer.resource_order index 0aca12880..a00175057 100644 --- a/PixelComposer.resource_order +++ b/PixelComposer.resource_order @@ -47,7 +47,6 @@ {"name":"lua","order":24,"path":"folders/functions/lua.yy",}, {"name":"packing","order":32,"path":"folders/functions/packing.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":"string","order":4,"path":"folders/functions/string.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":"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":"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_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",}, @@ -445,7 +444,7 @@ {"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":"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":"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",}, @@ -735,7 +734,7 @@ {"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_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":"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",}, @@ -884,6 +883,7 @@ {"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":"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":"__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",}, @@ -891,7 +891,7 @@ {"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":"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":"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",}, @@ -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_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":"pseudo_regex","order":7,"path":"scripts/pseudo_regex/pseudo_regex.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":"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":"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":"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":"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",}, diff --git a/PixelComposer.yyp b/PixelComposer.yyp index 4ccf6a5ee..9e204efeb 100644 --- a/PixelComposer.yyp +++ b/PixelComposer.yyp @@ -65,7 +65,6 @@ {"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":"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":"string","folderPath":"folders/functions/string.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":"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":"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":"__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",},}, @@ -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_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":"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":"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",},}, diff --git a/objects/o_dialog_add_node/Create_0.gml b/objects/o_dialog_add_node/Create_0.gml index fd5d466cc..680973967 100644 --- a/objects/o_dialog_add_node/Create_0.gml +++ b/objects/o_dialog_add_node/Create_0.gml @@ -288,6 +288,8 @@ event_inherited(); var cProg = 0; hh += grid_space; + grid_width = (content_pane.surface_w - grid_space) / col - grid_space; + for(var index = 0; index < node_count; index++) { var _node = _list[| index]; if(is_string(_node)) { @@ -565,6 +567,7 @@ event_inherited(); var index = 0; var name_height = 0; + grid_width = (search_pane.surface_w - grid_space) / col - grid_space; hh += (grid_space + grid_size) * 2; for(var i = 0; i < amo; i++) { diff --git a/scripts/globals/globals.gml b/scripts/globals/globals.gml index ee1ddea6f..f0be400a7 100644 --- a/scripts/globals/globals.gml +++ b/scripts/globals/globals.gml @@ -33,7 +33,7 @@ globalvar VERSION, SAVEFILE_VERSION, VERSION_STRING; VERSION = 1140; SAVEFILE_VERSION = 1400; - VERSION_STRING = "1.14.0pr3"; + VERSION_STRING = "1.14.0pr4"; globalvar NODES, NODE_MAP, APPEND_MAP, HOTKEYS, HOTKEY_CONTEXT, NODE_INSTANCES; diff --git a/scripts/load_function/load_function.gml b/scripts/load_function/load_function.gml index 6ec1b8ffa..943c02ca6 100644 --- a/scripts/load_function/load_function.gml +++ b/scripts/load_function/load_function.gml @@ -116,15 +116,6 @@ function __LOAD_PATH(path, readonly = false, safe_mode = false) { 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); try { diff --git a/scripts/node_array_get/node_array_get.gml b/scripts/node_array_get/node_array_get.gml index 6a9df4249..a0c84ee74 100644 --- a/scripts/node_array_get/node_array_get.gml +++ b/scripts/node_array_get/node_array_get.gml @@ -36,6 +36,7 @@ function Node_Array_Get(_x, _y, _group = noone) : Node(_x, _y, _group) construct switch(_ovf) { case 0 : + if(index < 0) index = _len + index; index = clamp(index, 0, _len - 1); break; case 1 : diff --git a/scripts/node_collection/node_collection.gml b/scripts/node_collection/node_collection.gml index 20dc37e65..694d472e0 100644 --- a/scripts/node_collection/node_collection.gml +++ b/scripts/node_collection/node_collection.gml @@ -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"); inspUpdateIcon = [ THEME.sequence_control, 1, COLORS._main_value_positive ]; - static inspectorUpdate = function() { - onInspectorUpdate(); - } - static onInspectorUpdate = function() { - RenderListAction(nodes, group); - } + static inspectorUpdate = function() { onInspectorUpdate(); } + static onInspectorUpdate = function() { RenderListAction(nodes, group); } static hasInspectorUpdate = function(group = false) { if(!group) return false; diff --git a/scripts/node_data/node_data.gml b/scripts/node_data/node_data.gml index aa83e0a75..e1a0bcfd6 100644 --- a/scripts/node_data/node_data.gml +++ b/scripts/node_data/node_data.gml @@ -82,10 +82,10 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x value_validation = array_create(3); - error_noti_update = noone; + error_noti_update = noone; error_update_enabled = false; - manual_updated = false; - manual_deletable = true; + manual_updated = false; + manual_deletable = true; tool_settings = []; tool_attribute = {}; @@ -852,22 +852,26 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x static onDestroy = function() {} static isRenderable = function(trigger = false) { - if(!active) return false; + if(!active) return false; if(!renderActive) return false; var _startNode = true; for(var j = 0; j < ds_list_size(inputs); j++) { var _in = inputs[| j]; - if(_in.type == VALUE_TYPE.node) continue; + if( _in.type == VALUE_TYPE.node) continue; - if(trigger) - triggerRender(); + if(trigger) triggerRender(); var val_from = _in.value_from; - if(val_from != noone && !val_from.node.rendered && val_from.node.active && val_from.node.renderActive) - _startNode = false; + if( val_from == noone) continue; + 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() { diff --git a/scripts/node_palette_extract/node_palette_extract.gml b/scripts/node_palette_extract/node_palette_extract.gml index 8f5e9b2ef..49e20c35e 100644 --- a/scripts/node_palette_extract/node_palette_extract.gml +++ b/scripts/node_palette_extract/node_palette_extract.gml @@ -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" ]) .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, [ ]) .setDisplay(VALUE_DISPLAY.palette); static getPreviewValue = function() { return inputs[| 0]; } input_display_list = [ - ["Surface", true], 0, 4, + ["Surface", true], 0, ["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; attribute_surface_depth(); + attribute_auto_execute(true); function sortPalette(pal) { 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(); } function update() { - var willUpdate = inputs[| 4].getValue(); - if(willUpdate) extractPalettes(); + if(attributes[? "auto_exe"]) + extractPalettes(); } static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { diff --git a/scripts/node_registry/node_registry.gml b/scripts/node_registry/node_registry.gml index 40887c7b5..f7d7fb5ff 100644 --- a/scripts/node_registry/node_registry.gml +++ b/scripts/node_registry/node_registry.gml @@ -676,4 +676,13 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor { triggerRender(); }, 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 \ No newline at end of file diff --git a/scripts/node_seperate_shapes/node_seperate_shapes.gml b/scripts/node_seperate_shapes/node_seperate_shapes.gml index 90269ae2b..b3a0528bc 100644 --- a/scripts/node_seperate_shapes/node_seperate_shapes.gml +++ b/scripts/node_seperate_shapes/node_seperate_shapes.gml @@ -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 { name = "Separate Shape"; - error_update_enabled = true; + //error_update_enabled = true; inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0) .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[| 1] = nodeValue("Shape map", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); - - outputs[| 2] = nodeValue("Boundary data", self, JUNCTION_CONNECT.output, VALUE_TYPE.integer, []); + outputs[| 1] = nodeValue("Boundary data", self, JUNCTION_CONNECT.output, VALUE_TYPE.integer, []); input_display_list = [ ["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_auto_execute(true); temp_surface = [ surface_create(1, 1), surface_create(1, 1) ]; 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; - static onInspectorUpdate = function() { + static onInspectorUpdate = function() { separateShape(); } + + static update = function() { + if(attributes[? "auto_exe"]) + separateShape(); + } + + static separateShape = function() { var _inSurf = inputs[| 0].getValue(); var _thres = inputs[| 1].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(); } - outputs[| 2].setValue(_boundary,,, false); + outputs[| 1].setValue(_boundary,,, false); } } \ No newline at end of file diff --git a/scripts/node_string_regex_search/node_string_regex_search.gml b/scripts/node_string_regex_search/node_string_regex_search.gml new file mode 100644 index 000000000..b465b85cc --- /dev/null +++ b/scripts/node_string_regex_search/node_string_regex_search.gml @@ -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); + } +} \ No newline at end of file diff --git a/scripts/node_string_regex_search/node_string_regex_search.yy b/scripts/node_string_regex_search/node_string_regex_search.yy new file mode 100644 index 000000000..0405347c7 --- /dev/null +++ b/scripts/node_string_regex_search/node_string_regex_search.yy @@ -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", + }, +} \ No newline at end of file diff --git a/scripts/panel_collection/panel_collection.gml b/scripts/panel_collection/panel_collection.gml index 4660df065..c05386c1c 100644 --- a/scripts/panel_collection/panel_collection.gml +++ b/scripts/panel_collection/panel_collection.gml @@ -143,6 +143,8 @@ function Panel_Collection() : PanelContent() constructor { var yy = _y + grid_space; var name_height = 0; + grid_width = (contentPane.surface_w - grid_space) / col - grid_space; + hh += grid_space; for(var i = 0; i < row; i++) { diff --git a/scripts/panel_graph/panel_graph.gml b/scripts/panel_graph/panel_graph.gml index 69c529c78..c7e38c538 100644 --- a/scripts/panel_graph/panel_graph.gml +++ b/scripts/panel_graph/panel_graph.gml @@ -88,6 +88,8 @@ function Panel_Graph() : PanelContent() constructor { connection_aa = 2; connection_surface = surface_create(1, 1); + toolbar_height = ui(40); + function toCenterNode() { if(ds_list_empty(nodes_list)) { graph_x = round(w / 2 / graph_s); @@ -121,7 +123,6 @@ function Panel_Graph() : PanelContent() constructor { function initSize() { toCenterNode(); } initSize(); - toolbar_height = ui(40); toolbars = [ [ THEME.icon_center_canvas, diff --git a/scripts/panel_inspector/panel_inspector.gml b/scripts/panel_inspector/panel_inspector.gml index bf63c451d..2728469d5 100644 --- a/scripts/panel_inspector/panel_inspector.gml +++ b/scripts/panel_inspector/panel_inspector.gml @@ -320,7 +320,7 @@ function Panel_Inspector() : PanelContent() constructor { switch(instanceof(edt[2])) { 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; } diff --git a/scripts/path_reader/path_reader.gml b/scripts/path_reader/path_reader.gml index 422fbd39b..ceaf101b8 100644 --- a/scripts/path_reader/path_reader.gml +++ b/scripts/path_reader/path_reader.gml @@ -23,7 +23,7 @@ function paths_to_array(paths, recur = false, _filter = "") { var file_full = curr_path + "/" + file; if(directory_exists(file_full) && recur) { 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); } @@ -32,8 +32,6 @@ function paths_to_array(paths, recur = false, _filter = "") { file_find_close(); } - regx.free(); - delete regx; ds_stack_destroy(st); } else if(file_exists(paths)) array_push(_paths, paths); diff --git a/scripts/pseudo_regex/pseudo_regex.gml b/scripts/pseudo_regex/pseudo_regex.gml new file mode 100644 index 000000000..d8ff2cfd3 --- /dev/null +++ b/scripts/pseudo_regex/pseudo_regex.gml @@ -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; + } +} \ No newline at end of file diff --git a/scripts/regex/regex.yy b/scripts/pseudo_regex/pseudo_regex.yy similarity index 58% rename from scripts/regex/regex.yy rename to scripts/pseudo_regex/pseudo_regex.yy index 1f30b040b..30660417f 100644 --- a/scripts/regex/regex.yy +++ b/scripts/pseudo_regex/pseudo_regex.yy @@ -1,11 +1,11 @@ { "resourceType": "GMScript", "resourceVersion": "1.0", - "name": "regex", + "name": "pseudo_regex", "isCompatibility": false, "isDnD": false, "parent": { - "name": "regex", - "path": "folders/functions/regex.yy", + "name": "string", + "path": "folders/functions/string.yy", }, } \ No newline at end of file diff --git a/scripts/regex/regex.gml b/scripts/regex/regex.gml deleted file mode 100644 index a7f9379aa..000000000 --- a/scripts/regex/regex.gml +++ /dev/null @@ -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); - } -} \ No newline at end of file diff --git a/scripts/render_data/render_data.gml b/scripts/render_data/render_data.gml index 6082db5d4..2b37614ed 100644 --- a/scripts/render_data/render_data.gml +++ b/scripts/render_data/render_data.gml @@ -4,7 +4,7 @@ enum RENDER_TYPE { 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" ]; function __nodeLeafList(_list, _queue) { @@ -25,7 +25,8 @@ function __nodeIsLoop(_node) { switch(instanceof(_node)) { case "Node_Iterate" : case "Node_Iterate_Each" : - case "Node_Feedback" : + case "Node_Iterate_Filter" : + case "Node_Feedback" : return true; } return false; @@ -107,17 +108,19 @@ function Render(partial = false, runAction = false) { function __renderListReset(list) { for( var i = 0; i < ds_list_size(list); i++ ) { list[| i].setRenderStatus(false); + if(struct_has(list[| i], "nodes")) __renderListReset(list[| i].nodes); } } function RenderListAction(list, context = PANEL_GRAPH.getCurrentContext()) { + printIf(global.RENDER_LOG, "=== RENDER LIST ACTION START [frame " + string(ANIMATOR.current_frame) + "] ==="); + try { var rendering = noone; - var error = 0; - var t = current_time; - printIf(global.RENDER_LOG, "=== RENDER ACTION START [frame " + string(ANIMATOR.current_frame) + "] ==="); + var error = 0; + var t = current_time; __renderListReset(list); @@ -127,15 +130,13 @@ function RenderListAction(list, context = PANEL_GRAPH.getCurrentContext()) { var _node = list[| i]; if(is_undefined(_node)) continue; - if(!is_struct(_node)) continue; + if(!is_struct(_node)) continue; - if(!_node.active) continue; + if(!_node.active) continue; if(!_node.renderActive) continue; - if(_node.rendered) continue; - if(__nodeInLoop(_node)) continue; + if(_node.rendered) continue; - var _startNode = _node.isRenderable(); - if(_startNode) { + if(_node.isRenderable()) { ds_queue_enqueue(RENDER_QUEUE, _node); 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]"; if(!rendering.rendered) { rendering.doUpdate(); - if(rendering.hasInspectorUpdate()) + if(rendering.hasInspectorUpdate()) { rendering.inspectorUpdate(); + printIf(global.RENDER_LOG, " > Toggle manual execution " + rendering.name + " (" + rendering.display_name + ")"); + } rendering.setRenderStatus(true); rendering.getNextNodes(); diff --git a/scripts/save_function/save_function.gml b/scripts/save_function/save_function.gml index be63f8b5a..f62a70673 100644 --- a/scripts/save_function/save_function.gml +++ b/scripts/save_function/save_function.gml @@ -44,11 +44,6 @@ function save_serialize() { _anim_map[? "framerate"] = ANIMATOR.framerate; 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, "global", GLOBAL.serialize());