From 8f84b61d3f8119db4e210997dca54894b0ade5c9 Mon Sep 17 00:00:00 2001 From: Tanasart <22589759+Ttanasart-pt@users.noreply.github.com> Date: Sat, 16 Sep 2023 20:26:35 +0200 Subject: [PATCH] - Fix connection issues for some dynamic input nodes . --- PixelComposer.resource_order | 1 + PixelComposer.yyp | 2 + objects/_addon_custom/Create_0.gml | 1 - objects/o_main/Other_2.gml | 2 +- scripts/dynaSurf/dynaSurf.gml | 4 +- scripts/dynaSurf_3d/dynaSurf_3d.gml | 2 +- scripts/dynaSurf_iso/dynaSurf_iso.gml | 29 ++++- scripts/matrixGrid/matrixGrid.gml | 18 ++- scripts/node_3dsurf/node_3dsurf.gml | 2 +- scripts/node_data/node_data.gml | 10 +- .../node_dynamic_surface.gml | 4 +- scripts/node_hlsl/node_hlsl.gml | 45 ++++++-- scripts/node_isosurf/node_isosurf.gml | 105 ++++++++++++++++-- scripts/node_keyframe/node_keyframe.gml | 3 +- scripts/node_lua_compute/node_lua_compute.gml | 3 +- scripts/node_lua_global/node_lua_global.gml | 1 - scripts/node_lua_surface/node_lua_surface.gml | 3 +- scripts/node_registry/node_registry.gml | 2 +- scripts/node_value/node_value.gml | 26 +++-- scripts/panel_graph/panel_graph.gml | 6 +- .../panel_text_editor/panel_text_editor.gml | 2 +- scripts/rotator/rotator.gml | 11 +- .../surface_functions/surface_functions.gml | 18 +-- scripts/textArea/textArea.gml | 4 +- scripts/vectorBox/vectorBox.gml | 8 +- .../0266d148-cd45-45c0-9c40-3df37b8350c5.png | Bin 0 -> 1425 bytes .../4741917d-c87e-4e69-9ac9-a60bda969c74.png | Bin 0 -> 1425 bytes sprites/s_node_dynasurf/s_node_dynasurf.yy | 74 ++++++++++++ 28 files changed, 301 insertions(+), 85 deletions(-) create mode 100644 sprites/s_node_dynasurf/0266d148-cd45-45c0-9c40-3df37b8350c5.png create mode 100644 sprites/s_node_dynasurf/layers/0266d148-cd45-45c0-9c40-3df37b8350c5/4741917d-c87e-4e69-9ac9-a60bda969c74.png create mode 100644 sprites/s_node_dynasurf/s_node_dynasurf.yy diff --git a/PixelComposer.resource_order b/PixelComposer.resource_order index afeb2e527..4b893adc7 100644 --- a/PixelComposer.resource_order +++ b/PixelComposer.resource_order @@ -884,6 +884,7 @@ {"name":"node_3dsurf","order":5,"path":"scripts/node_3dsurf/node_3dsurf.yy",}, {"name":"fd_rectangle_reset_target","order":17,"path":"scripts/fd_rectangle_reset_target/fd_rectangle_reset_target.yy",}, {"name":"node_rate_remap","order":3,"path":"scripts/node_rate_remap/node_rate_remap.yy",}, + {"name":"s_node_dynasurf","order":3,"path":"sprites/s_node_dynasurf/s_node_dynasurf.yy",}, {"name":"obj_reader","order":2,"path":"scripts/obj_reader/obj_reader.yy",}, {"name":"sh_invert","order":17,"path":"shaders/sh_invert/sh_invert.yy",}, {"name":"preview_overlay_puppet","order":4,"path":"scripts/preview_overlay_puppet/preview_overlay_puppet.yy",}, diff --git a/PixelComposer.yyp b/PixelComposer.yyp index a428f452d..ebec19c73 100644 --- a/PixelComposer.yyp +++ b/PixelComposer.yyp @@ -14,6 +14,7 @@ {"children":[],"name":"ItchDemo",}, {"children":[],"name":"MacAlpha",}, ],"name":"Itch",}, + {"children":[],"name":"GX",}, ], "name": "Default", }, @@ -1511,6 +1512,7 @@ {"id":{"name":"node_3dsurf","path":"scripts/node_3dsurf/node_3dsurf.yy",},}, {"id":{"name":"fd_rectangle_reset_target","path":"scripts/fd_rectangle_reset_target/fd_rectangle_reset_target.yy",},}, {"id":{"name":"node_rate_remap","path":"scripts/node_rate_remap/node_rate_remap.yy",},}, + {"id":{"name":"s_node_dynasurf","path":"sprites/s_node_dynasurf/s_node_dynasurf.yy",},}, {"id":{"name":"obj_reader","path":"scripts/obj_reader/obj_reader.yy",},}, {"id":{"name":"sh_invert","path":"shaders/sh_invert/sh_invert.yy",},}, {"id":{"name":"preview_overlay_puppet","path":"scripts/preview_overlay_puppet/preview_overlay_puppet.yy",},}, diff --git a/objects/_addon_custom/Create_0.gml b/objects/_addon_custom/Create_0.gml index 350ed0e45..b60830516 100644 --- a/objects/_addon_custom/Create_0.gml +++ b/objects/_addon_custom/Create_0.gml @@ -11,7 +11,6 @@ event_inherited(); name = filename_name_only(directory); thread = lua_create(); - lua_error_handler = _lua_error; __addon_lua_setup(thread, self); self.directory = directory; diff --git a/objects/o_main/Other_2.gml b/objects/o_main/Other_2.gml index 12759ea91..2505828e8 100644 --- a/objects/o_main/Other_2.gml +++ b/objects/o_main/Other_2.gml @@ -122,7 +122,7 @@ #endregion #region lua - lua_error_handler = _lua_error; + //lua_error_handler = _lua_error; #endregion //print("===== Game Start End ====="); \ No newline at end of file diff --git a/scripts/dynaSurf/dynaSurf.gml b/scripts/dynaSurf/dynaSurf.gml index f347ef827..248a47b4b 100644 --- a/scripts/dynaSurf/dynaSurf.gml +++ b/scripts/dynaSurf/dynaSurf.gml @@ -1,4 +1,4 @@ -function DynaSurf() constructor { +function dynaSurf() constructor { surfaces = []; static getAbsolutePos = function(_x, _y, _xs = 1, _ys = 1, _rot = 0) { @@ -34,7 +34,7 @@ function DynaSurf() constructor { static destroy = function() {} } -function Compute_DynaSurf() : DynaSurf() constructor { +function compute_dynaSurf() : dynaSurf() constructor { drawFn = noone; widthFn = noone; heightFn = noone; diff --git a/scripts/dynaSurf_3d/dynaSurf_3d.gml b/scripts/dynaSurf_3d/dynaSurf_3d.gml index 49a2aea67..fe3477b72 100644 --- a/scripts/dynaSurf_3d/dynaSurf_3d.gml +++ b/scripts/dynaSurf_3d/dynaSurf_3d.gml @@ -1,4 +1,4 @@ -function dynaSurf_3d() : DynaSurf() constructor { +function dynaSurf_3d() : dynaSurf() constructor { object = noone; camera = new __3dCamera(); diff --git a/scripts/dynaSurf_iso/dynaSurf_iso.gml b/scripts/dynaSurf_iso/dynaSurf_iso.gml index bea5ec590..d89cf46a4 100644 --- a/scripts/dynaSurf_iso/dynaSurf_iso.gml +++ b/scripts/dynaSurf_iso/dynaSurf_iso.gml @@ -1,10 +1,27 @@ -function DynaSurf_iso() : DynaSurf() constructor { - angle = 0; +function dynaSurf_iso() : dynaSurf() constructor { + angles = []; + angle_shift = 0; - static getSurface = function(_rot) {} + static getSurface = function(_rot) { + _rot += angle_shift; + var _ind = 0; + var _minA = 360; + + for( var i = 0, n = array_length(angles); i < n; i++ ) { + var _dif = abs(angle_difference(_rot, angles[i])); + if(_dif < _minA) { + _minA = _dif; + _ind = i; + } + } + + return array_safe_get(surfaces, _ind); + } static draw = function(_x = 0, _y = 0, _xs = 1, _ys = 1, _rot = 0, _col = c_white, _alp = 1) { - var _pos = getAbsolutePos(_x, _y, _xs, _ys, _rot); + var _surf = getSurface(_rot); + var _pos = getAbsolutePos(_x, _y, _xs, _ys, _rot); + draw_surface_ext_safe(_surf, _pos[0], _pos[1], _xs, _ys, 0, _col, _alp); } @@ -19,7 +36,7 @@ function DynaSurf_iso() : DynaSurf() constructor { } } -function dynaSurf_iso_4() : DynaSurf_iso() constructor { +function dynaSurf_iso_4() : dynaSurf_iso() constructor { surfaces = array_create(4, noone); static getSurface = function(_rot) { @@ -42,7 +59,7 @@ function dynaSurf_iso_4() : DynaSurf_iso() constructor { } } -function dynaSurf_iso_8() : DynaSurf_iso() constructor { +function dynaSurf_iso_8() : dynaSurf_iso() constructor { surfaces = array_create(8, noone); static getSurface = function(_rot) { diff --git a/scripts/matrixGrid/matrixGrid.gml b/scripts/matrixGrid/matrixGrid.gml index a1c46cb23..00d19aa64 100644 --- a/scripts/matrixGrid/matrixGrid.gml +++ b/scripts/matrixGrid/matrixGrid.gml @@ -35,8 +35,18 @@ function matrixGrid(_type, _size, _onModify, _unit = noone) : widget() construct onModifySingle[10] = function(val) { return onModifyIndex(10, val); } onModifySingle[11] = function(val) { return onModifyIndex(11, val); } + onModifySingle[12] = function(val) { return onModifyIndex(12, val); } + onModifySingle[13] = function(val) { return onModifyIndex(13, val); } + onModifySingle[14] = function(val) { return onModifyIndex(14, val); } + onModifySingle[15] = function(val) { return onModifyIndex(15, val); } + extras = -1; + for(var i = 0; i < inputs; i++) { + tb[i] = new textBox(_type, onModifySingle[i]); + tb[i].slidable = true; + } + static setInteract = function(interactable = noone) { self.interactable = interactable; b_link.interactable = interactable; @@ -61,11 +71,6 @@ function matrixGrid(_type, _size, _onModify, _unit = noone) : widget() construct unit.triggerButton.register(parent); } - for(var i = 0; i < inputs; i++) { - tb[i] = new textBox(_type, onModifySingle[i]); - tb[i].slidable = true; - } - static setSlideSpeed = function(speed) { for(var i = 0; i < inputs; i++) tb[i].slide_speed = speed; @@ -119,8 +124,9 @@ function matrixGrid(_type, _size, _onModify, _unit = noone) : widget() construct var bx = _x + ww * j; var by = _y + hh * i; + var _dat = array_safe_get(_data, ind); - tb[ind].draw(bx + ui(8), by, ww - ui(8), TEXTBOX_HEIGHT, _data[ind], _m); + tb[ind].draw(bx + ui(8), by, ww - ui(8), TEXTBOX_HEIGHT, _dat, _m); } resetFocus(); diff --git a/scripts/node_3dsurf/node_3dsurf.gml b/scripts/node_3dsurf/node_3dsurf.gml index b8257b551..c4a36b768 100644 --- a/scripts/node_3dsurf/node_3dsurf.gml +++ b/scripts/node_3dsurf/node_3dsurf.gml @@ -14,7 +14,7 @@ function Node_3DSurf(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co inputs[| 3] = nodeValue("Distance", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 4 ); - outputs[| 0] = nodeValue("3DSurf", self, JUNCTION_CONNECT.output, VALUE_TYPE.dynaSurf, noone); + outputs[| 0] = nodeValue("3DSurf", self, JUNCTION_CONNECT.output, VALUE_TYPE.dynaSurface, noone); input_display_list = [ 0, ["Camera", false], 1, 2, 3, diff --git a/scripts/node_data/node_data.gml b/scripts/node_data/node_data.gml index 7cb529f09..7db499d4c 100644 --- a/scripts/node_data/node_data.gml +++ b/scripts/node_data/node_data.gml @@ -99,6 +99,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x updateAction = nodeValue("Update", self, JUNCTION_CONNECT.input, VALUE_TYPE.action, false).setVisible(true, true); is_dynamic_input = false; + auto_input = false; input_display_len = 0; input_fix_len = 0; data_length = 1; @@ -256,8 +257,9 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x return self; } #endregion - static setIsDynamicInput = function(_data_length = 1) { #region - is_dynamic_input = true; + static setIsDynamicInput = function(_data_length = 1, _auto_input = true) { #region + is_dynamic_input = true; + auto_input = _auto_input; input_display_len = input_display_list == -1? 0 : array_length(input_display_list); input_fix_len = ds_list_size(inputs); data_length = _data_length; @@ -813,7 +815,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x var _node = outputs[| preview_channel]; switch(_node.type) { case VALUE_TYPE.surface : - case VALUE_TYPE.dynaSurf : + case VALUE_TYPE.dynaSurface : return _node.getValue(); } @@ -1277,7 +1279,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x switch(outputs[| preview_channel].type) { case VALUE_TYPE.surface : - case VALUE_TYPE.dynaSurf : + case VALUE_TYPE.dynaSurface : break; default : return; diff --git a/scripts/node_dynamic_surface/node_dynamic_surface.gml b/scripts/node_dynamic_surface/node_dynamic_surface.gml index 0cf590404..37c9e9cc1 100644 --- a/scripts/node_dynamic_surface/node_dynamic_surface.gml +++ b/scripts/node_dynamic_surface/node_dynamic_surface.gml @@ -5,7 +5,7 @@ function Node_DynaSurf(_x, _y, _group = noone) : Node_Collection(_x, _y, _group) reset_all_child = true; draw_input_overlay = false; - outputs[| 0] = nodeValue("DynaSurf", self, JUNCTION_CONNECT.output, VALUE_TYPE.dynaSurf, noone); + outputs[| 0] = nodeValue("dynaSurf", self, JUNCTION_CONNECT.output, VALUE_TYPE.dynaSurface, noone); custom_input_index = ds_list_size(inputs); custom_output_index = ds_list_size(outputs); @@ -71,7 +71,7 @@ function Node_DynaSurf(_x, _y, _group = noone) : Node_Collection(_x, _y, _group) } #endregion static setDynamicSurface = function() { #region - var _dyna = new Compute_DynaSurf(); + var _dyna = new compute_dynaSurf(); for( var i = 0, n = ds_list_size(nodes); i < n; i++ ) { var _n = nodes[| i]; diff --git a/scripts/node_hlsl/node_hlsl.gml b/scripts/node_hlsl/node_hlsl.gml index a3bab65f1..f1a77735f 100644 --- a/scripts/node_hlsl/node_hlsl.gml +++ b/scripts/node_hlsl/node_hlsl.gml @@ -61,9 +61,10 @@ output.color = surfaceColor;") input_display_list = [ 2, ["Shader", false], 1, ["Arguments", false], argument_renderer, + ["Values", false], ]; - setIsDynamicInput(3); + setIsDynamicInput(3, false); static refreshDynamicInput = function() { #region var _in = ds_list_create(); @@ -81,8 +82,10 @@ output.color = surfaceColor;") continue; } + var inp_name = inputs[| i + 0].getValue(); var inp_type = inputs[| i + 1]; var inp_valu = inputs[| i + 2]; + var cur_valu = inputs[| i + 2].getValue(); ds_list_add(_in, inputs[| i + 0]); ds_list_add(_in, inp_type); @@ -91,34 +94,47 @@ output.color = surfaceColor;") inp_type.editWidget.interactable = true; if(inp_valu.editWidget != noone) inp_valu.editWidget.interactable = true; + inp_valu.name = inp_name; var type = inp_type.getValue(); switch(type) { case 1 : + if(is_array(cur_valu)) inp_valu.overrideValue(0); inp_valu.type = VALUE_TYPE.integer; inp_valu.setDisplay(VALUE_DISPLAY._default); break; case 0 : + if(is_array(cur_valu)) inp_valu.overrideValue(0); inp_valu.type = VALUE_TYPE.float; inp_valu.setDisplay(VALUE_DISPLAY._default); break; case 2 : + if(!is_array(cur_valu) || array_length(cur_valu) != 2) + inp_valu.overrideValue([ 0, 0 ]); inp_valu.type = VALUE_TYPE.float; - inp_valu.setDisplay(VALUE_DISPLAY.vector, 2); + inp_valu.setDisplay(VALUE_DISPLAY.vector); break; case 3 : + if(!is_array(cur_valu) || array_length(cur_valu) != 3) + inp_valu.overrideValue([ 0, 0, 0 ]); inp_valu.type = VALUE_TYPE.float; - inp_valu.setDisplay(VALUE_DISPLAY.vector, 3); + inp_valu.setDisplay(VALUE_DISPLAY.vector); break; case 4 : + if(!is_array(cur_valu) || array_length(cur_valu) != 4) + inp_valu.overrideValue([ 0, 0, 0, 0 ]); inp_valu.type = VALUE_TYPE.float; - inp_valu.setDisplay(VALUE_DISPLAY.vector, 4); + inp_valu.setDisplay(VALUE_DISPLAY.vector); break; case 5 : + if(!is_array(cur_valu) || array_length(cur_valu) != 9) + inp_valu.overrideValue(array_create(9)); inp_valu.type = VALUE_TYPE.float; inp_valu.setDisplay(VALUE_DISPLAY.matrix, 3); break; case 6 : + if(!is_array(cur_valu) || array_length(cur_valu) != 16) + inp_valu.overrideValue(array_create(16)); inp_valu.type = VALUE_TYPE.float; inp_valu.setDisplay(VALUE_DISPLAY.matrix, 4); break; @@ -142,6 +158,11 @@ output.color = surfaceColor;") inputs = _in; createNewInput(); + + //print("=========================="); + //for( var i = 0, n = array_length(input_display_list); i < n; i++ ) + // print(input_display_list[i]); + //print("=========================="); #endregion } if(!LOADING && !APPENDING) refreshDynamicInput(); @@ -244,17 +265,20 @@ struct PixelShaderOutput { if(!LOADING && !APPENDING) refreshShader(); static onValueUpdate = function(index) { #region - var _refresh = index == 0 || index == 1 - || (index >= input_fix_len && (index - input_fix_len) % data_length != 2); - if(_refresh) refreshShader(); + var _refresh = index == 0 || index == 1 || + (index >= input_fix_len && (index - input_fix_len) % data_length != 2); - refreshDynamicInput(); + if(_refresh) { + refreshShader(); + refreshDynamicInput(); + } } #endregion static processData = function(_output, _data, _output_index, _array_index = 0) { #region var _surf = _data[2]; if(!is_surface(_surf)) return noone; if(!d3d11_shader_exists(shader.vs)) return noone; + if(!d3d11_shader_exists(shader.fs)) return noone; _output = surface_verify(_output, surface_get_width_safe(_surf), surface_get_height_safe(_surf)); @@ -341,5 +365,8 @@ struct PixelShaderOutput { return _output; } #endregion - static postConnect = function() { refreshShader(); } + static postConnect = function() { + refreshShader(); + refreshDynamicInput(); + } } \ No newline at end of file diff --git a/scripts/node_isosurf/node_isosurf.gml b/scripts/node_isosurf/node_isosurf.gml index 25e455bc5..b9d6db6a6 100644 --- a/scripts/node_isosurf/node_isosurf.gml +++ b/scripts/node_isosurf/node_isosurf.gml @@ -1,8 +1,7 @@ function Node_IsoSurf(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor { name = "IsoSurf"; - inputs[| 0] = nodeValue("Direction", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) - .setDisplay(VALUE_DISPLAY.enum_button, [ "4", "8" ]); + inputs[| 0] = nodeValue("Direction", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 4); inputs[| 1] = nodeValue("Surfaces", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone) .setVisible(true, true) @@ -11,23 +10,111 @@ function Node_IsoSurf(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c inputs[| 2] = nodeValue("Angle Shift", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.rotation); - outputs[| 0] = nodeValue("IsoSurf", self, JUNCTION_CONNECT.output, VALUE_TYPE.dynaSurf, noone); + inputs[| 3] = nodeValue("Angle Split", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 0 * 90, 1 * 90, 2 * 90, 3 * 90 ]) + .setArrayDepth(1); + + outputs[| 0] = nodeValue("IsoSurf", self, JUNCTION_CONNECT.output, VALUE_TYPE.dynaSurface, noone); + + knob_hover = noone; + knob_dragging = noone; + drag_sv = 0; + drag_sa = 0; + + angle_renderer = new Inspector_Custom_Renderer(function(_x, _y, _w, _m, _hover, _focus) { + var hh = ui(240); + var _surfs = inputs[| 1].getValue(); + var _angle = inputs[| 3].getValue(); + + var _kx = _x + _w / 2; + var _ky = _y + hh / 2; + + draw_sprite_stretched_ext(THEME.ui_panel_bg, 1, _x, _y, _w, hh, COLORS.node_composite_bg_blend, 1); + draw_sprite(THEME.rotator_bg, 0, _kx, _ky); + + var _khover = noone; + + for( var i = 0, n = array_length(_angle); i < n; i++ ) { + var _ang = _angle[i]; + + var _knx = _kx + lengthdir_x(ui(28), _ang); + var _kny = _ky + lengthdir_y(ui(28), _ang); + var _ind = (knob_dragging == noone && i == knob_hover) || knob_dragging == i; + var _cc = knob_dragging == i? COLORS._main_accent : c_white; + draw_sprite_ext(THEME.rotator_knob, _ind, _knx, _kny, 1, 1, 0, _cc, 1); + if(point_in_circle(_m[0], _m[1], _knx, _kny, ui(10))) + _khover = i; + + var _knx = _kx + lengthdir_x(ui(44), _ang); + var _kny = _ky + lengthdir_y(ui(44), _ang); + draw_set_text(f_p3, fa_center, fa_center, COLORS._main_text_sub); + draw_text_add(_knx, _kny, _ang); + + var _knx = _kx + lengthdir_x(ui(84), _ang); + var _kny = _ky + lengthdir_y(ui(84), _ang); + + var _surf = array_safe_get(_surfs, i, noone); + if(is_surface(_surf)) { + var _sw = surface_get_width(_surf); + var _sh = surface_get_height(_surf); + var _ss = min(32 / _sw, 32 / _sh); + draw_surface_ext(_surf, _knx - _sw * _ss / 2, _kny - _sh * _ss / 2, _ss, _ss, 0, c_white, 1); + } + + draw_set_color(COLORS._main_text_sub); + draw_rectangle(_knx - 16, _kny - 16, _knx + 16, _kny + 16, true); + } + + knob_hover = _khover; + + if(knob_dragging == noone) { + if(knob_hover >= 0 && mouse_press(mb_left, _focus)) { + knob_dragging = knob_hover; + drag_sv = _angle[knob_hover]; + drag_sa = _angle[knob_hover]; + } + } else { + var delta = angle_difference(point_direction(_kx, _ky, _m[0], _m[1]), drag_sa); + var real_val = round(delta + drag_sv); + var val = key_mod_press(CTRL)? round(real_val / 15) * 15 : real_val; + _angle[knob_dragging] = val; + + if(inputs[| 3].setValue(_angle)) UNDO_HOLDING = true; + + if(mouse_release(mb_left)) { + knob_dragging = noone; + } + } + + return hh; + }); input_display_list = [ - ["Isometric", false], 0, 2, + ["Iso", false], 0, 2, angle_renderer, ["Surfaces", false], 1, ]; + static onValueUpdate = function(index) { + if(index == 0) { + var _amo = inputs[| 0].getValue(); + var _ang = array_create(_amo); + + for( var i = 0, n = _amo; i < n; i++ ) + _ang[i] = 360 * (i / _amo); + inputs[| 3].setValue(_ang); + } + } + static processData = function(_outSurf, _data, _output_index, _array_index) { - var _type = _data[0]; + var _amo = _data[0]; var _surf = _data[1]; - var _angle = _data[2]; - var _amo = _type == 0? 4 : 8; + var _ashft = _data[2]; + var _angle = _data[3]; + var _iso = new dynaSurf_iso(); - var _iso = _type == 0? new dynaSurf_iso_4() : new dynaSurf_iso_8(); for( var i = 0; i < _amo; i++ ) _iso.surfaces[i] = array_safe_get(_surf, i, noone); - _iso.angle = _angle; + _iso.angles = _angle; + _iso.angle_shift = _ashft; return _iso; } diff --git a/scripts/node_keyframe/node_keyframe.gml b/scripts/node_keyframe/node_keyframe.gml index af26a498f..1188131ba 100644 --- a/scripts/node_keyframe/node_keyframe.gml +++ b/scripts/node_keyframe/node_keyframe.gml @@ -257,8 +257,7 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor { static processType = function(_val) { #region if(!sep_axis && typeArray(prop.display_type) && is_array(_val)) { for(var i = 0; i < array_length(_val); i++) - _val[i] = processValue(_val[i]); - + _val[i] = processValue(_val[i]); return _val; } return processValue(_val); diff --git a/scripts/node_lua_compute/node_lua_compute.gml b/scripts/node_lua_compute/node_lua_compute.gml index b6ac64525..53dc489cd 100644 --- a/scripts/node_lua_compute/node_lua_compute.gml +++ b/scripts/node_lua_compute/node_lua_compute.gml @@ -41,13 +41,12 @@ function Node_Lua_Compute(_x, _y, _group = noone) : Node(_x, _y, _group) constru ["Inputs", true], ]; - setIsDynamicInput(3); + setIsDynamicInput(3, false); argument_name = []; argument_val = []; lua_state = lua_create(); - lua_error_handler = _lua_error; error_notification = noone; compiled = false; diff --git a/scripts/node_lua_global/node_lua_global.gml b/scripts/node_lua_global/node_lua_global.gml index dca0531e3..08cfda602 100644 --- a/scripts/node_lua_global/node_lua_global.gml +++ b/scripts/node_lua_global/node_lua_global.gml @@ -19,7 +19,6 @@ function Node_Lua_Global(_x, _y, _group = noone) : Node(_x, _y, _group) construc ]; lua_state = lua_create(); - lua_error_handler = _lua_error; is_beginning = false; error_notification = noone; diff --git a/scripts/node_lua_surface/node_lua_surface.gml b/scripts/node_lua_surface/node_lua_surface.gml index d1a0fe438..52b6ad29d 100644 --- a/scripts/node_lua_surface/node_lua_surface.gml +++ b/scripts/node_lua_surface/node_lua_surface.gml @@ -42,13 +42,12 @@ function Node_Lua_Surface(_x, _y, _group = noone) : Node(_x, _y, _group) constru ["Inputs", true], ]; - setIsDynamicInput(3); + setIsDynamicInput(3, false); argument_name = []; argument_val = []; lua_state = lua_create(); - lua_error_handler = _lua_error; error_notification = noone; compiled = false; diff --git a/scripts/node_registry/node_registry.gml b/scripts/node_registry/node_registry.gml index 9be62a0f2..99ed5035a 100644 --- a/scripts/node_registry/node_registry.gml +++ b/scripts/node_registry/node_registry.gml @@ -589,7 +589,7 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor { addNodeObject(values, "Atlas Set", s_node_atlas_set, "Node_Atlas_Set", [1, Node_Atlas_Set]).setVersion(1141); ds_list_add(values, "Surface"); - //addNodeObject(values, "Dynamic Surface", s_node_surface_from_buffer, "Node_DynaSurf", [1, Node_DynaSurf]).setVersion(11520); + //addNodeObject(values, "Dynamic Surface", s_node_dynasurf, "Node_dynaSurf", [1, Node_dynaSurf]).setVersion(11520); addNodeObject(values, "IsoSurf", s_node_isosurf, "Node_IsoSurf", [1, Node_IsoSurf]).setVersion(11520); addNodeObject(values, "Surface from Buffer", s_node_surface_from_buffer, "Node_Surface_From_Buffer", [1, Node_Surface_From_Buffer], ["buffer to surface"], "Create surface from buffer.").setVersion(1146); diff --git a/scripts/node_value/node_value.gml b/scripts/node_value/node_value.gml index e500fa125..46c91a0c2 100644 --- a/scripts/node_value/node_value.gml +++ b/scripts/node_value/node_value.gml @@ -52,7 +52,7 @@ enum VALUE_TYPE { d3Scene = 29, d3Material = 30, - dynaSurf = 31, + dynaSurface = 31, PCXnode = 32, action = 99, @@ -177,7 +177,7 @@ function value_bit(i) { #region case VALUE_TYPE.boolean : return 1 << 3 | 1 << 1; case VALUE_TYPE.color : return 1 << 4; case VALUE_TYPE.gradient : return 1 << 25; - case VALUE_TYPE.dynaSurf : + case VALUE_TYPE.dynaSurface : case VALUE_TYPE.surface : return 1 << 5; case VALUE_TYPE.path : return 1 << 10; case VALUE_TYPE.text : return 1 << 10; @@ -691,7 +691,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru break; #endregion case VALUE_DISPLAY.vector : #region var val = animator.getValue(); - var len = display_data == -1? array_length(val) : display_data; + var len = array_length(val); if(len <= 4) { editWidget = new vectorBox(len, function(index, val) { @@ -700,7 +700,8 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru return setValueDirect(val, index); }, unit ); if(type == VALUE_TYPE.integer) editWidget.setSlideSpeed(1); - if(display_data != -1) editWidget.extras = display_data; + if(display_data != -1 && is_struct(display_data)) + editWidget.extras = display_data; if(len == 2) { extract_node = [ "Node_Vector2", "Node_Path" ]; @@ -856,7 +857,6 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru return setValueDirect(_val); }, unit ); if(type == VALUE_TYPE.integer) editWidget.setSlideSpeed(1); - if(display_data != -1) editWidget.extras = display_data; for( var i = 0, n = array_length(animators); i < n; i++ ) animators[i].suffix = " " + string(i); @@ -1328,9 +1328,9 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru if(value_from == noone) { var _val = __getAnimValue(_time); - val = [ _val, self ]; + return [ _val, self ]; } else if(value_from != self) - val = value_from.getValueRecursive(_time); + return value_from.getValueRecursive(_time); if(expUse && is_struct(expTree) && expTree.validate()) { //print($"========== EXPRESSION CALLED =========="); @@ -1468,6 +1468,16 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru return setValueDirect(val, noone, record, time, _update); } #endregion + static overrideValue = function(_val) { #region + ds_list_clear(animator.values); + ds_list_add(animator.values, new valueKey(0, _val, animator)); + + for( var i = 0, n = array_length(animators); i < n; i++ ) { + ds_list_clear(animators[i].values); + ds_list_add(animators[i].values, new valueKey(0, array_safe_get(_val, i), animators[i])); + } + } #endregion + static setValueDirect = function(val = 0, index = noone, record = true, time = PROJECT.animator.current_frame, _update = true) { #region var updated = false; @@ -1566,6 +1576,8 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru } #endregion static setFrom = function(_valueFrom, _update = true, checkRecur = true, log = false) { #region + print($"Connecting {_valueFrom.name} to {name}"); + if(_valueFrom == noone) return removeFrom(); diff --git a/scripts/panel_graph/panel_graph.gml b/scripts/panel_graph/panel_graph.gml index 3018fd2c3..3dddb9eb9 100644 --- a/scripts/panel_graph/panel_graph.gml +++ b/scripts/panel_graph/panel_graph.gml @@ -1118,7 +1118,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { } } - if(target != noone && target.connect_type == JUNCTION_CONNECT.input && target.node.is_dynamic_input) + if(target != noone && target.connect_type == JUNCTION_CONNECT.input && target.node.auto_input) _addInput = true; var _mmx = target != noone? target.x : _mx; @@ -1519,7 +1519,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { if(ds_list_empty(nodes_select_list)) { if(node_focus != noone && !ds_list_empty(node_focus.outputs)) { var _o = node_focus.outputs[| 0]; - if(_o.type == VALUE_TYPE.surface || _o.type == VALUE_TYPE.dynaSurf) { + if(_o.type == VALUE_TYPE.surface || _o.type == VALUE_TYPE.dynaSurface) { var tr = nodeBuild("Node_Transform", node_focus.x + node_focus.w + 64, node_focus.y); tr.inputs[| 0].setFrom(_o); } @@ -1530,7 +1530,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { if(ds_list_empty(node.outputs)) continue; var _o = node.outputs[| 0]; - if(_o.type == VALUE_TYPE.surface || _o.type == VALUE_TYPE.dynaSurf) { + if(_o.type == VALUE_TYPE.surface || _o.type == VALUE_TYPE.dynaSurface) { var tr = nodeBuild("Node_Transform", node.x + node.w + 64, node.y); tr.inputs[| 0].setFrom(_o); } diff --git a/scripts/panel_text_editor/panel_text_editor.gml b/scripts/panel_text_editor/panel_text_editor.gml index 337363713..fbe58c41b 100644 --- a/scripts/panel_text_editor/panel_text_editor.gml +++ b/scripts/panel_text_editor/panel_text_editor.gml @@ -1,6 +1,6 @@ function Panel_Text_Editor(_textArea, _inputFunc, _context) : PanelContent() constructor { title = ""; - w = ui(640); + w = min(WIN_W - ui(64), ui(800)); h = ui(480); auto_pin = true; diff --git a/scripts/rotator/rotator.gml b/scripts/rotator/rotator.gml index 6b83efc53..6e37febf1 100644 --- a/scripts/rotator/rotator.gml +++ b/scripts/rotator/rotator.gml @@ -54,14 +54,9 @@ function rotator(_onModify, _step = -1) : widget() constructor { var py = knob_y + lengthdir_y(_r, _data); if(dragging) { - var delta = angle_difference(point_direction(_x, knob_y, _m[0], _m[1]), drag_sa); - var val; - var real_val = round(delta + drag_sv); - - if(key_mod_press(CTRL)) - val = round(real_val / 15) * 15; - else - val = real_val; + var delta = angle_difference(point_direction(_x, knob_y, _m[0], _m[1]), drag_sa); + var real_val = round(delta + drag_sv); + var val = key_mod_press(CTRL)? round(real_val / 15) * 15 : real_val; if(step != -1) val = round(real_val / step) * step; diff --git a/scripts/surface_functions/surface_functions.gml b/scripts/surface_functions/surface_functions.gml index a472fb93f..1e2958bd8 100644 --- a/scripts/surface_functions/surface_functions.gml +++ b/scripts/surface_functions/surface_functions.gml @@ -2,7 +2,7 @@ function draw_surface_safe(surface, _x = 0, _y = 0) { gml_pragma("forceinline"); - if(is_struct(surface) && is_instanceof(surface, DynaSurf)) { + if(is_struct(surface) && is_instanceof(surface, dynaSurf)) { surface.draw(_x, _y); return; } @@ -16,7 +16,7 @@ function draw_surface_safe(surface, _x = 0, _y = 0) { function draw_surface_stretched_safe(surface, _x, _y, _w, _h) { gml_pragma("forceinline"); - if(is_struct(surface) && is_instanceof(surface, DynaSurf)) { + if(is_struct(surface) && is_instanceof(surface, dynaSurf)) { surface.drawStretch(_x, _y, _w, _h); return; } @@ -30,7 +30,7 @@ function draw_surface_stretched_safe(surface, _x, _y, _w, _h) { function draw_surface_ext_safe(surface, _x, _y, _xs = 1, _ys = 1, _rot = 0, _col = c_white, _alpha = 1) { gml_pragma("forceinline"); - if(is_struct(surface) && is_instanceof(surface, DynaSurf)) { + if(is_struct(surface) && is_instanceof(surface, dynaSurf)) { surface.draw(_x, _y, _xs, _ys, _rot, _col, _alpha); return; } @@ -44,7 +44,7 @@ function draw_surface_ext_safe(surface, _x, _y, _xs = 1, _ys = 1, _rot = 0, _col function draw_surface_tiled_safe(surface, _x, _y) { gml_pragma("forceinline"); - if(is_struct(surface) && is_instanceof(surface, DynaSurf)) { + if(is_struct(surface) && is_instanceof(surface, dynaSurf)) { surface.drawTile(_x, _y); return; } @@ -58,7 +58,7 @@ function draw_surface_tiled_safe(surface, _x, _y) { function draw_surface_tiled_ext_safe(surface, _x, _y, _xs = 1, _ys = 1, _col = c_white, _alpha = 1) { gml_pragma("forceinline"); - if(is_struct(surface) && is_instanceof(surface, DynaSurf)) { + if(is_struct(surface) && is_instanceof(surface, dynaSurf)) { surface.drawTile(_x, _y, _xs, _ys, _col, _alpha); return; } @@ -72,7 +72,7 @@ function draw_surface_tiled_ext_safe(surface, _x, _y, _xs = 1, _ys = 1, _col = c function draw_surface_part_ext_safe(surface, _l, _t, _w, _h, _x, _y, _xs = 1, _ys = 1, _rot = 0, _col = c_white, _alpha = 1) { gml_pragma("forceinline"); - if(is_struct(surface) && is_instanceof(surface, DynaSurf)) { + if(is_struct(surface) && is_instanceof(surface, dynaSurf)) { surface.drawPart(_l, _t, _w, _h, _x, _y, _xs, _ys, _rot, _col, _alpha); return; } @@ -141,13 +141,13 @@ function surface_save_safe(surface, path) { function surface_get_width_safe(s) { gml_pragma("forceinline"); - return (is_struct(s) && is_instanceof(s, DynaSurf))? s.getWidth() : surface_get_width(s); + return (is_struct(s) && is_instanceof(s, dynaSurf))? s.getWidth() : surface_get_width(s); } function surface_get_height_safe(s) { gml_pragma("forceinline"); - return (is_struct(s) && is_instanceof(s, DynaSurf))? s.getHeight() : surface_get_height(s); + return (is_struct(s) && is_instanceof(s, dynaSurf))? s.getHeight() : surface_get_height(s); } //check @@ -156,7 +156,7 @@ function is_surface(s) { if(is_undefined(s)) return false; if(is_array(s)) return false; - if(is_struct(s) && is_instanceof(s, DynaSurf)) return true; + if(is_struct(s) && is_instanceof(s, dynaSurf)) return true; if(!is_real(s)) return false; if(!s) return false; if(!surface_exists(s)) return false; diff --git a/scripts/textArea/textArea.gml b/scripts/textArea/textArea.gml index 91743b41d..f7dd2fe45 100644 --- a/scripts/textArea/textArea.gml +++ b/scripts/textArea/textArea.gml @@ -365,8 +365,8 @@ function textArea(_input, _onModify, _extras = noone) : textInput(_input, _onMod if(keyboard_check_pressed(vk_escape)) { } else if(keyboard_check_pressed(vk_tab)) { - } else if(( shift_new_line && keyboard_check_pressed(vk_enter) && key_mod_press(SHIFT)) || - (!shift_new_line && keyboard_check_pressed(vk_enter))) { + } else if(( shift_new_line && keyboard_check_pressed(vk_enter) && key_mod_press(SHIFT)) || + (!shift_new_line && keyboard_check_pressed(vk_enter) && !key_mod_press(SHIFT))) { var ch = "\n"; if(cursor_select == -1) { var str_before = string_copy(_input_text, 1, cursor); diff --git a/scripts/vectorBox/vectorBox.gml b/scripts/vectorBox/vectorBox.gml index ed350843c..83fe9f4a1 100644 --- a/scripts/vectorBox/vectorBox.gml +++ b/scripts/vectorBox/vectorBox.gml @@ -37,7 +37,7 @@ function vectorBox(_size, _onModify, _unit = noone) : widget() constructor { onModifySingle[2] = function(val) { return onModifyIndex(2, val); } onModifySingle[3] = function(val) { return onModifyIndex(3, val); } - extras = -1; + extras = noone; for(var i = 0; i < 4; i++) { tb[i] = new textBox(TEXTBOX_INPUT.number, onModifySingle[i]); @@ -53,8 +53,7 @@ function vectorBox(_size, _onModify, _unit = noone) : widget() constructor { self.interactable = interactable; b_link.interactable = interactable; - if(extras) - extras.interactable = interactable; + if(extras != noone) extras.interactable = interactable; for( var i = 0; i < size; i++ ) tb[i].interactable = interactable; @@ -66,8 +65,7 @@ function vectorBox(_size, _onModify, _unit = noone) : widget() constructor { for( var i = 0; i < size; i++ ) tb[i].register(parent); - if(extras) - extras.register(parent); + if(extras != noone) extras.register(parent); if(unit != noone && unit.reference != noone) unit.triggerButton.register(parent); diff --git a/sprites/s_node_dynasurf/0266d148-cd45-45c0-9c40-3df37b8350c5.png b/sprites/s_node_dynasurf/0266d148-cd45-45c0-9c40-3df37b8350c5.png new file mode 100644 index 0000000000000000000000000000000000000000..2d870b273493bbddcc5921095a9f8d2f3345d74f GIT binary patch literal 1425 zcmZ{kX-v~;5XRp^g+c`ip->c+YB?4tmR6A#L|V!vDRLBxT*6|38Y@?kTmMu*WkGR4 z3NGdJ2rg1tSXAyK+{&fEy5-hIuz)Bcf`D7UY_cEBWadfc$uE=4By-Kh*wXT*@ zL+)oMdph{`J&GFcX8{0DcBE68F@G<5zdyU5rT&eZSBJ9I)>WQMzz9-xvEg+s#B;mD z4x||JCW~W}8>ugjbRDQxadps0!)9J^tjn!M>v{~RY*1}Gl?-_@^H(VD!THB1q#*6r zDsuIa{bTWcp?!IgOHs4kTU$r>lB~kLVUH{Inz=j1I!g7S+cuxW5@KL)U$?2B28(VJWI5;m{*ZAj7)0lP92cM zcEo@#VF7h+btjj2z&eQ?9dAMDcbB&`M-(rU3qkC0>gHSJOFoH^!33Go>Bi!h9lBxA z>rYa%%VuXDU%B32`4SGFhXUgNLFl~sb~T+4z{tb&b~Pn#D~Tgb+DSUy`lvuH6s?$9 zzP~m3k=CHz)NqRxWzhsat>Kfu1Ms|jH!tL^>A_5MV463&7lq>|7@}9{$!NIkDLJ2f z+lG~p7|2!CDO32SRXXg-}BWR17(TT=K{V?0ca?#ldg)u^#?*>#(H1Z{4`DY$ra^@510Zq#Y=tyQ|+dRPlMjcUEdBRauvLw%7Gqrnad{kDxfpc3M&~$H*kRq*++}o`5}V z*D&Jp^22jGw1_U&d+Dcd{L9=OfG94T~ z#v^qD$`mq-1bRY963?%qg&yW;7A!-KYHpl~o3(9OaL^Zw=vSROq)>nZVJ3{Y9B>U@ z#~FG7cX*Vg$KnHUug=Bj1mxklzj=O*mk)Ueja6N`1P^^`Ts()n-5fnchX>9_Pe)Io z(fR~Ty77B-A06x|*cNj_0*9_ZIelIO$fU@2|6mg+;h#*pTN63J>&ZJ4z++PaBiK>_L;{h7Cy?=`W=vBeg=9uCH8mm- zCc+YB?4tmR6A#L|V!vDRLBxT*6|38Y@?kTmMu*WkGR4 z3NGdJ2rg1tSXAyK+{&fEy5-hIuz)Bcf`D7UY_cEBWadfc$uE=4By-Kh*wXT*@ zL+)oMdph{`J&GFcX8{0DcBE68F@G<5zdyU5rT&eZSBJ9I)>WQMzz9-xvEg+s#B;mD z4x||JCW~W}8>ugjbRDQxadps0!)9J^tjn!M>v{~RY*1}Gl?-_@^H(VD!THB1q#*6r zDsuIa{bTWcp?!IgOHs4kTU$r>lB~kLVUH{Inz=j1I!g7S+cuxW5@KL)U$?2B28(VJWI5;m{*ZAj7)0lP92cM zcEo@#VF7h+btjj2z&eQ?9dAMDcbB&`M-(rU3qkC0>gHSJOFoH^!33Go>Bi!h9lBxA z>rYa%%VuXDU%B32`4SGFhXUgNLFl~sb~T+4z{tb&b~Pn#D~Tgb+DSUy`lvuH6s?$9 zzP~m3k=CHz)NqRxWzhsat>Kfu1Ms|jH!tL^>A_5MV463&7lq>|7@}9{$!NIkDLJ2f z+lG~p7|2!CDO32SRXXg-}BWR17(TT=K{V?0ca?#ldg)u^#?*>#(H1Z{4`DY$ra^@510Zq#Y=tyQ|+dRPlMjcUEdBRauvLw%7Gqrnad{kDxfpc3M&~$H*kRq*++}o`5}V z*D&Jp^22jGw1_U&d+Dcd{L9=OfG94T~ z#v^qD$`mq-1bRY963?%qg&yW;7A!-KYHpl~o3(9OaL^Zw=vSROq)>nZVJ3{Y9B>U@ z#~FG7cX*Vg$KnHUug=Bj1mxklzj=O*mk)Ueja6N`1P^^`Ts()n-5fnchX>9_Pe)Io z(fR~Ty77B-A06x|*cNj_0*9_ZIelIO$fU@2|6mg+;h#*pTN63J>&ZJ4z++PaBiK>_L;{h7Cy?=`W=vBeg=9uCH8mm- zC","resourceVersion":"1.0","Keyframes":[],}, + "eventStubScript": null, + "eventToFunction": {}, + "length": 1.0, + "lockOrigin": false, + "moments": {"resourceType":"KeyframeStore","resourceVersion":"1.0","Keyframes":[],}, + "playback": 1, + "playbackSpeed": 30.0, + "playbackSpeedType": 0, + "showBackdrop": true, + "showBackdropImage": false, + "timeUnits": 1, + "tracks": [ + {"resourceType":"GMSpriteFramesTrack","resourceVersion":"1.0","name":"frames","builtinName":0,"events":[],"inheritsTrackColour":true,"interpolation":1,"isCreationTrack":false,"keyframes":{"resourceType":"KeyframeStore","resourceVersion":"1.0","Keyframes":[ + {"resourceType":"Keyframe","resourceVersion":"1.0","Channels":{"0":{"resourceType":"SpriteFrameKeyframe","resourceVersion":"1.0","Id":{"name":"0266d148-cd45-45c0-9c40-3df37b8350c5","path":"sprites/s_node_dynasurf/s_node_dynasurf.yy",},},},"Disabled":false,"id":"79c02c00-0fbf-49c8-b934-c505bdbfe181","IsCreationKey":false,"Key":0.0,"Length":1.0,"Stretch":false,}, + ],},"modifiers":[],"spriteId":null,"trackColour":0,"tracks":[],"traits":0,}, + ], + "visibleRange": null, + "volume": 1.0, + "xorigin": 32, + "yorigin": 32, + }, + "swatchColours": null, + "swfPrecision": 2.525, + "textureGroupId": { + "name": "Default", + "path": "texturegroups/Default", + }, + "type": 0, + "VTile": false, + "width": 64, +} \ No newline at end of file