From 5bd39e52ae967f29ee848fbe3ef0b5f1754eafd8 Mon Sep 17 00:00:00 2001 From: Tanasart Date: Fri, 12 Jul 2024 08:18:34 +0700 Subject: [PATCH] - [Group] Fix incorrect junction type on newer datatypes. --- scripts/__node_3d/__node_3d.gml | 1 + scripts/node_3d_camera/node_3d_camera.gml | 1 + .../node_3d_camera_set/node_3d_camera_set.gml | 1 + scripts/node_collection/node_collection.gml | 20 +-- scripts/node_group_input/node_group_input.gml | 140 ++++++++++-------- scripts/node_processor/node_processor.gml | 10 +- scripts/node_value_types/node_value_types.gml | 65 ++++---- 7 files changed, 129 insertions(+), 109 deletions(-) diff --git a/scripts/__node_3d/__node_3d.gml b/scripts/__node_3d/__node_3d.gml index aa4cff8a3..716c9a15c 100644 --- a/scripts/__node_3d/__node_3d.gml +++ b/scripts/__node_3d/__node_3d.gml @@ -1,6 +1,7 @@ function Node_3D(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor { name = "3D"; is_3D = NODE_3D.polygon; + dimension_index = -1; mesh_prev_surface = surface_create(64, 64); diff --git a/scripts/node_3d_camera/node_3d_camera.gml b/scripts/node_3d_camera/node_3d_camera.gml index 6d37078f4..149ff31ef 100644 --- a/scripts/node_3d_camera/node_3d_camera.gml +++ b/scripts/node_3d_camera/node_3d_camera.gml @@ -2,6 +2,7 @@ function Node_3D_Camera(_x, _y, _group = noone) : Node_3D_Object(_x, _y, _group) name = "3D Camera"; batch_output = true; + dimension_index = in_d3d + 2; object = new __3dCamera_object(); camera = new __3dCamera(); lookat = new __3dGizmoSphere(0.5, c_ltgray, 1); diff --git a/scripts/node_3d_camera_set/node_3d_camera_set.gml b/scripts/node_3d_camera_set/node_3d_camera_set.gml index fd9f9169c..092f3741c 100644 --- a/scripts/node_3d_camera_set/node_3d_camera_set.gml +++ b/scripts/node_3d_camera_set/node_3d_camera_set.gml @@ -1,6 +1,7 @@ function Node_3D_Camera_Set(_x, _y, _group = noone) : Node_3D_Camera(_x, _y, _group) constructor { name = "3D Camera Set"; + dimension_index = in_d3d + 2; light_key = new __3dLightDirectional(); light_fill = new __3dLightDirectional(); diff --git a/scripts/node_collection/node_collection.gml b/scripts/node_collection/node_collection.gml index 58c5a38e7..b611a04b7 100644 --- a/scripts/node_collection/node_collection.gml +++ b/scripts/node_collection/node_collection.gml @@ -80,8 +80,10 @@ function groupNodes(nodeArray, _group = noone, record = true, check_connect = tr _x = value_snap(_x - 64 - 128, 32); _y = value_snap(_y / m, 32); - var _n = new Node_Group_Input(_x, _y, _group); - _n.inputs[| 2].setValue(_frm.type); + var _n = new Node_Group_Input(_x, _y, _group); + var _ti = array_find(GROUP_IO_TYPE_MAP, _frm.type); + if(_ti >= 0) _n.inputs[| 2].setValue(_ti); + _n.onValueUpdate(0); _n.inParent.setFrom(_frm); @@ -177,9 +179,9 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc combine_render_time = true; previewable = true; - reset_all_child = false; - isInstancer = false; - instanceBase = noone; + reset_all_child = false; + isInstancer = false; + instanceBase = noone; input_display_list_def = []; custom_input_index = 0; @@ -187,10 +189,10 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc metadata = new MetaDataManager(); - group_input_display_list = []; - group_output_display_list = []; - attributes.input_display_list = []; - attributes.output_display_list = []; + group_input_display_list = []; + group_output_display_list = []; + attributes.input_display_list = []; + attributes.output_display_list = []; managedRenderOrder = false; diff --git a/scripts/node_group_input/node_group_input.gml b/scripts/node_group_input/node_group_input.gml index 8d6511233..c08a040f8 100644 --- a/scripts/node_group_input/node_group_input.gml +++ b/scripts/node_group_input/node_group_input.gml @@ -1,3 +1,71 @@ +globalvar GROUP_IO_TYPE_NAME, GROUP_IO_TYPE_MAP, GROUP_IO_DISPLAY; + +#region data + GROUP_IO_TYPE_NAME = [ "Integer", "Float", "Boolean", "Color", "Surface", + "File Path", "Curve", "Text", "Object", "Node", + -1, "Any", "Path", "Particle", "Rigidbody Object", + "Domain", "Struct", "Strands", "Mesh", "Trigger", + + -1, "3D Mesh", "3D Light", "3D Camera", "3D Scene", + "3D Material", -1, "PCX", "Audio", "Fluid Domain", + "SDF", + ]; + + GROUP_IO_TYPE_MAP = [ VALUE_TYPE.integer, VALUE_TYPE.float, VALUE_TYPE.boolean, VALUE_TYPE.color, VALUE_TYPE.surface, + VALUE_TYPE.path, VALUE_TYPE.curve, VALUE_TYPE.text, VALUE_TYPE.object, VALUE_TYPE.node, + noone, VALUE_TYPE.any, VALUE_TYPE.pathnode, VALUE_TYPE.particle, VALUE_TYPE.rigid, + VALUE_TYPE.sdomain, VALUE_TYPE.struct, VALUE_TYPE.strands, VALUE_TYPE.mesh, VALUE_TYPE.trigger, + + noone, VALUE_TYPE.d3Mesh, VALUE_TYPE.d3Light, VALUE_TYPE.d3Camera, VALUE_TYPE.d3Scene, + VALUE_TYPE.d3Material, noone, VALUE_TYPE.PCXnode, VALUE_TYPE.audioBit, VALUE_TYPE.fdomain, + VALUE_TYPE.sdf, + ]; + + GROUP_IO_DISPLAY = [ + + /*Integer*/ [ "Default", "Range", "Rotation", "Rotation range", "Slider", "Slider range", "Padding", "Vector", "Vector range", "Area", "Enum button", "Menu scroll" ], + /*Float*/ [ "Default", "Range", "Rotation", "Rotation range", "Slider", "Slider range", "Padding", "Vector", "Vector range", "Area" ], + /*Boolean*/ 0, + /*Color*/ [ "Default", "Gradient", "Palette" ], + /*Surface*/ 0, + + /*Path*/ 0, + /*Curve*/ [ "Curve", ], + /*Text*/ 0, + /*Object*/ 0, + /*Node*/ 0, + + /*3D*/ 0, + /*Any*/ 0, + /*Pathnode*/ 0, + /*Particle*/ 0, + /*Rigid*/ 0, + + /*Sdomain*/ 0, + /*Struct*/ 0, + /*Strand*/ 0, + /*Mesh*/ 0, + /*Trigger*/ 0, + + //=========================// + + /*Noone*/ 0, + /*3D Mesh*/ 0, + /*3D Light*/ 0, + /*3D Camera*/ 0, + /*3D Scene*/ 0, + + /*3D Material*/ 0, + /*noone*/ 0, + /*PCX*/ 0, + /*Audio*/ 0, + /*Fdomain*/ 0, + + /*SDF*/ 0, + + ]; +#endregion + function Node_Group_Input(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { name = "Group Input"; color = COLORS.node_blend_collection; @@ -8,69 +76,15 @@ function Node_Group_Input(_x, _y, _group = noone) : Node(_x, _y, _group) constru inParent = undefined; setDimension(96, 32 + 24); - #region data - data_type_list = [ "Integer", "Float", "Boolean", "Color", "Surface", - "File Path", "Curve", "Text", "Object", "Node", - -1, "Any", "Path", "Particle", "Rigidbody Object", - "Domain", "Struct", "Strands", "Mesh", "Trigger", - -1, "3D Mesh", "3D Light", "3D Scene", "3D Material", - -1, "Audio" - ]; - - data_type_map = [ VALUE_TYPE.integer, VALUE_TYPE.float, VALUE_TYPE.boolean, VALUE_TYPE.color, VALUE_TYPE.surface, - VALUE_TYPE.path, VALUE_TYPE.curve, VALUE_TYPE.text, VALUE_TYPE.object, VALUE_TYPE.node, - noone, VALUE_TYPE.any, VALUE_TYPE.pathnode, VALUE_TYPE.particle, VALUE_TYPE.rigid, - VALUE_TYPE.sdomain, VALUE_TYPE.struct, VALUE_TYPE.strands, VALUE_TYPE.mesh, VALUE_TYPE.trigger, - - noone, VALUE_TYPE.d3Mesh, VALUE_TYPE.d3Light, VALUE_TYPE.d3Scene, VALUE_TYPE.d3Material, - noone, VALUE_TYPE.audioBit, - ]; - - display_list = [ - /*Integer*/ [ "Default", "Range", "Rotation", "Rotation range", "Slider", "Slider range", "Padding", "Vector", "Vector range", "Area", "Enum button", "Menu scroll" ], - /*Float*/ [ "Default", "Range", "Rotation", "Rotation range", "Slider", "Slider range", "Padding", "Vector", "Vector range", "Area" ], - /*Boolean*/ 0, - /*Color*/ [ "Default", "Gradient", "Palette" ], - /*Surface*/ 0, - - /*Path*/ 0, - /*Curve*/ [ "Curve", ], - /*Text*/ 0, - /*Object*/ 0, - /*Node*/ 0, - - /*3D*/ 0, - /*Any*/ 0, - /*Pathnode*/0, - /*Particle*/0, - /*Rigid*/ 0, - - /*Fdomain*/ 0, - /*Struct*/ 0, - /*Strand*/ 0, - /*Mesh*/ 0, - /*Trigger*/ 0, - - /*noone*/ 0, - /*3D Mesh*/ 0, - /*3D Light*/ 0, - /*3D Scene*/ 0, - /*3D Material*/ 0, - - /*noone*/ 0, - /*Audio*/ 0, - ]; - #endregion - inputs[| 0] = nodeValue("Display type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) - .setDisplay(VALUE_DISPLAY.enum_scroll, { data: display_list[0], update_hover: false }); + .setDisplay(VALUE_DISPLAY.enum_scroll, { data: GROUP_IO_DISPLAY[0], update_hover: false }); inputs[| 1] = nodeValue("Range", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 1 ]) .setDisplay(VALUE_DISPLAY.range) .setVisible(false); inputs[| 2] = nodeValue("Input type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 11) - .setDisplay(VALUE_DISPLAY.enum_scroll, { data: data_type_list, update_hover: false }); + .setDisplay(VALUE_DISPLAY.enum_scroll, { data: GROUP_IO_TYPE_NAME, update_hover: false }); inputs[| 3] = nodeValue("Enum label", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "") .setVisible(false); @@ -132,7 +146,7 @@ function Node_Group_Input(_x, _y, _group = noone) : Node(_x, _y, _group) constru if(!attributes.inherit_type) return; attributes.inherit_type = false; - var ind = array_find(data_type_map, juncTo.type); + var ind = array_find(GROUP_IO_TYPE_MAP, juncTo.type); if(ind == -1) return; if(ind == inputs[| 2].getValue()) return; @@ -194,7 +208,7 @@ function Node_Group_Input(_x, _y, _group = noone) : Node(_x, _y, _group) constru var _dtype = getInputData(0); var _range = getInputData(1); var _type = getInputData(2); - var _val_type = array_safe_get_fast(data_type_map, _type, VALUE_TYPE.any); + var _val_type = array_safe_get_fast(GROUP_IO_TYPE_MAP, _type, VALUE_TYPE.any); var _enum_label = getInputData(3); var _vec_size = getInputData(4); var _step = getInputData(7); @@ -213,7 +227,7 @@ function Node_Group_Input(_x, _y, _group = noone) : Node(_x, _y, _group) constru attributes.inherit_type = false; } - _dtype = array_safe_get_fast(array_safe_get_fast(display_list, _val_type), _dtype); + _dtype = array_safe_get_fast(array_safe_get_fast(GROUP_IO_TYPE_NAME, _val_type), _dtype); inParent.setType(_val_type); outputs[| 0].setType(_val_type); @@ -389,8 +403,8 @@ function Node_Group_Input(_x, _y, _group = noone) : Node(_x, _y, _group) constru if(is_undefined(inParent)) return; var _type = getInputData(2); - var _val_type = array_safe_get_fast(data_type_map, _type, VALUE_TYPE.any); - var _dsList = array_safe_get_fast(display_list, _val_type); + var _val_type = array_safe_get_fast(GROUP_IO_TYPE_MAP, _type, VALUE_TYPE.any); + var _dsList = array_safe_get_fast(GROUP_IO_TYPE_NAME, _val_type); if(_dsList == 0) _dsList = [ "Default" ]; inputs[| 0].display_data.data = _dsList; inputs[| 0].editWidget.data_list = _dsList; @@ -412,10 +426,10 @@ function Node_Group_Input(_x, _y, _group = noone) : Node(_x, _y, _group) constru var _dstype = getInputData(0); var _data = getInputData(2); - var _dsList = array_safe_get_fast(display_list, _data); + var _dsList = array_safe_get_fast(GROUP_IO_TYPE_NAME, _data); _dstype = _dsList == 0? "Default" : array_safe_get_fast(_dsList, _dstype); - var _datype = array_safe_get_fast(data_type_map, _data, VALUE_TYPE.any); + var _datype = array_safe_get_fast(GROUP_IO_TYPE_MAP, _data, VALUE_TYPE.any); inputs[| 1].setVisible(false); inputs[| 3].setVisible(false); diff --git a/scripts/node_processor/node_processor.gml b/scripts/node_processor/node_processor.gml index ed60cf257..c2dcd65d9 100644 --- a/scripts/node_processor/node_processor.gml +++ b/scripts/node_processor/node_processor.gml @@ -236,11 +236,11 @@ function Node_Processor(_x, _y, _group = noone) : Node(_x, _y, _group) construct return; } - var _dim = getDimension(); - - for(var i = 0; i < _os; i++) { - if(outputs[| i].type == VALUE_TYPE.surface) - _out[i] = surface_verify(_out[i], _dim[0], _dim[1], _dep); + if(dimension_index > -1) { + var _dim = getDimension(); + + for(var i = 0; i < _os; i++) + if(outputs[| i].type == VALUE_TYPE.surface) _out[i] = surface_verify(_out[i], _dim[0], _dim[1], _dep); } if(_os == 1) { diff --git a/scripts/node_value_types/node_value_types.gml b/scripts/node_value_types/node_value_types.gml index 583bfa0c7..bd6455b3d 100644 --- a/scripts/node_value_types/node_value_types.gml +++ b/scripts/node_value_types/node_value_types.gml @@ -14,43 +14,44 @@ enum JUNCTION_CONNECT { } enum VALUE_TYPE { - integer = 0, - float = 1, - boolean = 2, - color = 3, - surface = 4, + integer = 0, + float = 1, + boolean = 2, + color = 3, + surface = 4, - path = 5, - curve = 6, - text = 7, - object = 8, - node = 9, - d3object = 10, + path = 5, + curve = 6, + text = 7, + object = 8, + node = 9, + d3object = 10, - any = 11, + any = 11, - pathnode = 12, - particle = 13, - rigid = 14, - sdomain = 15, - struct = 16, - strands = 17, - mesh = 18, - trigger = 19, - atlas = 20, + pathnode = 12, + particle = 13, + rigid = 14, - d3vertex = 21, - gradient = 22, - armature = 23, - buffer = 24, + sdomain = 15, + struct = 16, + strands = 17, + mesh = 18, + trigger = 19, + atlas = 20, - pbBox = 25, + d3vertex = 21, + gradient = 22, + armature = 23, + buffer = 24, - d3Mesh = 26, - d3Light = 27, - d3Camera = 28, - d3Scene = 29, - d3Material = 30, + pbBox = 25, + + d3Mesh = 26, + d3Light = 27, + d3Camera = 28, + d3Scene = 29, + d3Material = 30, dynaSurface = 31, PCXnode = 32, @@ -58,7 +59,7 @@ enum VALUE_TYPE { fdomain = 34, sdf = 35, - action = 99, + action = 99, } enum VALUE_DISPLAY {