From 0a00b01bf5885e17075f8a49531a60874cf433f2 Mon Sep 17 00:00:00 2001 From: Tanasart Date: Tue, 19 Dec 2023 20:30:34 +0700 Subject: [PATCH] inline loop --- 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_dialog_add_node/Create_0.gml | 2 +- objects/o_dialog_menubox/Draw_64.gml | 1 + scripts/__VFX/__VFX.gml | 4 +- .../__node_iterator_inline.gml | 80 ++++ .../__node_iterator_inline.yy | 11 + .../_node_fluid_nodes/_node_fluid_nodes.gml | 4 +- .../contextMenu_controller.gml | 7 +- scripts/draw_corner/draw_corner.gml | 49 +- scripts/draw_line_curve/draw_line_curve.gml | 8 +- scripts/draw_line_elbow/draw_line_elbow.gml | 12 +- .../draw_line_elbow_diag.gml | 83 ++-- .../node_VFX_effector/node_VFX_effector.gml | 6 +- scripts/node_VFX_spawner/node_VFX_spawner.gml | 18 +- .../node_ase_file_read/node_ase_file_read.gml | 8 +- scripts/node_blend/node_blend.gml | 89 ++-- scripts/node_collection/node_collection.gml | 6 +- .../node_collection_inline.gml | 113 +++-- .../node_connection_path.gml | 76 ++++ .../node_connection_path.yy | 11 + scripts/node_data/node_data.gml | 41 +- .../node_dynamic_surface.gml | 4 +- .../node_feedback_inline.gml | 84 ++++ .../node_feedback_inline.yy | 11 + .../node_feedback_input.gml | 8 +- scripts/node_gradient/node_gradient.gml | 2 +- .../node_gradient_output.gml | 2 +- scripts/node_group_input/node_group_input.gml | 8 +- .../node_group_output/node_group_output.gml | 10 +- .../node_iterate_inline.gml | 105 +++++ .../node_iterate_inline.yy | 11 + .../node_iterator_index.gml | 19 +- .../node_iterator_length.gml | 20 +- scripts/node_lua_compute/node_lua_compute.gml | 8 +- scripts/node_lua_global/node_lua_global.gml | 4 +- scripts/node_lua_surface/node_lua_surface.gml | 8 +- scripts/node_registry/node_registry.gml | 13 +- .../node_rigid_object/node_rigid_object.gml | 24 +- .../node_rigid_render/node_rigid_render.gml | 18 +- .../node_rigid_render_output.gml | 11 +- scripts/node_value/node_value.gml | 423 +++++++++--------- scripts/panel_graph/panel_graph.gml | 115 ++++- scripts/render_data/render_data.gml | 2 + 48 files changed, 1075 insertions(+), 472 deletions(-) create mode 100644 scripts/__node_iterator_inline/__node_iterator_inline.gml create mode 100644 scripts/__node_iterator_inline/__node_iterator_inline.yy create mode 100644 scripts/node_connection_path/node_connection_path.gml create mode 100644 scripts/node_connection_path/node_connection_path.yy create mode 100644 scripts/node_feedback_inline/node_feedback_inline.gml create mode 100644 scripts/node_feedback_inline/node_feedback_inline.yy create mode 100644 scripts/node_iterate_inline/node_iterate_inline.gml create mode 100644 scripts/node_iterate_inline/node_iterate_inline.yy diff --git a/PixelComposer.resource_order b/PixelComposer.resource_order index 1b4e8ebaa..14fcd62bd 100644 --- a/PixelComposer.resource_order +++ b/PixelComposer.resource_order @@ -265,6 +265,7 @@ {"name":"__node_3d","order":2,"path":"scripts/__node_3d/__node_3d.yy",}, {"name":"node_csv_file_write","order":12,"path":"scripts/node_csv_file_write/node_csv_file_write.yy",}, {"name":"surface_functions","order":5,"path":"scripts/surface_functions/surface_functions.yy",}, + {"name":"__node_iterator_inline","order":8,"path":"scripts/__node_iterator_inline/__node_iterator_inline.yy",}, {"name":"s_MKFX","order":6,"path":"sprites/s_MKFX/s_MKFX.yy",}, {"name":"_f_sdf","order":13,"path":"fonts/_f_sdf/_f_sdf.yy",}, {"name":"dynaSurf_iso","order":1,"path":"scripts/dynaSurf_iso/dynaSurf_iso.yy",}, @@ -725,6 +726,7 @@ {"name":"s_node_path_wave","order":7,"path":"sprites/s_node_path_wave/s_node_path_wave.yy",}, {"name":"string_functions","order":6,"path":"scripts/string_functions/string_functions.yy",}, {"name":"o_dialog_palette","order":2,"path":"objects/o_dialog_palette/o_dialog_palette.yy",}, + {"name":"node_connection_path","order":1,"path":"scripts/node_connection_path/node_connection_path.yy",}, {"name":"sh_mk_tile55_edge_b","order":5,"path":"shaders/sh_mk_tile55_edge_b/sh_mk_tile55_edge_b.yy",}, {"name":"sh_blend_hue","order":17,"path":"shaders/sh_blend_hue/sh_blend_hue.yy",}, {"name":"s_node_threshold","order":47,"path":"sprites/s_node_threshold/s_node_threshold.yy",}, @@ -1499,6 +1501,7 @@ {"name":"s_node_shape_polygon","order":25,"path":"sprites/s_node_shape_polygon/s_node_shape_polygon.yy",}, {"name":"s_node_pb_fx_interesct","order":6,"path":"sprites/s_node_pb_fx_interesct/s_node_pb_fx_interesct.yy",}, {"name":"node_path_sample","order":4,"path":"scripts/node_path_sample/node_path_sample.yy",}, + {"name":"node_iterate_inline","order":3,"path":"scripts/node_iterate_inline/node_iterate_inline.yy",}, {"name":"sh_3d_depth","order":6,"path":"shaders/sh_3d_depth/sh_3d_depth.yy",}, {"name":"__node_3d_displace","order":1,"path":"scripts/__node_3d_displace/__node_3d_displace.yy",}, {"name":"node_vector_dot","order":9,"path":"scripts/node_vector_dot/node_vector_dot.yy",}, @@ -1713,6 +1716,7 @@ {"name":"fd_rectangle_get_velocity_dissipation_type","order":20,"path":"scripts/fd_rectangle_get_velocity_dissipation_type/fd_rectangle_get_velocity_dissipation_type.yy",}, {"name":"s_node_3d_transform","order":4,"path":"sprites/s_node_3d_transform/s_node_3d_transform.yy",}, {"name":"node_pb_box_split","order":2,"path":"scripts/node_pb_box_split/node_pb_box_split.yy",}, + {"name":"node_feedback_inline","order":3,"path":"scripts/node_feedback_inline/node_feedback_inline.yy",}, {"name":"s_node_output","order":7,"path":"sprites/s_node_output/s_node_output.yy",}, {"name":"sh_atlas","order":26,"path":"shaders/sh_atlas/sh_atlas.yy",}, {"name":"__node_3d_extrude","order":3,"path":"scripts/__node_3d_extrude/__node_3d_extrude.yy",}, diff --git a/PixelComposer.yyp b/PixelComposer.yyp index e34d41b9e..72973824f 100644 --- a/PixelComposer.yyp +++ b/PixelComposer.yyp @@ -458,6 +458,7 @@ {"id":{"name":"__node_3d","path":"scripts/__node_3d/__node_3d.yy",},}, {"id":{"name":"node_csv_file_write","path":"scripts/node_csv_file_write/node_csv_file_write.yy",},}, {"id":{"name":"surface_functions","path":"scripts/surface_functions/surface_functions.yy",},}, + {"id":{"name":"__node_iterator_inline","path":"scripts/__node_iterator_inline/__node_iterator_inline.yy",},}, {"id":{"name":"s_MKFX","path":"sprites/s_MKFX/s_MKFX.yy",},}, {"id":{"name":"_f_sdf","path":"fonts/_f_sdf/_f_sdf.yy",},}, {"id":{"name":"dynaSurf_iso","path":"scripts/dynaSurf_iso/dynaSurf_iso.yy",},}, @@ -983,6 +984,7 @@ {"id":{"name":"s_node_path_wave","path":"sprites/s_node_path_wave/s_node_path_wave.yy",},}, {"id":{"name":"string_functions","path":"scripts/string_functions/string_functions.yy",},}, {"id":{"name":"o_dialog_palette","path":"objects/o_dialog_palette/o_dialog_palette.yy",},}, + {"id":{"name":"node_connection_path","path":"scripts/node_connection_path/node_connection_path.yy",},}, {"id":{"name":"sh_mk_tile55_edge_b","path":"shaders/sh_mk_tile55_edge_b/sh_mk_tile55_edge_b.yy",},}, {"id":{"name":"sh_blend_hue","path":"shaders/sh_blend_hue/sh_blend_hue.yy",},}, {"id":{"name":"_f_p0","path":"fonts/_f_p0/_f_p0.yy",},}, @@ -1867,6 +1869,7 @@ {"id":{"name":"sh_color_picker_hue","path":"shaders/sh_color_picker_hue/sh_color_picker_hue.yy",},}, {"id":{"name":"s_node_pb_fx_interesct","path":"sprites/s_node_pb_fx_interesct/s_node_pb_fx_interesct.yy",},}, {"id":{"name":"node_path_sample","path":"scripts/node_path_sample/node_path_sample.yy",},}, + {"id":{"name":"node_iterate_inline","path":"scripts/node_iterate_inline/node_iterate_inline.yy",},}, {"id":{"name":"sh_3d_depth","path":"shaders/sh_3d_depth/sh_3d_depth.yy",},}, {"id":{"name":"__node_3d_displace","path":"scripts/__node_3d_displace/__node_3d_displace.yy",},}, {"id":{"name":"node_vector_dot","path":"scripts/node_vector_dot/node_vector_dot.yy",},}, @@ -2114,6 +2117,7 @@ {"id":{"name":"fd_rectangle_get_velocity_dissipation_type","path":"scripts/fd_rectangle_get_velocity_dissipation_type/fd_rectangle_get_velocity_dissipation_type.yy",},}, {"id":{"name":"s_node_3d_transform","path":"sprites/s_node_3d_transform/s_node_3d_transform.yy",},}, {"id":{"name":"node_pb_box_split","path":"scripts/node_pb_box_split/node_pb_box_split.yy",},}, + {"id":{"name":"node_feedback_inline","path":"scripts/node_feedback_inline/node_feedback_inline.yy",},}, {"id":{"name":"s_node_output","path":"sprites/s_node_output/s_node_output.yy",},}, {"id":{"name":"sh_atlas","path":"shaders/sh_atlas/sh_atlas.yy",},}, {"id":{"name":"__node_3d_extrude","path":"scripts/__node_3d_extrude/__node_3d_extrude.yy",},}, diff --git a/fonts/_f_sdf/_f_sdf.old.png b/fonts/_f_sdf/_f_sdf.old.png index 7a9904aa99383eb8e5834c74ffca72d7e32f79b3..34a9fdf5cb675b961d95a6100a148982a214ab35 100644 GIT binary patch delta 96 zcmdnl%(}CgwP6dRiKB>Rh=H+{v5A$jk+y+>m4ShmW&iW(9*&H%7&6u==F!tD9T^oA V(DmdLinTBRfv2mV%Q~loCII6l7`Ffb delta 96 zcmdnl%(}CgwP6dRiKB=`h=Gxnk)@TfnYMv}m4U&}AKNEP_i$vC#gOS(%C9rM(veX? W0bS4i4SJs$fWXt$&t;ucLK6U1!W(!1 diff --git a/fonts/_f_sdf/_f_sdf.png b/fonts/_f_sdf/_f_sdf.png index 56b60dd6cb244c76f9fd12e16762bbf856a7938f..052cad204284a863fd555a952bda1e86d48baa20 100644 GIT binary patch delta 96 zcmdnl%(}CgwP6dRiKB>Rh@qjCk%5(=g|>l#m4U&`s6WBeJscTjF=Sq_yS$%X>By*{ WfUal1P^tj~5O})!xvX delta 96 zcmdnl%(}CgwP6dRiKB=`h@p{{k%^U|g|>l#m4QLC@WQg`9*&H%7&4#yBu`DRbYxUe WK-aT0+Cr282s~Z=T-G@yGywqiei=Cc diff --git a/fonts/_f_sdf_medium/_f_sdf_medium.old.png b/fonts/_f_sdf_medium/_f_sdf_medium.old.png index f649b680b46ad20d62f8a419d4ac29b38fcb20d7..994fccd9896a434475ccda0183f3d9833cfc6ce2 100644 GIT binary patch delta 119 zcmZp=!rXL)c|+|>5z7z*V=H45D`R7A0|P4qgExLH!ILMxlnp_bm@91ao`Hcuqr^3$ uBqgyV)v6>jH?_DVF}Hxh$iT>0*U(7U5M9qHHdzCp9tKZWKbLh*2~7aLF(PIF delta 119 zcmZp=!rXL)c|+|>5sMH5BP%0ID`PWl0|P4qgP%XPPnbOMrECbgM8{Ho9R>yljS|<0 vl9a@fRI8HA+|=Td#M}Y~BLgF2T|*;XLv%g&H|Tu^>S6G7^>bP0l+XkKB^D&S diff --git a/fonts/_f_sdf_medium/_f_sdf_medium.png b/fonts/_f_sdf_medium/_f_sdf_medium.png index 9ac35c385c4a9b64ac58ca328d2c325947a6c696..36416e8a4c41eca1d377ba3f13703690e9ca3e9b 100644 GIT binary patch delta 119 zcmZp=!rXL)c|+|>5z7!mLn|W#D?>|d0|P4q1AE=?&nHiODI0<=;aA`v&A`B*QQ{g= ul9E`GYE_b%n_66wm|MVLWME{hYiOivh^|L6HLnGzhr!d;&t;ucLK6VAbRu~G delta 119 zcmZp=!rXL)c|+|>5sMH*BP$~lD?jH?_DVF}Hxh$iT>0*U(7U5M9sGXbVxG9tKZWKbLh*2~7a7aUy*H diff --git a/objects/o_dialog_add_node/Create_0.gml b/objects/o_dialog_add_node/Create_0.gml index fded6a0aa..e79fc36a7 100644 --- a/objects/o_dialog_add_node/Create_0.gml +++ b/objects/o_dialog_add_node/Create_0.gml @@ -212,7 +212,7 @@ event_inherited(); var _ot = _new_list[| i].outputs; for( var j = 0; j < ds_list_size(_ot); j++ ) { - if(ds_list_empty(_ot[| j].value_to)) + if(array_empty(_ot[| j].value_to)) ds_list_add(_outputs, _ot[| j]); } } diff --git a/objects/o_dialog_menubox/Draw_64.gml b/objects/o_dialog_menubox/Draw_64.gml index 953412342..a1a6f9d51 100644 --- a/objects/o_dialog_menubox/Draw_64.gml +++ b/objects/o_dialog_menubox/Draw_64.gml @@ -56,6 +56,7 @@ if(!ready) exit; name: _menuItem.name, index: i, context: context, + params: _menuItem.params, }; var _res = _menuItem.func(_dat); diff --git a/scripts/__VFX/__VFX.gml b/scripts/__VFX/__VFX.gml index 2e1a2de61..ec2cdb481 100644 --- a/scripts/__VFX/__VFX.gml +++ b/scripts/__VFX/__VFX.gml @@ -330,8 +330,8 @@ function __part(_node) constructor { #region helper #macro UPDATE_PART_FORWARD static updateParticleForward = function() { \ var pt = outputs[| 0]; \ - for( var i = 0; i < ds_list_size(pt.value_to); i++ ) { \ - var _n = pt.value_to[| i]; \ + for( var i = 0; i < array_length(pt.value_to); i++ ) { \ + var _n = pt.value_to[i]; \ if(_n.value_from != pt) continue; \ \ if(variable_struct_exists(_n.node, "updateParticleForward")) \ diff --git a/scripts/__node_iterator_inline/__node_iterator_inline.gml b/scripts/__node_iterator_inline/__node_iterator_inline.gml new file mode 100644 index 000000000..8abcaea24 --- /dev/null +++ b/scripts/__node_iterator_inline/__node_iterator_inline.gml @@ -0,0 +1,80 @@ +function Node_Iterator_Inject() { + selectable = false; + + draw_line_shift_x = 0; + draw_line_shift_y = 0; + draw_line_thick = 1; + draw_line_shift_hover = false; + + attributes.junc_in = [ "", 0 ]; + attributes.junc_out = [ "", 0 ]; + + junc_in = noone; + junc_out = noone; + + value_buffer = noone; + + static bypassConnection = function() { #region + return false; + } #endregion + + static bypassNextNode = function() { #region + return false; + } #endregion + + static getNextNode = function() { return [] }; + + static scanJunc = function() { #region + var node_in = PROJECT.nodeMap[? attributes.junc_in[0]]; + var node_out = PROJECT.nodeMap[? attributes.junc_out[0]]; + + junc_in = node_in? node_in.inputs[| attributes.junc_in[1]] : noone; + junc_out = node_out? node_out.outputs[| attributes.junc_out[1]] : noone; + + if(junc_in) junc_in.value_from_loop = self; + if(junc_out) array_push(junc_out.value_to_loop, self); + } #endregion + + static updateValue = function() { #region + var type = junc_out.type; + var val = junc_out.getValue(); + + switch(type) { + case VALUE_TYPE.surface : + surface_array_free(value_buffer); + value_buffer = surface_array_clone(val); + break; + default : + value_buffer = variable_clone(val); + break; + } + } #endregion + + static getValue = function() { #region + return [ value_buffer, junc_out ]; + } #endregion + + static drawConnections = function(params = {}) { #region + if(!active) return; + if(!junc_in || !junc_out) return; + if(!junc_in.node.active || !junc_out.node.active) return; + + params.feedback = true; + + if(drawJuncConnection(junc_out, junc_in, params, self)) + return self; + } #endregion + + static drawNode = function(_x, _y, _mx, _my, _s, display_parameter = noone) {} + + static pointIn = function(_x, _y, _mx, _my, _s) { return false; } + + static postDeserialize = function() { #region + scanJunc(); + } #endregion + + static onDestroy = function() { #region + if(junc_in) junc_in.value_from_loop = noone; + if(junc_out) array_remove(junc_out.value_to_loop, self); + } #endregion +} \ No newline at end of file diff --git a/scripts/__node_iterator_inline/__node_iterator_inline.yy b/scripts/__node_iterator_inline/__node_iterator_inline.yy new file mode 100644 index 000000000..0768f0537 --- /dev/null +++ b/scripts/__node_iterator_inline/__node_iterator_inline.yy @@ -0,0 +1,11 @@ +{ + "resourceType": "GMScript", + "resourceVersion": "1.0", + "name": "__node_iterator_inline", + "isCompatibility": false, + "isDnD": false, + "parent": { + "name": "iterate", + "path": "folders/nodes/data/iterate.yy", + }, +} \ No newline at end of file diff --git a/scripts/_node_fluid_nodes/_node_fluid_nodes.gml b/scripts/_node_fluid_nodes/_node_fluid_nodes.gml index d948987ad..67c1ab007 100644 --- a/scripts/_node_fluid_nodes/_node_fluid_nodes.gml +++ b/scripts/_node_fluid_nodes/_node_fluid_nodes.gml @@ -8,8 +8,8 @@ function Node_Fluid(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { //print($"Update {frame}: {name}"); var outJunc = outputs[| 0]; - for( var i = 0; i < ds_list_size(outJunc.value_to); i++ ) { - var _to = outJunc.value_to[| i]; + for( var i = 0; i < array_length(outJunc.value_to); i++ ) { + var _to = outJunc.value_to[i]; if(_to.value_from != outJunc) continue; if(!struct_has(_to.node, "updateForward")) continue; diff --git a/scripts/contextMenu_controller/contextMenu_controller.gml b/scripts/contextMenu_controller/contextMenu_controller.gml index d7bc9bc08..facf3e013 100644 --- a/scripts/contextMenu_controller/contextMenu_controller.gml +++ b/scripts/contextMenu_controller/contextMenu_controller.gml @@ -28,18 +28,19 @@ return dia; } - function menuItem(name, func, spr = noone, hotkey = noone, toggle = noone) { + function menuItem(name, func, spr = noone, hotkey = noone, toggle = noone, params = {}) { INLINE - return new MenuItem(name, func, spr, hotkey, toggle); + return new MenuItem(name, func, spr, hotkey, toggle, params); } - function MenuItem(name, func, spr = noone, hotkey = noone, toggle = noone) constructor { + function MenuItem(name, func, spr = noone, hotkey = noone, toggle = noone, params = {}) constructor { active = true; self.name = name; self.func = func; self.spr = spr; self.hotkey = hotkey; self.toggle = toggle; + self.params = params; color = c_white; isShelf = false; diff --git a/scripts/draw_corner/draw_corner.gml b/scripts/draw_corner/draw_corner.gml index 17a2f274d..accf2cc2a 100644 --- a/scripts/draw_corner/draw_corner.gml +++ b/scripts/draw_corner/draw_corner.gml @@ -1,4 +1,4 @@ -function draw_corner(x1, y1, xc, yc, x3, y3, thick = 1, col = c_white, sample = 10) { +function draw_corner(x1, y1, xc, yc, x3, y3, thick = 1, col = c_white, sample = 10) { #region var dir0 = point_direction(x1, y1, xc, yc); var dir1 = point_direction(x3, y3, xc, yc); @@ -17,10 +17,6 @@ function draw_corner(x1, y1, xc, yc, x3, y3, thick = 1, col = c_white, sample = var x4 = p4[0]; var y4 = p4[1]; - //draw_circle_prec(x1, y1, 3, false); - //draw_circle_prec(xc, yc, 3, false); - //draw_circle_prec(x3, y3, 3, false); - var ra = (x1 - x2) * (y3 - y4) - (y1 - y2) * (x3 - x4); if(ra == 0) return; @@ -50,4 +46,45 @@ function draw_corner(x1, y1, xc, yc, x3, y3, thick = 1, col = c_white, sample = } draw_primitive_end(); -} \ No newline at end of file +} #endregion + +function get_corner(x1, y1, xc, yc, x3, y3, sample = 10) { #region + var dir0 = point_direction(x1, y1, xc, yc); + var dir1 = point_direction(x3, y3, xc, yc); + + var dis = point_distance(x1, y1, x3, y3); + if(dis < 8) return [ [x1, y1], [x3, y3] ]; + + var p2 = point_rotate(xc, yc, x1, y1, -90); + var x2 = p2[0]; + var y2 = p2[1]; + + var p4 = point_rotate(xc, yc, x3, y3, 90); + var x4 = p4[0]; + var y4 = p4[1]; + + var ra = (x1 - x2) * (y3 - y4) - (y1 - y2) * (x3 - x4); + if(ra == 0) return []; + + var px = ((x1 * y2 - y1 * x2) * (x3 - x4) - (x1 - x2) * (x3 * y4 - y3 * x4)) / ra; + var py = ((x1 * y2 - y1 * x2) * (y3 - y4) - (y1 - y2) * (x3 * y4 - y3 * x4)) / ra; + + var r = point_distance(px, py, x1, y1); + var d0 = point_direction(px, py, x1, y1); + var d1 = point_direction(px, py, x3, y3); + + var ox, oy, nx, ny; + var aa = angle_difference(d1, d0); + sample = round(sample); + + var pnt = array_create(sample + 1) + for( var i = 0; i <= sample; i++ ) { + var a = d0 + aa * (i / sample); + nx = px + lengthdir_x(r, a); + ny = py + lengthdir_y(r, a); + + pnt[i] = [ nx, ny ]; + } + + return pnt; +} #endregion \ No newline at end of file diff --git a/scripts/draw_line_curve/draw_line_curve.gml b/scripts/draw_line_curve/draw_line_curve.gml index 899f01ba8..6aa834bdc 100644 --- a/scripts/draw_line_curve/draw_line_curve.gml +++ b/scripts/draw_line_curve/draw_line_curve.gml @@ -41,6 +41,7 @@ function draw_line_curve_color(x0, y0, x1, y1, xc = noone, yc = noone, _s = 1, t var sample = ceil((abs(x0 - x1) + abs(y0 - y1)) / 32 * PREFERENCES.connection_line_sample); sample = clamp(sample, 2, 128); + if(type == LINE_STYLE.dashed) sample *= 2; var x2 = lerp(x0, x1, 0. - sign(x1 - x0) * 0.2) - abs(y1 - y0) * 0.1; var x3 = lerp(x0, x1, 1. + sign(x1 - x0) * 0.2) + abs(y1 - y0) * 0.1; @@ -49,9 +50,6 @@ function draw_line_curve_color(x0, y0, x1, y1, xc = noone, yc = noone, _s = 1, t var c = draw_get_color(); var ox, oy, nx, ny, t, it, oc, nc; - var dash_distance = 2; - - var line = new LineDrawer(thick); for( var i = 0; i <= sample; i++ ) { t = i / sample; @@ -77,7 +75,7 @@ function draw_line_curve_color(x0, y0, x1, y1, xc = noone, yc = noone, _s = 1, t draw_line_round_color(ox, oy, nx, ny, thick, oc, nc, i == 1, i == sample); break; case LINE_STYLE.dashed : - if(floor(i / dash_distance) % 2) + if(floor(i % 2)) draw_line_round_color(ox, oy, nx, ny, thick, oc, nc); break; } @@ -87,8 +85,6 @@ function draw_line_curve_color(x0, y0, x1, y1, xc = noone, yc = noone, _s = 1, t oy = ny; oc = nc; } - - line.finish(); } function draw_line_curve_corner(x0, y0, x1, y1, _s = 1, thick = 1, col1 = c_white, col2 = c_white) { diff --git a/scripts/draw_line_elbow/draw_line_elbow.gml b/scripts/draw_line_elbow/draw_line_elbow.gml index 9437e8a31..7d955efe0 100644 --- a/scripts/draw_line_elbow/draw_line_elbow.gml +++ b/scripts/draw_line_elbow/draw_line_elbow.gml @@ -46,9 +46,9 @@ function draw_line_elbow_color(x0, y0, x1, y1, cx = noone, cy = noone, _s = 1, t draw_set_color(col1); draw_line_width(x0, y0, xx0, y0, thick); draw_set_color(col2); draw_line_width(xx1, y1, x1, y1, thick); - draw_line_dashed_color(xx0, y0, xx0, cy, thick, col1, cm, 12); - draw_line_dashed_color(xx0, cy, xx1, cy, thick, cm, cm, 12); - draw_line_dashed_color(xx1, cy, xx1, y1, thick, cm, col2, 12); + draw_line_dashed_color(xx0, y0, xx0, cy, thick, col1, cm, 6 * _s); + draw_line_dashed_color(xx0, cy, xx1, cy, thick, cm, cm, 6 * _s); + draw_line_dashed_color(xx1, cy, xx1, y1, thick, cm, col2, 6 * _s); } } else { if(type == LINE_STYLE.solid) { @@ -63,9 +63,9 @@ function draw_line_elbow_color(x0, y0, x1, y1, cx = noone, cy = noone, _s = 1, t draw_corner(cx, y1 - corner * iy, cx, y1, cx + corner * sign(x1 - cx), y1, thick, cm, sample); } } else { - draw_line_dashed_color(x0, y0, cx, y0, thick, col1, cm, 12); - draw_line_dashed_color(cx, y0, cx, y1, thick, cm, cm, 12); - draw_line_dashed_color(cx, y1, x1, y1, thick, cm, col2, 12); + draw_line_dashed_color(x0, y0, cx, y0, thick, col1, cm, 6 * _s); + draw_line_dashed_color(cx, y0, cx, y1, thick, cm, cm, 6 * _s); + draw_line_dashed_color(cx, y1, x1, y1, thick, cm, col2, 6 * _s); } } } diff --git a/scripts/draw_line_elbow_diag/draw_line_elbow_diag.gml b/scripts/draw_line_elbow_diag/draw_line_elbow_diag.gml index 0cbb84d57..f4405dca1 100644 --- a/scripts/draw_line_elbow_diag/draw_line_elbow_diag.gml +++ b/scripts/draw_line_elbow_diag/draw_line_elbow_diag.gml @@ -1,11 +1,8 @@ function draw_line_elbow_diag_color(x0, y0, x1, y1, cx = noone, cy = noone, _s = 1, thick = 1, c1 = c_white, c2 = c_white, corner = 0, indexIn = 1, indexOut = 1, type = LINE_STYLE.solid) { - if(y0 == y1) { - if(type == LINE_STYLE.solid) - draw_line_width_color(x0, y0, x1, y1, thick, c1, c2); - else - draw_line_dashed_color(x0, y0, x1, y1, thick, c1, c2); - return; - } + var __dash = 6 * _s; + var __line = type == LINE_STYLE.solid? draw_line_width_color : draw_line_dashed_color; + + if(y0 == y1) { __line(x0, y0, x1, y1, thick, c1, c2, __dash); return; } corner = min(corner, abs(y1 - y0) / 2); var sample = floor(corner / 8); @@ -57,8 +54,8 @@ function draw_line_elbow_diag_color(x0, y0, x1, y1, cx = noone, cy = noone, _s = var bot = abs(y1 - cy) < rrx / 2; if(top) { - draw_line_width_color(x0, y0, xx0, y0, thick, c1, c1); - draw_line_width_color(xx1 + cS, y1, x1, y1, thick, c2, c2); + __line(x0, y0, xx0, y0, thick, c1, c1, __dash); + __line(xx1 + cS, y1, x1, y1, thick, c2, c2, __dash); var cor = (cy - y0) * 2; var x1s = xx1 - cor * iy; @@ -69,17 +66,17 @@ function draw_line_elbow_diag_color(x0, y0, x1, y1, cx = noone, cy = noone, _s = var _xcr = xcr / sqrt(2); var _ycr = ycr / sqrt(2); - draw_line_width_color(xx0, y0, x1s - xcr, y0, thick, c1, cm); - draw_line_width_color(xx1, y1s + ycr * iy, xx1, y1 - cS * iy, thick, cm, c2); + __line(xx0, y0, x1s - xcr, y0, thick, c1, cm, __dash); + __line(xx1, y1s + ycr * iy, xx1, y1 - cS * iy, thick, cm, c2, __dash); - draw_line_width_color(x1s + _xcr, y0 + _xcr * iy, xx1 - _ycr, y1s - _ycr * iy, thick, cm, cm); + __line(x1s + _xcr, y0 + _xcr * iy, xx1 - _ycr, y1s - _ycr * iy, thick, cm, cm, __dash); if(cS) draw_corner(xx1, y1 - cS * iy, xx1, y1, xx1 + cS, y1, thick, c2, sample); if(xcr) draw_corner(x1s - xcr, y0, x1s, y0, x1s + _xcr, y0 + _xcr * iy, thick, cm, sample); if(ycr) draw_corner(xx1 - _ycr, y1s - _ycr * iy, xx1, y1s, xx1, y1s + ycr * iy, thick, cm, sample); } else if(bot) { - draw_line_width_color(x0, y0, xx0 - cS, y0, thick, c1, c1); - draw_line_width_color(xx1, y1, x1, y1, thick, c2, c2); + __line(x0, y0, xx0 - cS, y0, thick, c1, c1, __dash); + __line(xx1, y1, x1, y1, thick, c2, c2, __dash); var cor = (y1 - cy) * 2; var x1s = xx0 + cor * iy; @@ -90,17 +87,17 @@ function draw_line_elbow_diag_color(x0, y0, x1, y1, cx = noone, cy = noone, _s = var _xcr = xcr / sqrt(2); var _ycr = ycr / sqrt(2); - draw_line_width_color(xx0, y0 + cS * iy, xx0, y1s - ycr * iy, thick, c1, cm); - draw_line_width_color(x1s + xcr, y1, xx1, y1, thick, cm, c2); + __line(xx0, y0 + cS * iy, xx0, y1s - ycr * iy, thick, c1, cm, __dash); + __line(x1s + xcr, y1, xx1, y1, thick, cm, c2, __dash); - draw_line_width_color(xx0 + _ycr, y1s + _ycr * iy, x1s - _xcr, y1 - _xcr * iy, thick, cm, cm); + __line(xx0 + _ycr, y1s + _ycr * iy, x1s - _xcr, y1 - _xcr * iy, thick, cm, cm, __dash); if(cS) draw_corner(xx0 - cS, y0, xx0, y0, xx0, y0 + cS * iy, thick, c1, sample); if(xcr) draw_corner(x1s - _xcr, y1 - _xcr * iy, x1s, y1, x1s + xcr, y1, thick, cm, sample); if(ycr) draw_corner(xx0, y1s - ycr * iy, xx0, y1s, xx0 + _ycr, y1s + _ycr * iy, thick, cm, sample); } else { - draw_line_width_color(x0, y0, xx0 - cS0, y0, thick, c1, c1); - draw_line_width_color(xx1 + cS1, y1, x1, y1, thick, c2, c2); + __line(x0, y0, xx0 - cS0, y0, thick, c1, c1, __dash); + __line(xx1 + cS1, y1, x1, y1, thick, c2, c2, __dash); var cor = rrx / 2; var yC0 = cy - cor * iy0; @@ -112,10 +109,10 @@ function draw_line_elbow_diag_color(x0, y0, x1, y1, cx = noone, cy = noone, _s = var _corY0 = corY0 / sqrt(2); var _corY1 = corY1 / sqrt(2); - draw_line_width_color(xx0, y0 + cS0 * iy, xx0, yC0 - corY0 * iy, thick, c1, cm); - draw_line_width_color(xx1, yC1 + corY1 * iy, xx1, y1 - cS1 * iy, thick, cm, c2); + __line(xx0, y0 + cS0 * iy, xx0, yC0 - corY0 * iy, thick, c1, cm, __dash); + __line(xx1, yC1 + corY1 * iy, xx1, y1 - cS1 * iy, thick, cm, c2, __dash); - draw_line_width_color(xx0 + _corY0, yC0 + _corY0 * iy, xx1 - _corY1, yC1 - _corY1 * iy, thick, cm, cm); + __line(xx0 + _corY0, yC0 + _corY0 * iy, xx1 - _corY1, yC1 - _corY1 * iy, thick, cm, cm, __dash); if(cS0) draw_corner(xx0 - cS0, y0, xx0, y0, xx0, y0 + cS0 * iy0, thick, c1, sample); if(cS1) draw_corner(xx1, y1 - cS1 * iy1, xx1, y1, xx1 + cS1, y1, thick, c2, sample); @@ -145,8 +142,8 @@ function draw_line_elbow_diag_color(x0, y0, x1, y1, cx = noone, cy = noone, _s = var _crn0 = crn0 / sqrt(2); var _crn1 = crn1 / sqrt(2); - draw_line_width_color(x0, y0, xx0 - cR0, y0, thick, c1, c1); - draw_line_width_color(xx1 + cR1, y1, x1, y1, thick, c2, c2); + __line(x0, y0, xx0 - cR0, y0, thick, c1, c1, __dash); + __line(xx1 + cR1, y1, x1, y1, thick, c2, c2, __dash); if(cS) draw_corner(xx0 - cR0, y0, xx0, y0, xx0, y0 + cR0 * iy0, thick, c1); if(cS) draw_corner(xx1, y1 - cR1 * iy1, xx1, y1, xx1 + cR1, y1, thick, c2); @@ -155,21 +152,21 @@ function draw_line_elbow_diag_color(x0, y0, x1, y1, cx = noone, cy = noone, _s = var cR = min(cS, abs(xx1 - xx0) / 2); var _cR = cR / sqrt(2); - draw_line_width_color( crX0, y0 + cR0 * iy0, crX0, crY0 - cR * iy0, thick, c1, cm); - draw_line_width_color( crX3, y1 - cR1 * iy1, crX3, crY3 + cR * iy1, thick, c2, cm); - draw_line_width_color( crX0 - _cR, crY0 + _cR * iy0, crX3 + _cR, crY3 - _cR * iy1, thick, cm, cm); + __line( crX0, y0 + cR0 * iy0, crX0, crY0 - cR * iy0, thick, c1, cm, __dash); + __line( crX3, y1 - cR1 * iy1, crX3, crY3 + cR * iy1, thick, c2, cm, __dash); + __line( crX0 - _cR, crY0 + _cR * iy0, crX3 + _cR, crY3 - _cR * iy1, thick, cm, cm, __dash); if(cR) { draw_corner( crX0, crY0 - cR * iy0, crX0, crY0, crX0 - _cR, crY0 + _cR * iy0, thick, cm, sample); draw_corner(crX3 + _cR, crY3 - _cR * iy1, crX3, crY3, crX3, crY3 + cR * iy1, thick, cm, sample); } } else { - draw_line_width_color( crX0, y0 + cR0 * iy0, crX0, crY0 - crn0 * iy0, thick, c1, cm); - draw_line_width_color(crX1 - crn0 * ix, crY1, crX2 + crn1 * ix, crY2, thick, cm, cm); - draw_line_width_color( crX3, crY3 + crn1 * iy1, crX3, y1 - cR1 * iy1, thick, cm, c2); + __line( crX0, y0 + cR0 * iy0, crX0, crY0 - crn0 * iy0, thick, c1, cm, __dash); + __line(crX1 - crn0 * ix, crY1, crX2 + crn1 * ix, crY2, thick, cm, cm, __dash); + __line( crX3, crY3 + crn1 * iy1, crX3, y1 - cR1 * iy1, thick, cm, c2, __dash); - draw_line_width_color(crX0 - _crn0 * ix, crY0 + _crn0 * iy0, crX1 + _crn0 * ix, crY1 - _crn0 * iy0, thick, cm, cm); - draw_line_width_color(crX2 - _crn1 * ix, crY2 + _crn1 * iy1, crX3 + _crn1 * ix, crY3 - _crn1 * iy1, thick, cm, cm); + __line(crX0 - _crn0 * ix, crY0 + _crn0 * iy0, crX1 + _crn0 * ix, crY1 - _crn0 * iy0, thick, cm, cm, __dash); + __line(crX2 - _crn1 * ix, crY2 + _crn1 * iy1, crX3 + _crn1 * ix, crY3 - _crn1 * iy1, thick, cm, cm, __dash); if(crn0) { draw_corner( crX0, crY0 - crn0 * iy0, crX0, crY0, crX0 - _crn0 * ix, crY0 + _crn0 * iy0, thick, cm, sample); @@ -194,22 +191,16 @@ function draw_line_elbow_diag_color(x0, y0, x1, y1, cx = noone, cy = noone, _s = var cm = merge_color(c1, c2, rat); var iy = sign(y1 - y0); - if(type == LINE_STYLE.solid) { - var corn = min(corner, abs(x0 - _xc0), abs(x1 - _xc1), abs(y1 - y0) / 2); - var cor2 = corn / sqrt(2); + var corn = min(corner, abs(x0 - _xc0), abs(x1 - _xc1), abs(y1 - y0) / 2); + var cor2 = corn / sqrt(2); - draw_line_width_color( x0, y0, _xc0 - corn, y0, thick, c1, cm); - draw_line_width_color(_xc0 + cor2, y0 + cor2 * iy, _xc1 - cor2, y1 - cor2 * iy, thick, cm, cm); - draw_line_width_color(_xc1 + corn, y1, x1, y1, thick, cm, c2); + __line( x0, y0, _xc0 - corn, y0, thick, c1, cm, __dash); + __line(_xc0 + cor2, y0 + cor2 * iy, _xc1 - cor2, y1 - cor2 * iy, thick, cm, cm, __dash); + __line(_xc1 + corn, y1, x1, y1, thick, cm, c2, __dash); - if(corn) { - draw_corner(_xc0 - corn, y0, _xc0, y0, _xc0 + cor2, y0 + cor2 * iy, thick, cm, sample); - draw_corner(_xc1 - cor2, y1 - cor2 * iy, _xc1, y1, _xc1 + corn, y1, thick, cm, sample); - } - } else { - draw_line_dashed_color( x0, y0, _xc0, y0, thick, c1, cm, 12); - draw_line_dashed_color(_xc0, y0, _xc1, y1, thick, cm, cm, 12); - draw_line_dashed_color(_xc1, y1, x1, y1, thick, cm, c2, 12); + if(corn) { + draw_corner(_xc0 - corn, y0, _xc0, y0, _xc0 + cor2, y0 + cor2 * iy, thick, cm, sample); + draw_corner(_xc1 - cor2, y1 - cor2 * iy, _xc1, y1, _xc1 + corn, y1, thick, cm, sample); } } } diff --git a/scripts/node_VFX_effector/node_VFX_effector.gml b/scripts/node_VFX_effector/node_VFX_effector.gml index ecea96161..2686314f3 100644 --- a/scripts/node_VFX_effector/node_VFX_effector.gml +++ b/scripts/node_VFX_effector/node_VFX_effector.gml @@ -177,9 +177,9 @@ function Node_VFX_effector(_x, _y, _group = noone) : Node(_x, _y, _group) constr } var jun = outputs[| 0]; - for(var j = 0; j < ds_list_size(jun.value_to); j++) { - if(jun.value_to[| j].value_from == jun) - jun.value_to[| j].node.doUpdate(); + for(var j = 0; j < array_length(jun.value_to); j++) { + if(jun.value_to[j].value_from == jun) + jun.value_to[j].node.doUpdate(); } } #endregion diff --git a/scripts/node_VFX_spawner/node_VFX_spawner.gml b/scripts/node_VFX_spawner/node_VFX_spawner.gml index a5db71424..c9048044d 100644 --- a/scripts/node_VFX_spawner/node_VFX_spawner.gml +++ b/scripts/node_VFX_spawner/node_VFX_spawner.gml @@ -46,12 +46,12 @@ function Node_VFX_Spawner(_x, _y, _group = noone) : Node_VFX_Spawner_Base(_x, _y static onPartCreate = function(part) { #region var vt = outputs[| 1]; - if(ds_list_empty(vt.value_to)) return; + if(array_empty(vt.value_to)) return; var pv = part.getPivot(); - for( var i = 0; i < ds_list_size(vt.value_to); i++ ) { - var _n = vt.value_to[| i]; + for( var i = 0; i < array_length(vt.value_to); i++ ) { + var _n = vt.value_to[i]; if(_n.value_from != vt) continue; _n.node.spawn(part.frame, pv); } @@ -59,12 +59,12 @@ function Node_VFX_Spawner(_x, _y, _group = noone) : Node_VFX_Spawner_Base(_x, _y static onPartStep = function(part) { #region var vt = outputs[| 2]; - if(ds_list_empty(vt.value_to)) return; + if(array_empty(vt.value_to)) return; var pv = part.getPivot(); - for( var i = 0; i < ds_list_size(vt.value_to); i++ ) { - var _n = vt.value_to[| i]; + for( var i = 0; i < array_length(vt.value_to); i++ ) { + var _n = vt.value_to[i]; if(_n.value_from != vt) continue; _n.node.spawn(part.frame, pv); } @@ -72,12 +72,12 @@ function Node_VFX_Spawner(_x, _y, _group = noone) : Node_VFX_Spawner_Base(_x, _y static onPartDestroy = function(part) { #region var vt = outputs[| 3]; - if(ds_list_empty(vt.value_to)) return; + if(array_empty(vt.value_to)) return; var pv = part.getPivot(); - for( var i = 0; i < ds_list_size(vt.value_to); i++ ) { - var _n = vt.value_to[| i]; + for( var i = 0; i < array_length(vt.value_to); i++ ) { + var _n = vt.value_to[i]; if(_n.value_from != vt) continue; _n.node.spawn(part.frame, pv); } diff --git a/scripts/node_ase_file_read/node_ase_file_read.gml b/scripts/node_ase_file_read/node_ase_file_read.gml index 341216705..be546cd75 100644 --- a/scripts/node_ase_file_read/node_ase_file_read.gml +++ b/scripts/node_ase_file_read/node_ase_file_read.gml @@ -192,8 +192,8 @@ function Node_ASE_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const var _name = _layer.name; var _node = noone; - for( var j = 0; j < ds_list_size(outputs[| 1].value_to); j++ ) { - var _targNode = outputs[| 1].value_to[| j].node; + for( var j = 0; j < array_length(outputs[| 1].value_to); j++ ) { + var _targNode = outputs[| 1].value_to[j].node; if(!_targNode.active) continue; if(_targNode.display_name == _name) { @@ -291,8 +291,8 @@ function Node_ASE_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const updatePaths(path); update(); - for( var j = 0; j < ds_list_size(outputs[| 1].value_to); j++ ) { - var _targNode = outputs[| 1].value_to[| j].node; + for( var j = 0; j < array_length(outputs[| 1].value_to); j++ ) { + var _targNode = outputs[| 1].value_to[j].node; _targNode._name = ""; _targNode.update(); } diff --git a/scripts/node_blend/node_blend.gml b/scripts/node_blend/node_blend.gml index a9c4d119e..668c1e26b 100644 --- a/scripts/node_blend/node_blend.gml +++ b/scripts/node_blend/node_blend.gml @@ -161,49 +161,50 @@ function Node_Blend(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con var cDep = attrDepth(); - var ww = 1, hh = 1; - var _backDraw = _back; - var _foreDraw = _fore; + #region dimension + var ww = 1; + var hh = 1; + var _atlas = is_instanceof(_fore, SurfaceAtlas); - var _atlas = is_instanceof(_fore, SurfaceAtlas); + switch(_outp) { + case 0 : + ww = surface_get_width_safe(_back); + hh = surface_get_height_safe(_back); + break; + case 1 : + ww = surface_get_width_safe(_fore); + hh = surface_get_height_safe(_fore); + break; + case 2 : + ww = surface_get_width_safe(_mask); + hh = surface_get_height_safe(_mask); + break; + case 3 : + ww = max(surface_get_width_safe(_back), surface_get_width_safe(_fore), surface_get_width_safe(_mask)); + hh = max(surface_get_height_safe(_back), surface_get_height_safe(_fore), surface_get_height_safe(_mask)); + break; + case 4 : + ww = _out_dim[0]; + hh = _out_dim[1]; + break; + } + #endregion - switch(_outp) { // Dimension - case 0 : - ww = surface_get_width_safe(_back); - hh = surface_get_height_safe(_back); - break; - case 1 : - ww = surface_get_width_safe(_fore); - hh = surface_get_height_safe(_fore); - break; - case 2 : - ww = surface_get_width_safe(_mask); - hh = surface_get_height_safe(_mask); - break; - case 3 : - ww = max(surface_get_width_safe(_back), surface_get_width_safe(_fore), surface_get_width_safe(_mask)); - hh = max(surface_get_height_safe(_back), surface_get_height_safe(_fore), surface_get_height_safe(_mask)); - break; - case 4 : - ww = _out_dim[0]; - hh = _out_dim[1]; - break; - } + for( var i = 0; i < 2; i++ ) + temp_surface[i] = surface_verify(temp_surface[i], ww, hh, cDep); - if(_fill == 0 || _atlas) { // Direct placement - for( var i = 0; i < 2; i++ ) - temp_surface[i] = surface_verify(temp_surface[i], ww, hh, cDep); - - _foreDraw = temp_surface[1]; - + var _backDraw = temp_surface[0]; + var _foreDraw = temp_surface[1]; + + if(_fill == 0 || _atlas) { #region surface position if(_atlas) { if(_outp == 0) { surface_set_shader(_foreDraw, noone,, BLEND.over); draw_surface_safe(_fore.getSurface(), _fore.x, _fore.y); surface_reset_shader(); - } else if(_outp == 1) { - _backDraw = temp_surface[0]; + _backDraw = _back; + } else if(_outp == 1) { surface_set_shader(_foreDraw, noone,, BLEND.over); draw_surface_safe(_fore, 0, 0); surface_reset_shader(); @@ -225,20 +226,24 @@ function Node_Blend(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con surface_set_shader(_foreDraw, noone,, BLEND.over); draw_surface_safe(_fore, px - fw / 2, py - fh / 2); surface_reset_shader(); + + _backDraw = _back; } - } + } #endregion - var _output = noone; - - if(is_instanceof(_outSurf, SurfaceAtlas)) - _output = surface_verify(_outSurf.surface.surface, ww, hh, cDep); - else - _output = surface_verify(_outSurf, ww, hh, cDep); + var _osurf = is_instanceof(_outSurf, SurfaceAtlas)? _outSurf.surface.surface : _outSurf; + var _output = surface_verify(_osurf, ww, hh, cDep); _mask = mask_modify(_mask, _mskInv, _mskFea); surface_set_shader(_output, noone); - draw_surface_blend(_backDraw, _foreDraw, _type, _opacity, _pre_alp, _mask, _fill == 2); + if(is_surface(_fore)) { + draw_surface_blend(_backDraw, _foreDraw, _type, _opacity, _pre_alp, _mask, _fill == 2); + } else { + BLEND_OVERRIDE + draw_surface(_backDraw, 0, 0); + BLEND_NORMAL + } surface_reset_shader(); if(_atlas) { diff --git a/scripts/node_collection/node_collection.gml b/scripts/node_collection/node_collection.gml index 8e22d897a..d5fb0082d 100644 --- a/scripts/node_collection/node_collection.gml +++ b/scripts/node_collection/node_collection.gml @@ -113,7 +113,7 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc draw_dummy = false; input_dummy.onSetFrom = function(juncFrom) { #region - ds_list_remove(juncFrom.value_to, input_dummy); + array_remove(juncFrom.value_to, input_dummy); input_dummy.value_from = noone; var input = nodeBuild("Node_Group_Input", 0, 0, self); @@ -225,8 +225,8 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc for( var i = custom_output_index; i < ds_list_size(outputs); i++ ) { var _junc = outputs[| i]; - for( var j = 0; j < ds_list_size(_junc.value_to); j++ ) { - var _to = _junc.value_to[| j]; + for( var j = 0; j < array_length(_junc.value_to); j++ ) { + var _to = _junc.value_to[j]; if(_to.value_from != _junc) continue; array_push_unique(nodes, _to.node); } diff --git a/scripts/node_collection_inline/node_collection_inline.gml b/scripts/node_collection_inline/node_collection_inline.gml index 7515ed82f..7f3c657b8 100644 --- a/scripts/node_collection_inline/node_collection_inline.gml +++ b/scripts/node_collection_inline/node_collection_inline.gml @@ -1,32 +1,36 @@ function Node_Collection_Inline(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { attributes.members = []; - members = []; + nodes = ds_list_create(); group_vertex = []; group_dragging = false; group_adding = false; vertex_hash = ""; + managedRenderOrder = false; group_hovering = false; group_hover_al = 0; + selectable = false; static removeNode = function(node) { #region array_remove(attributes.members, node.node_id); - array_remove(members, node); + ds_list_remove(nodes, node); array_remove(node.context_data, self); } #endregion static addNode = function(node) { #region + if(array_exists(attributes.members, node.node_id)) return; + array_push(attributes.members, node.node_id); - array_push(members, node); + ds_list_add(nodes, node); array_push_unique(node.context_data, self); } #endregion static ccw = function(a, b, c) { return (b[0] - a[0]) * (c[1] - a[1]) - (c[0] - a[0]) * (b[1] - a[1]); } - static getNodeBorder = function(_i, _vertex, _node) { #region - var _rad = 4; + static getNodeBorder = function(_ind, _vertex, _node) { #region + var _rad = 6; var _stp = 15; var _nx0 = _node.x - 32 + _rad; @@ -34,15 +38,16 @@ function Node_Collection_Inline(_x, _y, _group = noone) : Node(_x, _y, _group) c var _nx1 = _node.x + (_node == self? _node.w / 2 : _node.w + 32 - _rad); var _ny1 = _node.y + _node.h + 32 - _rad; - var _ind = 0; - for( var i = 0; i <= 90; i += _stp ) _vertex[_i * 7 * 4 + _ind++] = [ _nx1 + lengthdir_x(_rad, i), _ny0 + lengthdir_y(_rad, i) ]; - for( var i = 90; i <= 180; i += _stp ) _vertex[_i * 7 * 4 + _ind++] = [ _nx0 + lengthdir_x(_rad, i), _ny0 + lengthdir_y(_rad, i) ]; - for( var i = 180; i <= 270; i += _stp ) _vertex[_i * 7 * 4 + _ind++] = [ _nx0 + lengthdir_x(_rad, i), _ny1 + lengthdir_y(_rad, i) ]; - for( var i = 270; i <= 360; i += _stp ) _vertex[_i * 7 * 4 + _ind++] = [ _nx1 + lengthdir_x(_rad, i), _ny1 + lengthdir_y(_rad, i) ]; + for( var i = 0; i < 90; i += _stp ) _vertex[_ind++] = [ _nx1 + lengthdir_x(_rad, i), _ny0 + lengthdir_y(_rad, i) ]; + for( var i = 90; i < 180; i += _stp ) _vertex[_ind++] = [ _nx0 + lengthdir_x(_rad, i), _ny0 + lengthdir_y(_rad, i) ]; + for( var i = 180; i < 270; i += _stp ) _vertex[_ind++] = [ _nx0 + lengthdir_x(_rad, i), _ny1 + lengthdir_y(_rad, i) ]; + for( var i = 270; i < 360; i += _stp ) _vertex[_ind++] = [ _nx1 + lengthdir_x(_rad, i), _ny1 + lengthdir_y(_rad, i) ]; + + return _ind; } #endregion static refreshMember = function() { #region - members = []; + ds_list_clear(nodes); for( var i = 0, n = array_length(attributes.members); i < n; i++ ) { if(!ds_map_exists(PROJECT.nodeMap, attributes.members[i])) { @@ -52,7 +57,7 @@ function Node_Collection_Inline(_x, _y, _group = noone) : Node(_x, _y, _group) c var _node = PROJECT.nodeMap[? attributes.members[i]]; array_push_unique(_node.context_data, self); - array_push(members, _node); + ds_list_add(nodes, _node); } } #endregion @@ -60,8 +65,8 @@ function Node_Collection_Inline(_x, _y, _group = noone) : Node(_x, _y, _group) c var _hash = ""; var _ind = 0; - for( var i = 0, n = array_length(members); i < n; i++ ) { - var _node = members[i]; + for( var i = 0, n = ds_list_size(nodes); i < n; i++ ) { + var _node = nodes[| i]; if(!_node.active) continue; _hash += $"{_node.x},{_node.y},{_node.w},{_node.h}|"; _ind++; @@ -78,48 +83,49 @@ function Node_Collection_Inline(_x, _y, _group = noone) : Node(_x, _y, _group) c group_vertex = []; if(_ind == 0) return; - var _vtrx = array_create(_ind * 4 * 7); + var _vtrx = array_create(_ind * 4 * 6); var _ind = 0; - for( var i = 0, n = array_length(members); i < n; i++ ) { - var _node = members[i]; + for( var i = 0, n = ds_list_size(nodes); i < n; i++ ) { + var _node = nodes[| i]; if(!_node.active) continue; - getNodeBorder(_ind, _vtrx, _node); - _ind++; + _ind = getNodeBorder(_ind, _vtrx, _node); } - __temp_minP = [ x, y ]; - __temp_minI = 0; + #region create convex shape + __temp_minP = [ x, y ]; + __temp_minI = 0; - for( var i = 0, n = array_length(_vtrx); i < n; i++ ) { - var _v = _vtrx[i]; + for( var i = 0, n = array_length(_vtrx); i < n; i++ ) { + var _v = _vtrx[i]; - if(_v[1] > __temp_minP[1] || (_v[1] == __temp_minP[1] && _v[0] < __temp_minP[0])) { - __temp_minP = _v; - __temp_minI = i; + if(_v[1] > __temp_minP[1] || (_v[1] == __temp_minP[1] && _v[0] < __temp_minP[0])) { + __temp_minP = _v; + __temp_minI = i; + } } - } - _vtrx = array_map( _vtrx, function(a, i) { return [ a[0], a[1], i == __temp_minI? -999 : point_direction(__temp_minP[0], __temp_minP[1], a[0], a[1]) + 360 ] }); - array_sort(_vtrx, function(a0, a1) { return a0[2] == a1[2]? sign(a0[0] - a1[0]) : sign(a0[2] - a1[2]); }); + _vtrx = array_map( _vtrx, function(a, i) { return [ a[0], a[1], i == __temp_minI? -999 : point_direction(__temp_minP[0], __temp_minP[1], a[0], a[1]) + 360 ] }); + array_sort(_vtrx, function(a0, a1) { return a0[2] == a1[2]? sign(a0[0] - a1[0]) : sign(a0[2] - a1[2]); }); - var _linS = 0; - for( var i = 1, n = array_length(_vtrx); i < n; i++ ) { - if(_vtrx[i][1] != _vtrx[0][1]) break; - _linS = i; - } + var _linS = 0; + for( var i = 1, n = array_length(_vtrx); i < n; i++ ) { + if(_vtrx[i][1] != _vtrx[0][1]) break; + _linS = i; + } - array_delete(_vtrx, 1, _linS - 1); + array_delete(_vtrx, 1, _linS - 1); - group_vertex = [ _vtrx[0], _vtrx[1] ]; + group_vertex = [ _vtrx[0], _vtrx[1] ]; - for( var i = 2, n = array_length(_vtrx); i < n; i++ ) { - var _v = _vtrx[i]; + for( var i = 2, n = array_length(_vtrx); i < n; i++ ) { + var _v = _vtrx[i]; - while( array_length(group_vertex) >= 2 && ccw( group_vertex[array_length(group_vertex) - 2], group_vertex[array_length(group_vertex) - 1], _v ) >= 0 ) - array_pop(group_vertex); - array_push(group_vertex, _v); - } + while( array_length(group_vertex) >= 2 && ccw( group_vertex[array_length(group_vertex) - 2], group_vertex[array_length(group_vertex) - 1], _v ) >= 0 ) + array_pop(group_vertex); + array_push(group_vertex, _v); + } + #endregion } #endregion static groupCheck = function(_x, _y, _s, _mx, _my) { #region @@ -159,16 +165,31 @@ function Node_Collection_Inline(_x, _y, _group = noone) : Node(_x, _y, _group) c } } #endregion + static pointIn = function(_x, _y, _mx, _my, _s) { return false; } + + static resetRender = function(_clearCache = false) { #region + LOG_LINE_IF(global.FLAG.render == 1, $"Reset Render for {INAME}"); + + setRenderStatus(false); + if(_clearCache) clearInputCache(); + + for( var i = 0; i < ds_list_size(nodes); i++ ) + nodes[| i].resetRender(_clearCache); + } #endregion + static drawNodeBG = function(_x, _y, _mx, _my, _s) { #region refreshGroupBG(); if(array_length(group_vertex) < 3) return false; - var _hov = false; - var _color = getColor(); + var _hov = false; + var _color = getColor(); + var _sel = inspecting; + inspecting = false; draw_set_color(_color); group_hover_al = lerp_float(group_hover_al, group_hovering, 4); - draw_set_alpha(0.025 + 0.050 * group_hover_al); + draw_set_alpha(_sel? 0.1 : 0.025 + 0.050 * group_hover_al); + draw_primitive_begin(pr_trianglelist); var a = group_vertex[0]; var b = group_vertex[1]; @@ -214,6 +235,8 @@ function Node_Collection_Inline(_x, _y, _group = noone) : Node(_x, _y, _group) c static drawNode = function(_x, _y, _mx, _my, _s, display_parameter = noone) {} + static drawBadge = function(_x, _y, _s) {} + static postDeserialize = function() { #region refreshMember(); } #endregion diff --git a/scripts/node_connection_path/node_connection_path.gml b/scripts/node_connection_path/node_connection_path.gml new file mode 100644 index 000000000..1ae41494f --- /dev/null +++ b/scripts/node_connection_path/node_connection_path.gml @@ -0,0 +1,76 @@ +function connection_get_line(jx, jy, frx, fry) { return [ [jx, jy] , [frx, fry] ]; } + +function connection_get_curve(x0, y0, x1, y1, xc = noone, yc = noone) { #region + if(xc == noone) xc = (x0 + x1) / 2; + if(yc == noone) yc = (y0 + y1) / 2; + + var pnt = array_create(sample + 1); + var sample = ceil((abs(x0 - x1) + abs(y0 - y1)) / 32 * PREFERENCES.connection_line_sample); + sample = clamp(sample, 2, 128); + + var x2 = lerp(x0, x1, 0. - sign(x1 - x0) * 0.2) - abs(y1 - y0) * 0.1; + var x3 = lerp(x0, x1, 1. + sign(x1 - x0) * 0.2) + abs(y1 - y0) * 0.1; + var y2 = y0; + var y3 = y1; + + var ox, oy, nx, ny, t, it, oc, nc; + + for( var i = 0; i <= sample; i++ ) { + t = i / sample; + it = 1 - t; + + nx = x0 * power(t, 4) + + 4 * x2 * power(it, 1) * power(t, 3) + + 6 * xc * power(it, 2) * power(t, 2) + + 4 * x3 * power(it, 3) * power(t, 1) + + x1 * power(it, 4); + + ny = y0 * power(t, 4) + + 4 * y2 * power(it, 1) * power(t, 3) + + 6 * yc * power(it, 2) * power(t, 2) + + 4 * y3 * power(it, 3) * power(t, 1) + + y1 * power(it, 4); + + pnt[i] = [ nx, ny ]; + + ox = nx; + oy = ny; + oc = nc; + } + + return pnt; +} #endregion +function connection_get_curve_down(x0, y0, x1, y1) { #region + var sample = ceil((abs(x0 - x1) + abs(y0 - y1)) / 32 * PREFERENCES.connection_line_sample); + sample = clamp(sample, 2, 128); + + var pnt = array_create(sample + 1); + var x2 = lerp(x0, x1, 0.9); + var x3 = x1; + var y2 = lerp(y0, y1, 0.1); + var y3 = y1; + + var c = draw_get_color(); + var ox, oy, nx, ny, t, it, oc, nc; + + for( var i = 0; i <= sample; i++ ) { + t = i / sample; + it = 1 - t; + + nx = x0 * power(t, 3) + + 3 * x2 * power(it, 1) * power(t, 2) + + 3 * x3 * power(it, 2) * power(t, 1) + + x1 * power(it, 3); + + ny = y0 * power(t, 3) + + 3 * y2 * power(it, 1) * power(t, 2) + + 3 * y3 * power(it, 2) * power(t, 1) + + y1 * power(it, 3); + + pnt[i] = [ nx, ny ]; + + ox = nx; + oy = ny; + oc = nc; + } +} #endregion \ No newline at end of file diff --git a/scripts/node_connection_path/node_connection_path.yy b/scripts/node_connection_path/node_connection_path.yy new file mode 100644 index 000000000..dbc388c05 --- /dev/null +++ b/scripts/node_connection_path/node_connection_path.yy @@ -0,0 +1,11 @@ +{ + "resourceType": "GMScript", + "resourceVersion": "1.0", + "name": "node_connection_path", + "isCompatibility": false, + "isDnD": false, + "parent": { + "name": "nodes", + "path": "folders/functions/nodes.yy", + }, +} \ No newline at end of file diff --git a/scripts/node_data/node_data.gml b/scripts/node_data/node_data.gml index 25856974f..f0b51d15d 100644 --- a/scripts/node_data/node_data.gml +++ b/scripts/node_data/node_data.gml @@ -69,7 +69,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x internalName = ""; onSetDisplayName = noone; renamed = false; - + tooltip = ""; x = _x; y = _y; @@ -80,6 +80,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x min_h = 0; will_setHeight = false; + selectable = true; draw_padding = 4; auto_height = true; @@ -685,8 +686,8 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x for( var i = 0, n = ds_list_size(outputs); i < n; i++ ) { var _outp = outputs[| i]; - for(var j = 0; j < ds_list_size(_outp.value_to); j++) { - var _to = _outp.value_to[| j]; + for(var j = 0; j < array_length(_outp.value_to); j++) { + var _to = _outp.value_to[j]; if(!_to.node.active || _to.value_from != _outp) continue; _to.node.passiveDynamic = true; @@ -733,8 +734,18 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x if(!_ot.forward) continue; if(_ot.type == VALUE_TYPE.node) continue; + for( var j = 0, n = array_length(_ot.value_to_loop); j < n; j++ ) { + var _to = _ot.value_to_loop[j]; + if(!_to.active) continue; + if(!_to.bypassNextNode()) continue; + + LOG_BLOCK_END(); + LOG_BLOCK_END(); + + return _to.getNextNodes(); + } + var _tos = _ot.getJunctionTo(); - for( var j = 0; j < array_length(_tos); j++ ) { var _to = _tos[j]; @@ -760,6 +771,14 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x if(!_ot.forward) continue; if(_ot.type == VALUE_TYPE.node) continue; + for( var j = 0, n = array_length(_ot.value_to_loop); j < n; j++ ) { + var _to = _ot.value_to_loop[j]; + if(!_to.active) continue; + if(!_to.bypassNextNode()) continue; + + return _to.getNextNodes(); + } + var _tos = _ot.getJunctionTo(); for( var j = 0; j < array_length(_tos); j++ ) array_push(nodes, _tos[j].node); @@ -1053,8 +1072,8 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x var jun = outputs[| i]; var connected = false; - for( var j = 0; j < ds_list_size(jun.value_to); j++ ) { - if(jun.value_to[| j].value_from == jun) + for( var j = 0; j < array_length(jun.value_to); j++ ) { + if(jun.value_to[j].value_from == jun) connected = true; } @@ -1365,8 +1384,8 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x for(var i = 0; i < ds_list_size(outputs); i++) { var jun = outputs[| i]; - for(var j = 0; j < ds_list_size(jun.value_to); j++) { - var _vt = jun.value_to[| j]; + for(var j = 0; j < array_length(jun.value_to); j++) { + var _vt = jun.value_to[j]; if(_vt.isLeaf()) break; if(_vt.value_from.node != self) break; @@ -1380,7 +1399,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x } } - ds_list_clear(jun.value_to); + jun.value_to = []; } for( var i = 0; i < ds_list_size(inputs); i++ ) @@ -1546,8 +1565,8 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x for(var i = 0; i < ds_list_size(outputs); i++) { var _ou = outputs[| i]; - for(var j = 0; j < ds_list_size(_ou.value_to); j++) { - var _to = _ou.value_to[| j]; + for(var j = 0; j < array_length(_ou.value_to); j++) { + var _to = _ou.value_to[j]; if(_to.value_from != _ou) continue; if(!_to.node.active) continue; if(_to.node.group == group) continue; diff --git a/scripts/node_dynamic_surface/node_dynamic_surface.gml b/scripts/node_dynamic_surface/node_dynamic_surface.gml index ee6473c8d..5806c9b72 100644 --- a/scripts/node_dynamic_surface/node_dynamic_surface.gml +++ b/scripts/node_dynamic_surface/node_dynamic_surface.gml @@ -95,8 +95,8 @@ function dynaSurf_output_getNextNode() { #region var junc = group.outputs[| 0]; var nodes = []; - for(var j = 0; j < ds_list_size(junc.value_to); j++) { - var _to = junc.value_to[| j]; + for(var j = 0; j < array_length(junc.value_to); j++) { + var _to = junc.value_to[j]; if(!_to.node.isRenderActive()) continue; if(!_to.node.active || _to.isLeaf()) diff --git a/scripts/node_feedback_inline/node_feedback_inline.gml b/scripts/node_feedback_inline/node_feedback_inline.gml new file mode 100644 index 000000000..a48f3fc7c --- /dev/null +++ b/scripts/node_feedback_inline/node_feedback_inline.gml @@ -0,0 +1,84 @@ +function Node_Feedback_Inline(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { + name = "Feedback"; + color = COLORS.node_blend_feedback; + icon = THEME.feedback; + + selectable = false; + update_on_frame = true; + + draw_line_feed = true; + draw_line_shift_x = 0; + draw_line_shift_y = 0; + draw_line_thick = 1; + draw_line_shift_hover = false; + + attributes.junc_in = [ "", 0 ]; + attributes.junc_out = [ "", 0 ]; + + junc_in = noone; + junc_out = noone; + + value_buffer = noone; + + static bypassConnection = function() { #region + return CURRENT_FRAME > 0; + } #endregion + + static bypassNextNode = function() { #region + return false; + } #endregion + + static getNextNode = function() { return [] }; + + static scanJunc = function() { #region + var node_in = PROJECT.nodeMap[? attributes.junc_in[0]]; + var node_out = PROJECT.nodeMap[? attributes.junc_out[0]]; + + junc_in = node_in? node_in.inputs[| attributes.junc_in[1]] : noone; + junc_out = node_out? node_out.outputs[| attributes.junc_out[1]] : noone; + + if(junc_in) junc_in.value_from_loop = self; + if(junc_out) array_push(junc_out.value_to_loop, self); + } #endregion + + static updateValue = function() { #region + var type = junc_out.type; + var val = junc_out.getValue(); + + switch(type) { + case VALUE_TYPE.surface : + surface_array_free(value_buffer); + value_buffer = surface_array_clone(val); + break; + default : + value_buffer = variable_clone(val); + break; + } + } #endregion + + static getValue = function() { #region + return [ value_buffer, junc_out ]; + } #endregion + + static drawConnections = function(params = {}) { #region + if(!active) return; + if(!junc_in || !junc_out) return; + if(!junc_in.node.active || !junc_out.node.active) return; + + if(drawJuncConnection(junc_out, junc_in, params, self)) + return self; + } #endregion + + static drawNode = function(_x, _y, _mx, _my, _s, display_parameter = noone) {} + + static pointIn = function(_x, _y, _mx, _my, _s) { return false; } + + static postDeserialize = function() { #region + scanJunc(); + } #endregion + + static onDestroy = function() { #region + if(junc_in) junc_in.value_from_loop = noone; + if(junc_out) array_remove(junc_out.value_to_loop, self); + } #endregion +} \ No newline at end of file diff --git a/scripts/node_feedback_inline/node_feedback_inline.yy b/scripts/node_feedback_inline/node_feedback_inline.yy new file mode 100644 index 000000000..1eb6d5d6a --- /dev/null +++ b/scripts/node_feedback_inline/node_feedback_inline.yy @@ -0,0 +1,11 @@ +{ + "resourceType": "GMScript", + "resourceVersion": "1.0", + "name": "node_feedback_inline", + "isCompatibility": false, + "isDnD": false, + "parent": { + "name": "feedback", + "path": "folders/nodes/data/iterate/feedback.yy", + }, +} \ No newline at end of file diff --git a/scripts/node_feedback_input/node_feedback_input.gml b/scripts/node_feedback_input/node_feedback_input.gml index 4fe45feb4..4354e93d2 100644 --- a/scripts/node_feedback_input/node_feedback_input.gml +++ b/scripts/node_feedback_input/node_feedback_input.gml @@ -1,6 +1,6 @@ function Node_Feedback_Input(_x, _y, _group = noone) : Node_Group_Input(_x, _y, _group) constructor { - name = "Feedback Input"; - color = COLORS.node_blend_feedback; + name = "Feedback Input"; + color = COLORS.node_blend_feedback; is_group_io = true; w = 96; @@ -10,8 +10,8 @@ function Node_Feedback_Input(_x, _y, _group = noone) : Node_Group_Input(_x, _y, outputs[| 0].getValueDefault = method(outputs[| 0], outputs[| 0].getValueRecursive); //Get value from outside loop outputs[| 0].getValueRecursive = function(_time) { var _node_output = noone; - for( var i = 0; i < ds_list_size(outputs[| 1].value_to); i++ ) { - var vt = outputs[| 1].value_to[| i]; + for( var i = 0; i < array_length(outputs[| 1].value_to); i++ ) { + var vt = outputs[| 1].value_to[i]; if(vt.value_from == outputs[| 1]) _node_output = vt; } diff --git a/scripts/node_gradient/node_gradient.gml b/scripts/node_gradient/node_gradient.gml index 6563690d6..62b5f5302 100644 --- a/scripts/node_gradient/node_gradient.gml +++ b/scripts/node_gradient/node_gradient.gml @@ -18,7 +18,7 @@ function Node_Gradient(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) inputs[| 0] = nodeValue("Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, DEF_SURF ) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 1] = nodeValue("Gradient", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(c_white) ); + inputs[| 1] = nodeValue("Gradient", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject([ c_black, c_white ]) ); inputs[| 2] = nodeValue("Type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Linear", "Circular", "Radial" ]); diff --git a/scripts/node_gradient_output/node_gradient_output.gml b/scripts/node_gradient_output/node_gradient_output.gml index c5458a69f..b89d54e98 100644 --- a/scripts/node_gradient_output/node_gradient_output.gml +++ b/scripts/node_gradient_output/node_gradient_output.gml @@ -2,7 +2,7 @@ function Node_Gradient_Out(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro name = "Gradient"; w = 96; - inputs[| 0] = nodeValue("Gradient", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(c_white) ); + inputs[| 0] = nodeValue("Gradient", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject([ c_black, c_white ]) ); inputs[| 1] = nodeValue("Sample", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0, "Position to sample a color from the gradient.") .setDisplay(VALUE_DISPLAY.slider) diff --git a/scripts/node_group_input/node_group_input.gml b/scripts/node_group_input/node_group_input.gml index 56c04cb6a..b6dc8ab20 100644 --- a/scripts/node_group_input/node_group_input.gml +++ b/scripts/node_group_input/node_group_input.gml @@ -164,8 +164,8 @@ function Node_Group_Input(_x, _y, _group = noone) : Node(_x, _y, _group) constru if(index == 2) { if(outputs[| 0].type != _val_type) { var _o = outputs[| 0]; - for(var j = 0; j < ds_list_size(_o.value_to); j++) { - var _to = _o.value_to[| j]; + for(var j = 0; j < array_length(_o.value_to); j++) { + var _to = _o.value_to[j]; if(_to.value_from == _o) _to.removeFrom(); } @@ -393,8 +393,8 @@ function Node_Group_Input(_x, _y, _group = noone) : Node(_x, _y, _group) constru static ungroup = function() { #region var fr = inParent.value_from; - for( var i = 0; i < ds_list_size(outputs[| 0].value_to); i++ ) { - var to = outputs[| 0].value_to[| i]; + for( var i = 0; i < array_length(outputs[| 0].value_to); i++ ) { + var to = outputs[| 0].value_to[i]; if(to.value_from != outputs[| 0]) continue; to.setFrom(fr); diff --git a/scripts/node_group_output/node_group_output.gml b/scripts/node_group_output/node_group_output.gml index 827fbddca..e582bf4be 100644 --- a/scripts/node_group_output/node_group_output.gml +++ b/scripts/node_group_output/node_group_output.gml @@ -44,13 +44,11 @@ function Node_Group_Output(_x, _y, _group = noone) : Node(_x, _y, _group) constr static getNextNodes = function() { #region if(is_undefined(outParent)) return []; - //group.setRenderStatus(true); - //printIf(global.FLAG.render, "Value to amount " + string(ds_list_size(outParent.value_to))); LOG_BLOCK_START(); var nodes = []; - for(var j = 0; j < ds_list_size(outParent.value_to); j++) { - var _to = outParent.value_to[| j]; + for(var j = 0; j < array_length(outParent.value_to); j++) { + var _to = outParent.value_to[j]; if(!_to.node.isRenderActive()) continue; //printIf(global.FLAG.render, "Value to " + _to.name); @@ -130,8 +128,8 @@ function Node_Group_Output(_x, _y, _group = noone) : Node(_x, _y, _group) constr static ungroup = function() { #region var fr = inputs[| 0].value_from; - for( var i = 0; i < ds_list_size(outParent.value_to); i++ ) { - var to = outParent.value_to[| i]; + for( var i = 0; i < array_length(outParent.value_to); i++ ) { + var to = outParent.value_to[i]; if(to.value_from != outParent) continue; to.setFrom(fr); diff --git a/scripts/node_iterate_inline/node_iterate_inline.gml b/scripts/node_iterate_inline/node_iterate_inline.gml new file mode 100644 index 000000000..7076544b5 --- /dev/null +++ b/scripts/node_iterate_inline/node_iterate_inline.gml @@ -0,0 +1,105 @@ +function Node_Iterate_Inline(_x, _y, _group = noone) : Node_Collection_Inline(_x, _y, _group) constructor { + name = "Loop"; + color = COLORS.node_blend_loop; + + inputs[| 0] = nodeValue("Repeat", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1 ) + .uncache(); + + managedRenderOrder = true; + selectable = false; + + draw_line_feed = true; + draw_line_shift_x = 0; + draw_line_shift_y = 0; + draw_line_thick = 1; + draw_line_shift_hover = false; + + attributes.junc_in = [ "", 0 ]; + attributes.junc_out = [ "", 0 ]; + + junc_in = noone; + junc_out = noone; + + value_buffer = undefined; + iterated = 0; + + static getIterationCount = function() { return getInputData(0); } + + static bypassConnection = function() { #region + return iterated > 0 && !is_undefined(value_buffer); + } #endregion + + static bypassNextNode = function() { #region + return iterated < getIterationCount(); + } #endregion + + static getNextNodes = function() { #region + LOG_BLOCK_START(); + LOG_IF(global.FLAG.render == 1, "[outputNextNode] Get next node from inline iterate"); + + resetRender(); + LOG_IF(global.FLAG.render == 1, $"Loop restart: iteration {iterated}"); + var _nodes = __nodeLeafList(nodes); + array_push_unique(_nodes, junc_in.node); + iterated++; + + LOG_BLOCK_END(); + + return _nodes; + } #endregion + + static scanJunc = function() { #region + var node_in = PROJECT.nodeMap[? attributes.junc_in[0]]; + var node_out = PROJECT.nodeMap[? attributes.junc_out[0]]; + + junc_in = node_in? node_in.inputs[| attributes.junc_in[1]] : noone; + junc_out = node_out? node_out.outputs[| attributes.junc_out[1]] : noone; + + if(junc_in) { junc_in.value_from_loop = self; addNode(junc_in.node); } + if(junc_out) { array_push(junc_out.value_to_loop, self); addNode(junc_out.node); } + } #endregion + + static updateValue = function() { #region + var type = junc_out.type; + var val = junc_out.getValue(); + + switch(type) { + case VALUE_TYPE.surface : + surface_array_free(value_buffer); + value_buffer = surface_array_clone(val); + break; + default : + value_buffer = variable_clone(val); + break; + } + } #endregion + + static getValue = function() { #region + return [ value_buffer, junc_out ]; + } #endregion + + static update = function() { #region + iteration_count = inputs[| 0].getValue(); + iterated = 0; + value_buffer = undefined; + } #endregion + + static drawConnections = function(params = {}) { #region + if(!active) return; + if(!junc_in || !junc_out) return; + if(!junc_in.node.active || !junc_out.node.active) return; + + if(drawJuncConnection(junc_out, junc_in, params, self)) + return self; + } #endregion + + static postDeserialize = function() { #region + refreshMember(); + scanJunc(); + } #endregion + + static onDestroy = function() { #region + if(junc_in) junc_in.value_from_loop = noone; + if(junc_out) array_remove(junc_out.value_to_loop, self); + } #endregion +} \ No newline at end of file diff --git a/scripts/node_iterate_inline/node_iterate_inline.yy b/scripts/node_iterate_inline/node_iterate_inline.yy new file mode 100644 index 000000000..2504118ac --- /dev/null +++ b/scripts/node_iterate_inline/node_iterate_inline.yy @@ -0,0 +1,11 @@ +{ + "resourceType": "GMScript", + "resourceVersion": "1.0", + "name": "node_iterate_inline", + "isCompatibility": false, + "isDnD": false, + "parent": { + "name": "for", + "path": "folders/nodes/data/iterate/for.yy", + }, +} \ No newline at end of file diff --git a/scripts/node_iterator_index/node_iterator_index.gml b/scripts/node_iterator_index/node_iterator_index.gml index 170dd2789..44b86279c 100644 --- a/scripts/node_iterator_index/node_iterator_index.gml +++ b/scripts/node_iterator_index/node_iterator_index.gml @@ -8,17 +8,18 @@ function Node_Iterator_Index(_x, _y, _group = noone) : Node(_x, _y, _group) cons outputs[| 0] = nodeValue("Loop index", self, JUNCTION_CONNECT.output, VALUE_TYPE.integer, 0); - static update = function(frame = CURRENT_FRAME) { - if(!variable_struct_exists(group, "iterated")) return; - outputs[| 0].setValue(group.iterated); - } + static update = function(frame = CURRENT_FRAME) { #region + var gr = is_instanceof(group, Node_Iterator)? group : noone; + for( var i = 0, n = array_length(context_data); i < n; i++ ) + if(is_instanceof(context_data[i], Node_Iterate_Inline)) + gr = context_data[i]; + + if(gr == noone) return; + outputs[| 0].setValue(gr.iterated); + } #endregion - static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { + static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region var bbox = drawGetBbox(xx, yy, _s); draw_sprite_fit(s_node_iterator_index, 0, bbox.xc, bbox.yc, bbox.w, bbox.h); - } - - static onLoadGroup = function() { #region - if(group == noone) nodeDelete(self); } #endregion } \ No newline at end of file diff --git a/scripts/node_iterator_length/node_iterator_length.gml b/scripts/node_iterator_length/node_iterator_length.gml index 35515059c..f6b5669de 100644 --- a/scripts/node_iterator_length/node_iterator_length.gml +++ b/scripts/node_iterator_length/node_iterator_length.gml @@ -8,18 +8,18 @@ function Node_Iterator_Length(_x, _y, _group = noone) : Node(_x, _y, _group) con outputs[| 0] = nodeValue("Length", self, JUNCTION_CONNECT.output, VALUE_TYPE.integer, 0); - static update = function(frame = CURRENT_FRAME) { - if(!variable_struct_exists(group, "iterated")) return; - var val = group.getInputData(0); - outputs[| 0].setValue(val); - } + static update = function(frame = CURRENT_FRAME) { #region + var gr = is_instanceof(group, Node_Iterator)? group : noone; + for( var i = 0, n = array_length(context_data); i < n; i++ ) + if(is_instanceof(context_data[i], Node_Iterate_Inline)) + gr = context_data[i]; + + if(gr == noone) return; + outputs[| 0].setValue(gr.getIterationCount()); + } #endregion - static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { + static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region var bbox = drawGetBbox(xx, yy, _s); draw_sprite_fit(s_node_iterator_length, 0, bbox.xc, bbox.yc, bbox.w, bbox.h); - } - - static onLoadGroup = function() { #region - if(group == noone) nodeDelete(self); } #endregion } \ No newline at end of file diff --git a/scripts/node_lua_compute/node_lua_compute.gml b/scripts/node_lua_compute/node_lua_compute.gml index 3e66cff46..a175f5b82 100644 --- a/scripts/node_lua_compute/node_lua_compute.gml +++ b/scripts/node_lua_compute/node_lua_compute.gml @@ -134,8 +134,8 @@ function Node_Lua_Compute(_x, _y, _group = noone) : Node(_x, _y, _group) constru if(index == 0 || index == 2) compiled = false; if(index == 3) { - for( var i = 0; i < ds_list_size(outputs[| 0].value_to); i++ ) { - var _j = outputs[| 0].value_to[| i]; + for( var i = 0; i < array_length(outputs[| 0].value_to); i++ ) { + var _j = outputs[| 0].value_to[i]; if(_j.value_from != outputs[| 0]) continue; _j.node.compiled = false; } @@ -219,8 +219,8 @@ function Node_Lua_Compute(_x, _y, _group = noone) : Node(_x, _y, _group) constru compiled = true; addCode(); - for( var i = 0; i < ds_list_size(outputs[| 0].value_to); i++ ) { - var _j = outputs[| 0].value_to[| i]; + for( var i = 0; i < array_length(outputs[| 0].value_to); i++ ) { + var _j = outputs[| 0].value_to[i]; if(_j.value_from != outputs[| 0]) continue; _j.node.doCompile(); } diff --git a/scripts/node_lua_global/node_lua_global.gml b/scripts/node_lua_global/node_lua_global.gml index b45cea8b0..dee576e65 100644 --- a/scripts/node_lua_global/node_lua_global.gml +++ b/scripts/node_lua_global/node_lua_global.gml @@ -91,8 +91,8 @@ function Node_Lua_Global(_x, _y, _group = noone) : Node(_x, _y, _group) construc static doCompile = function() { #region compiled = true; - for( var i = 0; i < ds_list_size(outputs[| 0].value_to); i++ ) { - var _j = outputs[| 0].value_to[| i]; + for( var i = 0; i < array_length(outputs[| 0].value_to); i++ ) { + var _j = outputs[| 0].value_to[i]; if(_j.value_from != outputs[| 0]) continue; _j.node.doCompile(); } diff --git a/scripts/node_lua_surface/node_lua_surface.gml b/scripts/node_lua_surface/node_lua_surface.gml index 26cf6d15d..8b0934f51 100644 --- a/scripts/node_lua_surface/node_lua_surface.gml +++ b/scripts/node_lua_surface/node_lua_surface.gml @@ -129,8 +129,8 @@ function Node_Lua_Surface(_x, _y, _group = noone) : Node(_x, _y, _group) constru if(index == 0 || index == 2) compiled = false; if(index == 3) { - for( var i = 0; i < ds_list_size(outputs[| 0].value_to); i++ ) { - var _j = outputs[| 0].value_to[| i]; + for( var i = 0; i < array_length(outputs[| 0].value_to); i++ ) { + var _j = outputs[| 0].value_to[i]; if(_j.value_from != outputs[| 0]) continue; _j.node.compiled = false; } @@ -222,8 +222,8 @@ function Node_Lua_Surface(_x, _y, _group = noone) : Node(_x, _y, _group) constru addCode(); compiled = true; - for( var i = 0; i < ds_list_size(outputs[| 0].value_to); i++ ) { - var _j = outputs[| 0].value_to[| i]; + for( var i = 0; i < array_length(outputs[| 0].value_to); i++ ) { + var _j = outputs[| 0].value_to[i]; if(_j.value_from != outputs[| 0]) continue; _j.node.doCompile(); } diff --git a/scripts/node_registry/node_registry.gml b/scripts/node_registry/node_registry.gml index d0d94b4fd..56b687b52 100644 --- a/scripts/node_registry/node_registry.gml +++ b/scripts/node_registry/node_registry.gml @@ -270,6 +270,13 @@ function __initNodes() { addNodeObject(iter, "Loop amount", s_node_iterator_amount, "Node_Iterator_Length", [1, Node_Iterator_Length]).hideRecent(); #endregion + var iter_il = ds_list_create(); #region + addNodeCatagory("Loop", iter_il, ["Node_Iterate_Inline"]); + ds_list_add(iter_il, "Loops"); + addNodeObject(iter_il, "Index", s_node_iterator_index, "Node_Iterator_Index", [1, Node_Iterator_Index]).hideRecent(); + addNodeObject(iter_il, "Loop amount", s_node_iterator_amount, "Node_Iterator_Length", [1, Node_Iterator_Length]).hideRecent(); + #endregion + var itere = ds_list_create(); #region addNodeCatagory("Loop", itere, ["Node_Iterate_Each"]); ds_list_add(itere, "Groups"); @@ -994,8 +1001,10 @@ function __initNodes() { addNodeObject(hid, "Onion Skin", s_node_cache, "Node_Onion_Skin", [1, Node_Onion_Skin]).setVersion(1147).hideRecent(); addNodeObject(hid, "RigidSim", s_node_rigidSim, "Node_Rigid_Group", [1, Node_Rigid_Group],, "Create group for rigidbody simulation.").setVersion(1110).hideRecent(); addNodeObject(hid, "RigidSim Global", s_node_rigidSim_global, "Node_Rigid_Global", [1, Node_Rigid_Global]).setVersion(1110).hideRecent(); - addNodeObject(hid, "SmokeSim", s_node_smokeSim_group, "Node_Fluid_Group", [1, Node_Fluid_Group],, "Create group for fluid simulation.").setVersion(1120).hideRecent(); - addNodeObject(hid, "StrandSim", s_node_strandSim, "Node_Strand_Group", [1, Node_Strand_Group], ["Hair"], "Create group for hair simulation.").setVersion(1140).hideRecent(); + addNodeObject(hid, "SmokeSim", s_node_smokeSim_group, "Node_Fluid_Group", [1, Node_Fluid_Group],, "Create group for fluid simulation.").setVersion(1120).hideRecent(); + addNodeObject(hid, "StrandSim", s_node_strandSim, "Node_Strand_Group", [1, Node_Strand_Group], ["Hair"], "Create group for hair simulation.").setVersion(1140).hideRecent(); + addNodeObject(hid, "Feedback", s_node_feedback, "Node_Feedback_Inline", [1, Node_Feedback_Inline]).hideRecent(); + addNodeObject(hid, "Loop", s_node_loop, "Node_Iterate_Inline", [1, Node_Iterate_Inline]).hideRecent(); ds_list_add(hid, "DynaSurf"); addNodeObject(hid, "Input", s_node_pixel_builder, "Node_DynaSurf_In", [1, Node_DynaSurf_In]).hideRecent(); diff --git a/scripts/node_rigid_object/node_rigid_object.gml b/scripts/node_rigid_object/node_rigid_object.gml index c4df4c2d1..342d1a6e8 100644 --- a/scripts/node_rigid_object/node_rigid_object.gml +++ b/scripts/node_rigid_object/node_rigid_object.gml @@ -78,13 +78,15 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr } newMesh(0); - tools = [ + tools = []; + + mesh_tools = [ new NodeTool( "Mesh edit", THEME.mesh_tool_edit ), new NodeTool( "Anchor remove", THEME.mesh_tool_delete ), ]; is_convex = true; - hover = -1; + hover = -1; anchor_dragging = -1; anchor_drag_sx = -1; anchor_drag_sy = -1; @@ -159,13 +161,21 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr drawOverlayPreviewSingle(i, _x, _y, _s, _pr_x, _pr_y, _tex[i]); } else drawOverlayPreviewSingle(0, _x, _y, _s, _pr_x, _pr_y, _tex); + return inputs[| 7].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny); } #endregion static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { #region - if(previewing == 0 && is_instanceof(group, Node_Rigid_Group)) { - for( var i = 0, n = ds_list_size(group.nodes); i < n; i++ ) { - var _node = group.nodes[| i]; + var gr = is_instanceof(group, Node_Rigid_Group)? group : noone; + for( var i = 0, n = array_length(context_data); i < n; i++ ) + if(is_instanceof(context_data[i], Node_Rigid_Group_Inline)) + gr = context_data[i]; + + if(gr == noone) return; + + if(previewing == 0) { + for( var i = 0, n = ds_list_size(gr.nodes); i < n; i++ ) { + var _node = gr.nodes[| i]; if(!is_instanceof(_node, Node_Rigid_Object)) continue; var _hov = _node.drawOverlayPreview(active, _x, _y, _s, _mx, _my, _snx, _sny); active &= _hov; @@ -658,7 +668,7 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr } #endregion static update = function(frame = CURRENT_FRAME) { #region - // + if(frame == 0) reset(); } #endregion static step = function() { #region @@ -668,6 +678,8 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr inputs[| 10].setVisible(_shp == 2); inputs[| 11].setVisible(_shp == 2); + tools = _shp == 2? mesh_tools : -1; + var _tex = getInputData(6); if(is_array(_tex)) { diff --git a/scripts/node_rigid_render/node_rigid_render.gml b/scripts/node_rigid_render/node_rigid_render.gml index 8fe0afe78..4f33c582d 100644 --- a/scripts/node_rigid_render/node_rigid_render.gml +++ b/scripts/node_rigid_render/node_rigid_render.gml @@ -62,11 +62,16 @@ function Node_Rigid_Render(_x, _y, _group = noone) : Node(_x, _y, _group) constr } #endregion static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { #region - if(!is_instanceof(group, Node_Rigid_Group)) return; + var gr = is_instanceof(group, Node_Rigid_Group)? group : noone; + for( var i = 0, n = array_length(context_data); i < n; i++ ) + if(is_instanceof(context_data[i], Node_Rigid_Group_Inline)) + gr = context_data[i]; + + if(gr == noone) return; if(!attributes.show_objects) return; - for( var i = 0, n = ds_list_size(group.nodes); i < n; i++ ) { - var _node = group.nodes[| i]; + for( var i = 0, n = ds_list_size(gr.nodes); i < n; i++ ) { + var _node = gr.nodes[| i]; if(!is_instanceof(_node, Node_Rigid_Object)) continue; var _hov = _node.drawOverlayPreview(active, _x, _y, _s, _mx, _my, _snx, _sny); active &= !_hov; @@ -112,6 +117,7 @@ function Node_Rigid_Render(_x, _y, _group = noone) : Node(_x, _y, _group) constr for( var k = 0; k < array_length(obj); k++ ) { var _o = obj[k]; + if(_o == noone || !instance_exists(_o)) continue; if(is_undefined(_o.phy_active)) continue; @@ -122,12 +128,6 @@ function Node_Rigid_Render(_x, _y, _group = noone) : Node(_x, _y, _group) constr var yy = _rnd? round(_o.phy_position_y) : _o.phy_position_y; draw_surface_ext_safe(_o.surface, xx, yy, ixs, iys, _o.image_angle, _o.image_blend, _o.image_alpha); - - //draw_set_color(c_red); - //draw_circle(_o.phy_com_x, _o.phy_com_y, 2, false); - - //draw_set_color(c_blue); - //draw_circle(_o.phy_position_x, _o.phy_position_y, 2, false); } } } diff --git a/scripts/node_rigid_render_output/node_rigid_render_output.gml b/scripts/node_rigid_render_output/node_rigid_render_output.gml index 200eb3323..86fcf43a8 100644 --- a/scripts/node_rigid_render_output/node_rigid_render_output.gml +++ b/scripts/node_rigid_render_output/node_rigid_render_output.gml @@ -80,11 +80,16 @@ function Node_Rigid_Render_Output(_x, _y, _group = noone) : Node_Group_Output(_x } #endregion static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { #region - if(!is_instanceof(group, Node_Rigid_Group)) return; + var gr = is_instanceof(group, Node_Rigid_Group)? group : noone; + for( var i = 0, n = array_length(context_data); i < n; i++ ) + if(is_instanceof(context_data[i], Node_Rigid_Group_Inline)) + gr = context_data[i]; + + if(gr == noone) return; if(!attributes.show_objects) return; - for( var i = 0, n = ds_list_size(group.nodes); i < n; i++ ) { - var _node = group.nodes[| i]; + for( var i = 0, n = ds_list_size(gr.nodes); i < n; i++ ) { + var _node = gr.nodes[| i]; if(!is_instanceof(_node, Node_Rigid_Object)) continue; var _hov = _node.drawOverlayPreview(active, _x, _y, _s, _mx, _my, _snx, _sny); active &= !_hov; diff --git a/scripts/node_value/node_value.gml b/scripts/node_value/node_value.gml index 57a5352d4..5b64a753b 100644 --- a/scripts/node_value/node_value.gml +++ b/scripts/node_value/node_value.gml @@ -542,10 +542,13 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru #endregion #region ---- connection ---- - connect_type = _connect; - value_from = noone; - value_to = ds_list_create(); - value_to_arr = []; + connect_type = _connect; + value_from = noone; + value_from_loop = noone; + + value_to = []; + value_to_loop = []; + accept_array = true; array_depth = 0; auto_connect = true; @@ -1630,7 +1633,9 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru if(type == VALUE_TYPE.trigger && connect_type == JUNCTION_CONNECT.output) //trigger event will not propagate from input to output, need to be done manually return val; - if(value_from && value_from != self) + if(value_from_loop && value_from_loop.bypassConnection() && value_from_loop.junc_out) + val = value_from_loop.getValue(_time); + else if(value_from && value_from != self) val = value_from.getValueRecursive(_time); if(expUse && is_struct(expTree) && expTree.validate()) { @@ -1710,6 +1715,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru static isActiveDynamic = function(frame = CURRENT_FRAME) { #region INLINE + if(value_from_loop) return true; if(value_from != noone) return false; if(expUse) { @@ -1845,6 +1851,9 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru if(type == VALUE_TYPE.gradient) updated = true; if(display_type == VALUE_DISPLAY.palette) updated = true; + for( var i = 0, n = array_length(value_to_loop); i < n; i++ ) + value_to_loop[i].updateValue(); + if(!updated) return false; if(value_tag == "dimension" && struct_try_get(node.attributes, "use_project_dimension")) @@ -1890,59 +1899,51 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru static isConnectable = function(_valueFrom, checkRecur = true, log = false) { #region if(_valueFrom == -1 || _valueFrom == undefined || _valueFrom == noone) { - if(log) - noti_warning("LOAD: Cannot set node connection from " + string(_valueFrom) + " to " + string(name) + " of node " + string(node.name) + ".",, node); - return false; + if(log) noti_warning($"LOAD: Cannot set node connection from {_valueFrom} to {name} of node {node.name}.",, node); + return -1; } if(_valueFrom == value_from) { - print("whaT"); - return false; + if(log) noti_warning("whaT"); + return -1; } if(_valueFrom == self) { - if(log) - noti_warning("setFrom: Self connection is not allowed.",, node); - return false; + if(log) noti_warning("setFrom: Self connection is not allowed.",, node); + return -1; } if(!typeCompatible(_valueFrom.type, type)) { - if(log) - noti_warning($"setFrom: Type mismatch {_valueFrom.type} to {type}",, node); - return false; + if(log) noti_warning($"setFrom: Type mismatch {_valueFrom.type} to {type}",, node); + return -1; } if(typeIncompatible(_valueFrom, self)) { - if(log) - noti_warning("setFrom: Type mismatch",, node); - return false; + if(log) noti_warning("setFrom: Type mismatch",, node); + return -1; } if(connect_type == _valueFrom.connect_type) { - if(log) - noti_warning("setFrom: Connect type mismatch",, node); - return false; + if(log) noti_warning("setFrom: Connect type mismatch",, node); + return -1; } if(checkRecur && _valueFrom.searchNodeBackward(node)) { - if(log) - noti_warning("setFrom: Cyclic connection not allowed.",, node); - return false; + if(log) noti_warning("setFrom: Cyclic connection not allowed.",, node); + return -9; } if(!accept_array && isArray(_valueFrom.getValue())) { - if(log) - noti_warning("setFrom: Array mismatch",, node); - return false; + if(log) noti_warning("setFrom: Array mismatch",, node); + return -1; } if(!accept_array && _valueFrom.type == VALUE_TYPE.surface && (type == VALUE_TYPE.integer || type == VALUE_TYPE.float)) { - if(log) - noti_warning("setFrom: Array mismatch",, node); - return false; + if(log) noti_warning("setFrom: Array mismatch",, node); + return -1; } - return true; + return 1; } #endregion static isLeaf = function() { INLINE return value_from == noone; } @@ -1965,20 +1966,19 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru if(_valueFrom == noone) return removeFrom(); - if(!isConnectable(_valueFrom, checkRecur, log)) - return -1; + var conn = isConnectable(_valueFrom, checkRecur, log); + if(conn < 0) return conn; if(setFrom_condition != -1 && !setFrom_condition(_valueFrom)) return -2; if(value_from != noone) - ds_list_remove(value_from.value_to, self); + array_remove(value_from.value_to, self); var _o = animator.getValue(); recordAction(ACTION_TYPE.junction_connect, self, value_from); value_from = _valueFrom; - ds_list_add(_valueFrom.value_to, self); - //show_debug_message("connected " + name + " to " + _valueFrom.name) + array_push(_valueFrom.value_to, self); node.valueUpdate(index, _o); if(_update && connect_type == JUNCTION_CONNECT.input) { @@ -2009,7 +2009,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru static removeFrom = function(_remove_list = true) { #region recordAction(ACTION_TYPE.junction_disconnect, self, value_from); if(_remove_list && value_from != noone) - ds_list_remove(value_from.value_to, self); + array_remove(value_from.value_to, self); value_from = noone; if(connect_type == JUNCTION_CONNECT.input) @@ -2017,11 +2017,18 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru node.clearCacheForward(); PROJECT.modified = true; - + RENDER_ALL_REORDER return false; } #endregion + static removeFromLoop = function(_remove_list = true) { #region + if(value_from_loop != noone) + nodeDelete(value_from_loop); + + PROJECT.modified = true; + } #endregion + static getShowString = function() { #region var val = showValue(); return string_real(val); @@ -2197,163 +2204,11 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru } #endregion static drawConnections = function(params = {}) { #region - var log = struct_try_get(params, "log", false); - var high = struct_try_get(params, "highlight", 0); - var bg = struct_try_get(params, "bg", c_black); - if(isLeaf()) return noone; if(!value_from.node.active) return noone; if(!isVisible()) return noone; - var _x = params.x; - var _y = params.y; - var _s = params.s; - var mx = params.mx; - var my = params.my; - var _active = params.active; - var cur_layer = params.cur_layer; - var max_layer = params.max_layer; - - var aa = struct_try_get(params, "aa", 1); - - var hovering = noone; - var jx = x; - var jy = y; - - var frx = value_from.x; - var fry = value_from.y; - - if(struct_has(params, "minx")) { - var minx = params.minx; - var miny = params.miny; - var maxx = params.maxx; - var maxy = params.maxy; - - if(jx < minx && frx < minx) return noone; - if(jx > maxx && frx > maxx) return noone; - - if(jy < miny && fry < miny) return noone; - if(jy > maxy && fry > maxy) return noone; - } - - var shx = draw_line_shift_x * _s; - var shy = draw_line_shift_y * _s; - - var cx = round((frx + jx) / 2 + shx); - var cy = round((fry + jy) / 2 + shy); - - var hover = false; - var th = max(1, PREFERENCES.connection_line_width * _s); - draw_line_shift_hover = false; - - var downDirection = type == VALUE_TYPE.action || value_from.type == VALUE_TYPE.action; - - if(PANEL_GRAPH.pHOVER) - switch(PREFERENCES.curve_connection_line) { - case 0 : - hover = distance_to_line(mx, my, jx, jy, frx, fry) < max(th * 2, 6); - break; - case 1 : - if(downDirection) - hover = distance_to_curve_corner(mx, my, jx, jy, frx, fry, _s) < max(th * 2, 6); - else - hover = distance_to_curve(mx, my, jx, jy, frx, fry, cx, cy, _s) < max(th * 2, 6); - - if(PANEL_GRAPH.value_focus == noone) - draw_line_shift_hover = hover; - break; - case 2 : - if(downDirection) - hover = distance_to_elbow_corner(mx, my, frx, fry, jx, jy) < max(th * 2, 6); - else - hover = distance_to_elbow(mx, my, frx, fry, jx, jy, cx, cy, _s, value_from.drawLineIndex, drawLineIndex) < max(th * 2, 6); - - if(PANEL_GRAPH.value_focus == noone) - draw_line_shift_hover = hover; - break; - case 3 : - if(downDirection) - hover = distance_to_elbow_diag_corner(mx, my, frx, fry, jx, jy) < max(th * 2, 6); - else - hover = distance_to_elbow_diag(mx, my, frx, fry, jx, jy, cx, cy, _s, value_from.drawLineIndex, drawLineIndex) < max(th * 2, 6); - - if(PANEL_GRAPH.value_focus == noone) - draw_line_shift_hover = hover; - break; - } - - if(_active && hover) - hovering = self; - - var thicken = false; - thicken |= PANEL_GRAPH.nodes_junction_d == self; - thicken |= _active && PANEL_GRAPH.junction_hovering == self && PANEL_GRAPH.value_focus == noone; - thicken |= instance_exists(o_dialog_add_node) && o_dialog_add_node.junction_hovering == self; - - th *= thicken? 2 : 1; - - var corner = PREFERENCES.connection_line_corner * _s; - var ty = LINE_STYLE.solid; - if(type == VALUE_TYPE.node) - ty = LINE_STYLE.dashed; - - var c0, c1; - var _selc = node.branch_drawing && value_from.node.branch_drawing; - - if(high) { - var _fade = PREFERENCES.connection_line_highlight_fade; - var _colr = _selc? 1 : _fade; - - c0 = merge_color(bg, value_from.color_display, _colr); - c1 = merge_color(bg, color_display, _colr); - - draw_blend_color = bg; - draw_blend = _colr; - value_from.draw_blend = max(value_from.draw_blend, _colr); - } else { - c0 = value_from.color_display; - c1 = color_display; - - draw_blend_color = bg; - draw_blend = -1; - } - - var ss = _s * aa; - jx *= aa; - jy *= aa; - frx *= aa; - fry *= aa; - th *= aa; - cx *= aa; - cy *= aa; - corner *= aa; - th = max(1, round(th)); - - draw_set_color(c0); - - var fromIndex = value_from.drawLineIndex; - var toIndex = drawLineIndex; - - switch(PREFERENCES.curve_connection_line) { - case 0 : - if(ty == LINE_STYLE.solid) draw_line_width_color(jx, jy, frx, fry, th, c1, c0); - else draw_line_dashed_color(jx, jy, frx, fry, th, c1, c0, 12 * ss); - break; - case 1 : - if(downDirection) draw_line_curve_corner(jx, jy, frx, fry, ss, th, c0, c1); - else draw_line_curve_color(jx, jy, frx, fry, cx, cy, ss, th, c0, c1, ty); - break; - case 2 : - if(downDirection) draw_line_elbow_corner(frx, fry, jx, jy, ss, th, c0, c1, corner, fromIndex, toIndex, ty); - else draw_line_elbow_color(frx, fry, jx, jy, cx, cy, ss, th, c0, c1, corner, fromIndex, toIndex, ty); - break; - case 3 : - if(downDirection) draw_line_elbow_diag_corner(frx, fry, jx, jy, ss, th, c0, c1, corner, fromIndex, toIndex, ty); - else draw_line_elbow_diag_color(frx, fry, jx, jy, cx, cy, ss, th, c0, c1, corner, fromIndex, toIndex, ty); - break; - } - - return hovering; + return drawJuncConnection(value_from, self, params); } #endregion static drawConnectionMouse = function(params, _mx, _my, target) { #region @@ -2420,7 +2275,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru if(!node.active) return false; if(connect_type == JUNCTION_CONNECT.output) - return visible || !ds_list_empty(value_to); + return visible || !array_empty(value_to); if(value_from) return true; if(!visible) return false; @@ -2486,17 +2341,17 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru static hasJunctionFrom = function() { INLINE return value_from != noone; } static getJunctionTo = function() { #region - var to = []; + var _junc_to = []; - for(var j = 0; j < ds_list_size(value_to); j++) { - var _to = value_to[| j]; + for(var i = 0; i < array_length(value_to); i++) { + var _to = value_to[i]; if(!_to.node.active || _to.isLeaf()) continue; if(_to.value_from != self) continue; - array_push(to, _to); + array_push(_junc_to, _to); } - - return to; + + return _junc_to; } #endregion static dragValue = function() { #region @@ -2664,8 +2519,174 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru } #endregion static cleanUp = function() { #region - ds_list_destroy(value_to); animator.cleanUp(); delete animator; } #endregion -} \ No newline at end of file +} + +function drawJuncConnection(from, to, params, target = to) { #region + #region parameters + var log = struct_try_get(params, "log", false); + var high = struct_try_get(params, "highlight", 0); + var bg = struct_try_get(params, "bg", c_black); + var aa = struct_try_get(params, "aa", 1); + var feed = struct_try_get(target, "draw_line_feed", false); + + var _x = params.x; + var _y = params.y; + var _s = params.s; + var mx = params.mx; + var my = params.my; + var _active = params.active; + var cur_layer = params.cur_layer; + var max_layer = params.max_layer; + + var hovering = noone; + + var jx = to.x; + var jy = to.y; + + var frx = from.x; + var fry = from.y; + + var fromIndex = from.drawLineIndex; + var toIndex = to.drawLineIndex; + + if(struct_has(params, "minx")) { + var minx = params.minx; + var miny = params.miny; + var maxx = params.maxx; + var maxy = params.maxy; + + if(jx < minx && frx < minx) return noone; + if(jx > maxx && frx > maxx) return noone; + + if(jy < miny && fry < miny) return noone; + if(jy > maxy && fry > maxy) return noone; + } + + var shx = target.draw_line_shift_x * _s; + var shy = target.draw_line_shift_y * _s; + + var cx = round((frx + jx) / 2 + shx); + var cy = round((fry + jy) / 2 + shy); + + var hover = false; + var th = max(1, PREFERENCES.connection_line_width * _s); + target.draw_line_shift_hover = false; + + var downDirection = to.type == VALUE_TYPE.action || from.type == VALUE_TYPE.action; + #endregion + + #region +++++ CHECK HOVER +++++ + var hovDist = max(th * 2, 6); + + if(PANEL_GRAPH.pHOVER) + switch(PREFERENCES.curve_connection_line) { + case 0 : + hover = distance_to_line(mx, my, jx, jy, frx, fry) < max(th * 2, 6); + break; + case 1 : + if(downDirection) hover = distance_to_curve_corner(mx, my, jx, jy, frx, fry, _s) < hovDist; + else hover = distance_to_curve(mx, my, jx, jy, frx, fry, cx, cy, _s) < hovDist; + + if(PANEL_GRAPH.value_focus == noone) + target.draw_line_shift_hover = hover; + break; + case 2 : + if(downDirection) hover = distance_to_elbow_corner(mx, my, frx, fry, jx, jy) < hovDist; + else hover = distance_to_elbow(mx, my, frx, fry, jx, jy, cx, cy, _s, fromIndex, toIndex) < hovDist; + + if(PANEL_GRAPH.value_focus == noone) + target.draw_line_shift_hover = hover; + break; + case 3 : + if(downDirection) hover = distance_to_elbow_diag_corner(mx, my, frx, fry, jx, jy) < hovDist; + else hover = distance_to_elbow_diag(mx, my, frx, fry, jx, jy, cx, cy, _s, fromIndex, toIndex) < hovDist; + + if(PANEL_GRAPH.value_focus == noone) + target.draw_line_shift_hover = hover; + break; + } + + if(_active && hover) + hovering = self; + #endregion + + #region draw parameters + var thicken = false; + thicken |= PANEL_GRAPH.nodes_junction_d == self; + thicken |= _active && PANEL_GRAPH.junction_hovering == self && PANEL_GRAPH.value_focus == noone; + thicken |= instance_exists(o_dialog_add_node) && o_dialog_add_node.junction_hovering == self; + + th *= thicken? 2 : 1; + + var corner = PREFERENCES.connection_line_corner * _s; + + var ty = LINE_STYLE.solid; + if(to.type == VALUE_TYPE.node) + ty = LINE_STYLE.dashed; + + if(feed) { + ty = LINE_STYLE.dashed; + th /= 2; + } + + var c0, c1; + var _selc = to.node.branch_drawing && from.node.branch_drawing; + + if(high) { + var _fade = PREFERENCES.connection_line_highlight_fade; + var _colr = _selc? 1 : _fade; + + c0 = merge_color(bg, from.color_display, _colr); + c1 = merge_color(bg, to.color_display, _colr); + + to.draw_blend_color = bg; + to.draw_blend = _colr; + from.draw_blend = max(from.draw_blend, _colr); + } else { + c0 = from.color_display; + c1 = to.color_display; + + to.draw_blend_color = bg; + to.draw_blend = -1; + } + #endregion + + #region +++++ DRAW LINE +++++ + var ss = _s * aa; + jx *= aa; + jy *= aa; + frx *= aa; + fry *= aa; + th *= aa; + cx *= aa; + cy *= aa; + corner *= aa; + th = max(1, round(th)); + + draw_set_color(c0); + + switch(PREFERENCES.curve_connection_line) { + case 0 : + if(ty == LINE_STYLE.solid) draw_line_width_color(jx, jy, frx, fry, th, c1, c0); + else draw_line_dashed_color(jx, jy, frx, fry, th, c1, c0, 6 * ss); + break; + case 1 : + if(downDirection) draw_line_curve_corner(jx, jy, frx, fry, ss, th, c0, c1); + else draw_line_curve_color(jx, jy, frx, fry, cx, cy, ss, th, c0, c1, ty); + break; + case 2 : + if(downDirection) draw_line_elbow_corner(frx, fry, jx, jy, ss, th, c0, c1, corner, fromIndex, toIndex, ty); + else draw_line_elbow_color(frx, fry, jx, jy, cx, cy, ss, th, c0, c1, corner, fromIndex, toIndex, ty); + break; + case 3 : + if(downDirection) draw_line_elbow_diag_corner(frx, fry, jx, jy, ss, th, c0, c1, corner, fromIndex, toIndex, ty); + else draw_line_elbow_diag_color(frx, fry, jx, jy, cx, cy, ss, th, c0, c1, corner, fromIndex, toIndex, ty); + break; + } + #endregion + + return hovering; +} #endregion \ No newline at end of file diff --git a/scripts/panel_graph/panel_graph.gml b/scripts/panel_graph/panel_graph.gml index 5910c0132..3b2e4fa0c 100644 --- a/scripts/panel_graph/panel_graph.gml +++ b/scripts/panel_graph/panel_graph.gml @@ -87,10 +87,11 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { node_hovering = noone; node_hover = noone; - junction_hovering = noone; - add_node_draw_junc = false; - add_node_draw_x_fix = 0; - add_node_draw_y_fix = 0; + junction_hovering = noone; + junction_hover_direct = noone; + add_node_draw_junc = false; + add_node_draw_x_fix = 0; + add_node_draw_y_fix = 0; add_node_draw_x = 0; add_node_draw_y = 0; @@ -770,7 +771,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { #endregion printIf(log, $"Hover time: {get_timer() - t}"); t = get_timer(); - #region selection + #region interaction if(mouse_on_graph && pHOVER) { #region select if(NODE_DROPPER_TARGET != noone && node_hovering) { @@ -801,11 +802,13 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { var fy1 = fy0 + node_hovering.h * graph_s; nodes_selecting = [ node_hovering ]; - + if(!key_mod_press(CTRL)) for(var i = 0; i < ds_list_size(nodes_list); i++) { //select content var _node = nodes_list[| i]; if(is_instanceof(_node, Node_Frame)) continue; + if(!_node.selectable) continue; + var _x = (_node.x + graph_x) * graph_s; var _y = (_node.y + graph_y) * graph_s; var _w = _node.w * graph_s; @@ -840,7 +843,56 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { if(mouse_press(mb_right, pFOCUS)) { #region node_hover = node_hovering; - if(node_hover && node_hover.draggable) { + if(value_focus) { + __junction_hovering = value_focus; + + var menu = [ menu_junc_color ]; + + if(value_focus.connect_type == JUNCTION_CONNECT.output) { + var sep = false; + + for( var i = 0, n = array_length(value_focus.value_to); i < n; i++ ) { + if(!sep) { array_push(menu, -1); sep = true; } + + var _to = value_focus.value_to[i]; + array_push(menu, menuItem($"[{_to.node.display_name}] {_to.getName()}", function(data) { + data.params.juncTo.removeFrom(); + }, THEME.cross,,, { juncTo: _to })); + } + + for( var i = 0, n = array_length(value_focus.value_to_loop); i < n; i++ ) { + if(!sep) { array_push(menu, -1); sep = true; } + + var _to = value_focus.value_to_loop[i]; + array_push(menu, menuItem($"[{_to.junc_in.node.display_name}] {_to.junc_in.getName()}", function(data) { + nodeDelete(data.params.juncTo); + }, THEME.feedback,,, { juncTo: _to })); + } + } else { + var sep = false; + + if(value_focus.value_from) { + if(!sep) { array_push(menu, -1); sep = true; } + + var _jun = value_focus.value_from; + array_push(menu, menuItem($"[{_jun.node.display_name}] {_jun.getName()}", function(data) { + __junction_hovering.removeFrom(); + }, THEME.cross)); + } + + if(value_focus.value_from_loop) { + if(!sep) { array_push(menu, -1); sep = true; } + + var _jun = value_focus.value_from_loop.junc_out; + array_push(menu, menuItem($"[{_jun.node.display_name}] {_jun.getName()}", function(data) { + __junction_hovering.removeFromLoop(); + }, THEME.feedback)); + } + } + + menuCall("graph_node_selected_menu",,, menu); + + } else if(node_hover && node_hover.draggable) { var menu = []; array_push(menu, menu_node_color, -1, menu_sent_to_preview, menu_send_to_window, menu_sent_to_inspector); if(!DEMO) @@ -871,7 +923,23 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { array_push(menu, menuItem(__txt("Copy"), function() { doCopy(); }, THEME.copy, ["Graph", "Copy"]).setActive(array_length(nodes_selecting))); array_push(menu, menuItem(__txt("Paste"), function() { doPaste(); }, THEME.paste, ["Graph", "Paste"]).setActive(clipboard_get_text() != "")); - + + if(junction_hovering != noone) { + array_push(menu, -1); + + if(is_instanceof(junction_hovering, Node_Feedback_Inline)) { + var _jun = junction_hovering.junc_out; + array_push(menu, menuItem($"[{_jun.node.display_name}] {_jun.getName()}", function(data) { + nodeDelete(__junction_hovering); + }, THEME.feedback)); + } else { + var _jun = junction_hovering.value_from; + array_push(menu, menuItem($"[{_jun.node.display_name}] {_jun.getName()}", function(data) { + __junction_hovering.removeFrom(); + }, THEME.cross)); + } + } + var ctx = is_instanceof(frame_hovering, Node_Collection_Inline)? frame_hovering : getCurrentContext(); callAddDialog(ctx); @@ -879,6 +947,10 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { setFocus(o_dialog_add_node.id, "Dialog"); } } #endregion + + if(is_instanceof(frame_hovering, Node_Collection_Inline) && DOUBLE_CLICK && array_empty(nodes_selecting)) { #region + nodes_selecting = [ frame_hovering ]; + } #endregion } #endregion printIf(log, $"Node selection time: {get_timer() - t}"); t = get_timer(); @@ -917,10 +989,10 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { connection_param.active = hoverable; connection_param.max_layer = ds_list_size(nodes_list); connection_param.highlight = display_parameter.highlight; - + for(var i = 0; i < ds_list_size(nodes_list); i++) { connection_param.cur_layer = i + 1; - + var _hov = nodes_list[| i].drawConnections(connection_param); if(_hov != noone && is_struct(_hov)) hov = _hov; } @@ -1168,23 +1240,26 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { if(target) target.drawJunction(graph_s, target.x, target.y); if(mouse_release(mb_left)) { // CONNECT junction + var _connect = [ 0, noone, noone ]; + if(target != noone) { var _addInput = false; if(target.isLeaf() && target.connect_type == JUNCTION_CONNECT.input && target.node.auto_input) _addInput = true; if(value_dragging.connect_type == JUNCTION_CONNECT.input) { - if(array_empty(value_draggings)) - value_dragging.setFrom(target); - else { + if(array_empty(value_draggings)) { + _connect = [ value_dragging.setFrom(target), value_dragging, target ]; + } else { for( var i = 0, n = array_length(value_draggings); i < n; i++ ) value_draggings[i].setFrom(target); } } else if(_addInput && !array_empty(value_draggings)) { for( var i = 0, n = array_length(value_draggings); i < n; i++ ) target.node.addInput(value_draggings[i]); - } else - target.setFrom(value_dragging); + } else { + _connect = [ target.setFrom(value_dragging), target, value_dragging ]; + } } else { if(value_dragging.connect_type == JUNCTION_CONNECT.input) value_dragging.removeFrom(); @@ -1204,6 +1279,16 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { value_dragging = noone; connection_draw_mouse = noone; + + if(_connect[0] == -9) { + if(_connect[1].value_from_loop != noone) + nodeDelete(_connect[1].value_from_loop); + + var feed = nodeBuild(key_mod_press(SHIFT)? "Node_Iterate_Inline" : "Node_Feedback_Inline", 0, 0); + feed.attributes.junc_in = [ _connect[1].node.node_id, _connect[1].index ]; + feed.attributes.junc_out = [ _connect[2].node.node_id, _connect[2].index ]; + feed.scanJunc(); + } } } else if(!value_dragging && value_focus && mouse_press(mb_left, pFOCUS) && !key_mod_press(ALT)) { value_dragging = value_focus; diff --git a/scripts/render_data/render_data.gml b/scripts/render_data/render_data.gml index e6478d8b6..c982179af 100644 --- a/scripts/render_data/render_data.gml +++ b/scripts/render_data/render_data.gml @@ -133,6 +133,8 @@ function __nodeIsRenderLeaf(_node) { #region if(_node.passiveDynamic) { _node.forwardPassiveDynamic(); LOG_IF(global.FLAG.render == 1, $"Skip passive dynamic [{_node.internalName}]"); return false; } if(!_node.isActiveDynamic()) { LOG_IF(global.FLAG.render == 1, $"Skip rendered static [{_node.internalName}]"); return false; } + for( var i = 0, n = array_length(_node.context_data); i < n; i++ ) + if(_node.context_data[i].managedRenderOrder) return false; return true; } #endregion