2023-02-28 09:43:01 +01:00
|
|
|
function Node_Group_Input(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
2023-02-19 13:49:20 +01:00
|
|
|
name = "Group Input";
|
2023-02-14 05:32:32 +01:00
|
|
|
destroy_when_upgroup = true;
|
2022-12-10 05:06:01 +01:00
|
|
|
color = COLORS.node_blend_collection;
|
2022-01-13 05:24:03 +01:00
|
|
|
previewable = false;
|
|
|
|
auto_height = false;
|
2023-01-17 08:11:55 +01:00
|
|
|
input_fix_len = -1;
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2022-01-18 05:31:19 +01:00
|
|
|
inParent = undefined;
|
2022-01-13 05:24:03 +01:00
|
|
|
|
|
|
|
w = 96;
|
|
|
|
h = 32 + 24;
|
2022-01-16 05:17:35 +01:00
|
|
|
min_h = h;
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-06-13 14:42:06 +02:00
|
|
|
data_type_list = [ "Integer", "Float", "Boolean", "Color", "Surface",
|
|
|
|
"File Path", "Curve", "Text", "Object", "Node",
|
|
|
|
"3D object", "Any", "Path", "Particle", "Rigidbody Object",
|
|
|
|
"Fluid Domain", "Struct", "Strands", "Mesh", "Trigger"
|
|
|
|
];
|
|
|
|
|
|
|
|
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,
|
|
|
|
VALUE_TYPE.d3object, VALUE_TYPE.any, VALUE_TYPE.pathnode, VALUE_TYPE.particle, VALUE_TYPE.rigid,
|
|
|
|
VALUE_TYPE.fdomain, VALUE_TYPE.struct, VALUE_TYPE.strands, VALUE_TYPE.mesh, VALUE_TYPE.trigger
|
|
|
|
];
|
|
|
|
|
2022-12-23 04:45:52 +01:00
|
|
|
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*/ [ "Default" ],
|
|
|
|
/*Color*/ [ "Default", "Gradient", "Palette" ],
|
|
|
|
/*Surface*/ [ "Default", ],
|
|
|
|
/*Path*/ [ "Default", ],
|
|
|
|
/*Curve*/ [ "Default", ],
|
|
|
|
/*Text*/ [ "Default", ],
|
|
|
|
/*Object*/ [ "Default", ],
|
2023-01-01 02:06:02 +01:00
|
|
|
/*Node*/ [ "Default", ],
|
|
|
|
/*3D*/ [ "Default", ],
|
2022-12-23 04:45:52 +01:00
|
|
|
/*Any*/ [ "Default", ],
|
2023-03-19 09:17:39 +01:00
|
|
|
/*Pathnode*/[ "Default", ],
|
|
|
|
/*Particle*/[ "Default", ],
|
|
|
|
/*Rigid*/ [ "Default", ],
|
|
|
|
/*Fdomain*/ [ "Default", ],
|
|
|
|
/*Struct*/ [ "Default", ],
|
|
|
|
/*Strand*/ [ "Default", ],
|
|
|
|
/*Mesh*/ [ "Default", ],
|
2023-06-13 14:42:06 +02:00
|
|
|
/*Trigger*/ [ "Default", ],
|
2023-03-19 09:17:39 +01:00
|
|
|
];
|
2022-12-23 04:45:52 +01:00
|
|
|
|
2023-02-14 05:32:32 +01:00
|
|
|
inputs[| 0] = nodeValue("Display type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
|
|
|
|
.setDisplay(VALUE_DISPLAY.enum_scroll, display_list[0])
|
2023-07-25 20:12:40 +02:00
|
|
|
.uncache()
|
2023-02-14 05:32:32 +01:00
|
|
|
.rejectArray();
|
2023-03-08 07:35:51 +01:00
|
|
|
inputs[| 0].editWidget.update_hover = false;
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-02-14 05:32:32 +01:00
|
|
|
inputs[| 1] = nodeValue("Range", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [0, 1])
|
2023-03-08 07:35:51 +01:00
|
|
|
.setDisplay(VALUE_DISPLAY.vector_range)
|
2023-07-25 20:12:40 +02:00
|
|
|
.uncache()
|
2023-02-14 05:32:32 +01:00
|
|
|
.setVisible(false)
|
|
|
|
.rejectArray();
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-02-14 05:32:32 +01:00
|
|
|
inputs[| 2] = nodeValue("Input type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
|
2023-06-13 14:42:06 +02:00
|
|
|
.setDisplay(VALUE_DISPLAY.enum_scroll, data_type_list, { update_hover: false })
|
2023-07-25 20:12:40 +02:00
|
|
|
.uncache()
|
2023-02-14 05:32:32 +01:00
|
|
|
.rejectArray();
|
2023-03-08 07:35:51 +01:00
|
|
|
inputs[| 2].editWidget.update_hover = false;
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-02-14 05:32:32 +01:00
|
|
|
inputs[| 3] = nodeValue("Enum label", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "")
|
|
|
|
.setVisible(false)
|
2023-07-25 20:12:40 +02:00
|
|
|
.uncache()
|
2023-02-14 05:32:32 +01:00
|
|
|
.rejectArray();
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-02-14 05:32:32 +01:00
|
|
|
inputs[| 4] = nodeValue("Vector size", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
|
2023-03-05 07:16:44 +01:00
|
|
|
.setDisplay(VALUE_DISPLAY.enum_button, [ "2", "3", "4" ], { update_hover: false })
|
2023-02-14 05:32:32 +01:00
|
|
|
.setVisible(false)
|
2023-07-25 20:12:40 +02:00
|
|
|
.uncache()
|
2023-02-14 05:32:32 +01:00
|
|
|
.rejectArray();
|
2022-01-18 05:31:19 +01:00
|
|
|
|
2023-02-14 05:32:32 +01:00
|
|
|
inputs[| 5] = nodeValue("Order", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
|
2023-07-25 20:12:40 +02:00
|
|
|
.uncache()
|
2023-02-14 05:32:32 +01:00
|
|
|
.rejectArray();
|
2022-01-19 03:05:13 +01:00
|
|
|
|
2023-03-11 01:40:17 +01:00
|
|
|
inputs[| 6] = nodeValue("Display preview gizmo", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true)
|
2023-07-25 20:12:40 +02:00
|
|
|
.uncache()
|
2023-02-14 05:32:32 +01:00
|
|
|
.rejectArray();
|
2023-01-01 02:06:02 +01:00
|
|
|
|
2023-03-08 07:35:51 +01:00
|
|
|
inputs[| 7] = nodeValue("Step", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.01)
|
|
|
|
.setVisible(false)
|
2023-07-25 20:12:40 +02:00
|
|
|
.uncache()
|
2023-03-08 07:35:51 +01:00
|
|
|
.rejectArray();
|
2023-06-13 14:42:06 +02:00
|
|
|
|
|
|
|
inputs[| 8] = nodeValue("Button Label", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "Trigger")
|
|
|
|
.setVisible(false)
|
2023-07-25 20:12:40 +02:00
|
|
|
.uncache()
|
2023-06-13 14:42:06 +02:00
|
|
|
.rejectArray();
|
2023-03-08 07:35:51 +01:00
|
|
|
|
2022-01-18 05:31:19 +01:00
|
|
|
input_display_list = [
|
2023-01-01 02:06:02 +01:00
|
|
|
["Display", false], 5, 6,
|
2023-06-13 14:42:06 +02:00
|
|
|
["Data", false], 2, 0, 4, 1, 7, 3, 8,
|
2022-01-18 05:31:19 +01:00
|
|
|
];
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-07-25 20:12:40 +02:00
|
|
|
outputs[| 0] = nodeValue("Value", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, 0)
|
|
|
|
.uncache();
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-06-13 14:42:06 +02:00
|
|
|
attributes.inherit_name = true;
|
|
|
|
doTrigger = 0;
|
|
|
|
|
|
|
|
_onSetDisplayName = function() {
|
|
|
|
attributes.inherit_name = false;
|
|
|
|
}
|
|
|
|
|
2023-01-01 02:06:02 +01:00
|
|
|
static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) {
|
2023-01-25 06:49:00 +01:00
|
|
|
if(inParent.isArray()) return;
|
2023-01-01 02:06:02 +01:00
|
|
|
inParent.drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny);
|
|
|
|
}
|
|
|
|
|
2023-02-14 05:32:32 +01:00
|
|
|
static onValueUpdate = function(index = 0) {
|
2022-01-18 05:31:19 +01:00
|
|
|
if(is_undefined(inParent)) return;
|
|
|
|
|
2023-03-08 07:35:51 +01:00
|
|
|
var _dtype = inputs[| 0].getValue();
|
|
|
|
var _range = inputs[| 1].getValue();
|
2023-06-13 14:42:06 +02:00
|
|
|
var _type = inputs[| 2].getValue();
|
|
|
|
var _val_type = data_type_map[_type];
|
2022-01-13 05:24:03 +01:00
|
|
|
var _enum_label = inputs[| 3].getValue();
|
2023-03-08 07:35:51 +01:00
|
|
|
var _vec_size = inputs[| 4].getValue();
|
|
|
|
var _step = inputs[| 7].getValue();
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2022-01-17 12:10:30 +01:00
|
|
|
if(index == 2) {
|
|
|
|
var _o = outputs[| 0];
|
|
|
|
for(var j = 0; j < ds_list_size(_o.value_to); j++) {
|
|
|
|
var _to = _o.value_to[| j];
|
|
|
|
if(_to.value_from == _o)
|
|
|
|
_to.removeFrom();
|
|
|
|
}
|
2022-12-23 04:45:52 +01:00
|
|
|
|
2023-06-17 18:59:20 +02:00
|
|
|
inputs[| 0].display_data = array_safe_get(display_list, _val_type);
|
|
|
|
inputs[| 0].editWidget.data_list = array_safe_get(display_list, _val_type);
|
2022-12-23 04:45:52 +01:00
|
|
|
inputs[| 0].setValue(0);
|
|
|
|
_dtype = 0;
|
2022-01-17 12:10:30 +01:00
|
|
|
}
|
|
|
|
|
2023-06-17 18:59:20 +02:00
|
|
|
_dtype = array_safe_get(array_safe_get(display_list, _val_type, []), _dtype);
|
2022-12-23 04:45:52 +01:00
|
|
|
|
2023-05-28 20:00:51 +02:00
|
|
|
inParent.type = _val_type;
|
2022-01-13 05:24:03 +01:00
|
|
|
outputs[| 0].type = _val_type;
|
2022-01-18 05:31:19 +01:00
|
|
|
var _val = inParent.getValue();
|
2022-01-13 05:24:03 +01:00
|
|
|
|
|
|
|
switch(_dtype) {
|
2023-03-08 07:35:51 +01:00
|
|
|
case "Range" :
|
|
|
|
inParent.setDisplay(VALUE_DISPLAY.range);
|
|
|
|
break;
|
2022-12-23 04:45:52 +01:00
|
|
|
|
2023-03-08 07:35:51 +01:00
|
|
|
case "Slider" :
|
|
|
|
inParent.setDisplay(VALUE_DISPLAY.slider, [_range[0], _range[1], _step]);
|
|
|
|
break;
|
|
|
|
case "Slider range" :
|
|
|
|
if(!is_array(_val) || array_length(_val) != 2)
|
|
|
|
inParent.animator = new valueAnimator([0, 0], inParent);
|
|
|
|
inParent.setDisplay(VALUE_DISPLAY.slider_range, [_range[0], _range[1], _step]);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "Rotation" :
|
|
|
|
inParent.setDisplay(VALUE_DISPLAY.rotation);
|
|
|
|
break;
|
2022-12-12 09:08:03 +01:00
|
|
|
|
2022-12-23 04:45:52 +01:00
|
|
|
case "Rotation range" :
|
2022-01-13 05:24:03 +01:00
|
|
|
if(!is_array(_val) || array_length(_val) != 2)
|
2022-09-23 13:28:42 +02:00
|
|
|
inParent.animator = new valueAnimator([0, 0], inParent);
|
2022-12-23 04:45:52 +01:00
|
|
|
inParent.setDisplay(VALUE_DISPLAY.rotation_range);
|
2022-01-13 05:24:03 +01:00
|
|
|
break;
|
|
|
|
|
2022-12-23 04:45:52 +01:00
|
|
|
case "Padding" :
|
2022-01-13 05:24:03 +01:00
|
|
|
if(!is_array(_val) || array_length(_val) != 4)
|
2022-09-23 13:28:42 +02:00
|
|
|
inParent.animator = new valueAnimator([0, 0, 0, 0], inParent);
|
2022-12-23 04:45:52 +01:00
|
|
|
inParent.setDisplay(VALUE_DISPLAY.padding);
|
2022-01-13 05:24:03 +01:00
|
|
|
break;
|
|
|
|
|
2022-12-23 04:45:52 +01:00
|
|
|
case "Area" :
|
2022-01-13 05:24:03 +01:00
|
|
|
if(!is_array(_val) || array_length(_val) != 5)
|
2022-09-23 13:28:42 +02:00
|
|
|
inParent.animator = new valueAnimator([0, 0, 0, 0, 5], inParent);
|
2022-12-23 04:45:52 +01:00
|
|
|
inParent.setDisplay(VALUE_DISPLAY.area);
|
2022-01-13 05:24:03 +01:00
|
|
|
break;
|
|
|
|
|
2022-12-23 04:45:52 +01:00
|
|
|
case "Vector" :
|
|
|
|
case "Vector range" :
|
2022-01-13 05:24:03 +01:00
|
|
|
switch(_vec_size) {
|
|
|
|
case 0 :
|
|
|
|
if(!is_array(_val) || array_length(_val) != 2)
|
2022-09-23 13:28:42 +02:00
|
|
|
inParent.animator = new valueAnimator([0, 0], inParent);
|
2022-01-13 05:24:03 +01:00
|
|
|
break;
|
|
|
|
case 1 :
|
|
|
|
if(!is_array(_val) || array_length(_val) != 3)
|
2022-09-23 13:28:42 +02:00
|
|
|
inParent.animator = new valueAnimator([0, 0, 0], inParent);
|
2022-01-13 05:24:03 +01:00
|
|
|
break;
|
|
|
|
case 2 :
|
|
|
|
if(!is_array(_val) || array_length(_val) != 4)
|
2022-09-23 13:28:42 +02:00
|
|
|
inParent.animator = new valueAnimator([0, 0, 0, 0], inParent);
|
2022-01-13 05:24:03 +01:00
|
|
|
break;
|
|
|
|
}
|
2022-12-23 04:45:52 +01:00
|
|
|
if(_dtype == "Vector") inParent.setDisplay(VALUE_DISPLAY.vector);
|
|
|
|
else if(_dtype == "Vector range") inParent.setDisplay(VALUE_DISPLAY.vector_range);
|
2022-01-13 05:24:03 +01:00
|
|
|
break;
|
2022-12-23 04:45:52 +01:00
|
|
|
|
|
|
|
case "Enum button" : inParent.setDisplay(VALUE_DISPLAY.enum_button, string_splice(_enum_label, ",")); break;
|
|
|
|
case "Menu scroll" : inParent.setDisplay(VALUE_DISPLAY.enum_scroll, string_splice(_enum_label, ",")); break;
|
|
|
|
|
|
|
|
case "Palette" :
|
2022-01-13 05:24:03 +01:00
|
|
|
if(!is_array(_val))
|
2022-09-23 13:28:42 +02:00
|
|
|
inParent.animator = new valueAnimator([c_black], inParent);
|
2022-12-23 04:45:52 +01:00
|
|
|
inParent.setDisplay(VALUE_DISPLAY.palette);
|
2022-01-13 05:24:03 +01:00
|
|
|
break;
|
|
|
|
|
2023-06-13 14:42:06 +02:00
|
|
|
case "Gradient":
|
2023-05-28 20:00:51 +02:00
|
|
|
inParent.type = VALUE_TYPE.gradient;
|
|
|
|
outputs[| 0].type = inParent.type;
|
|
|
|
|
2023-03-02 07:59:14 +01:00
|
|
|
inParent.animator = new valueAnimator(new gradientObject(c_white), inParent);
|
2023-05-28 20:00:51 +02:00
|
|
|
inParent.setDisplay(VALUE_DISPLAY._default);
|
2023-02-14 05:32:32 +01:00
|
|
|
break;
|
2023-06-13 14:42:06 +02:00
|
|
|
|
|
|
|
default:
|
|
|
|
inParent.setDisplay(VALUE_DISPLAY._default);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch(_val_type) {
|
|
|
|
case VALUE_TYPE.trigger :
|
|
|
|
var bname = inputs[| 8].getValue();
|
|
|
|
inParent.setDisplay(VALUE_DISPLAY.button, [ function() { doTrigger = 1; }, bname]);
|
|
|
|
break;
|
2022-01-13 05:24:03 +01:00
|
|
|
}
|
2022-01-18 05:31:19 +01:00
|
|
|
|
2022-12-12 09:08:03 +01:00
|
|
|
if(index == 5)
|
2022-01-19 06:11:17 +01:00
|
|
|
group.sortIO();
|
2022-01-13 05:24:03 +01:00
|
|
|
}
|
|
|
|
|
2022-01-25 04:05:30 +01:00
|
|
|
static createInput = function(override_order = true) {
|
2022-09-27 06:37:28 +02:00
|
|
|
if(group == noone || !is_struct(group)) return noone;
|
2023-06-13 14:42:06 +02:00
|
|
|
|
2022-09-27 06:37:28 +02:00
|
|
|
if(override_order) {
|
2023-01-17 08:11:55 +01:00
|
|
|
input_fix_len = ds_list_size(group.inputs);
|
|
|
|
inputs[| 5].setValue(input_fix_len);
|
2022-09-27 06:37:28 +02:00
|
|
|
} else {
|
2023-01-17 08:11:55 +01:00
|
|
|
input_fix_len = inputs[| 5].getValue();
|
2022-09-27 06:37:28 +02:00
|
|
|
}
|
2023-02-14 05:32:32 +01:00
|
|
|
|
|
|
|
if(!is_undefined(inParent))
|
|
|
|
ds_list_remove(group.inputs, inParent);
|
|
|
|
|
|
|
|
inParent = nodeValue("Value", group, JUNCTION_CONNECT.input, VALUE_TYPE.any, -1)
|
2023-07-25 20:12:40 +02:00
|
|
|
.uncache()
|
2022-09-27 06:37:28 +02:00
|
|
|
.setVisible(true, true);
|
|
|
|
inParent.from = self;
|
2023-06-01 10:32:21 +02:00
|
|
|
|
2022-09-27 06:37:28 +02:00
|
|
|
ds_list_add(group.inputs, inParent);
|
|
|
|
outputs[| 0].setFrom(inParent, false, false);
|
|
|
|
group.setHeight();
|
|
|
|
group.sortIO();
|
|
|
|
|
|
|
|
onValueUpdate(0);
|
|
|
|
|
|
|
|
return inParent;
|
2022-01-13 05:24:03 +01:00
|
|
|
}
|
|
|
|
|
2022-12-21 02:30:23 +01:00
|
|
|
if(!LOADING && !APPENDING) createInput();
|
2022-01-13 05:24:03 +01:00
|
|
|
|
|
|
|
dtype = -1;
|
|
|
|
range = 0;
|
|
|
|
|
2022-01-18 05:31:19 +01:00
|
|
|
static step = function() {
|
|
|
|
if(is_undefined(inParent)) return;
|
|
|
|
|
2023-04-15 14:48:29 +02:00
|
|
|
if(inParent.name != display_name) {
|
|
|
|
inParent.name = display_name;
|
|
|
|
group.inputMap[? string_replace_all(display_name, " ", "_")] = inParent;
|
|
|
|
}
|
2023-06-13 14:42:06 +02:00
|
|
|
|
|
|
|
var _to_list = outputs[| 0].value_to;
|
|
|
|
onSetDisplayName = _onSetDisplayName;
|
|
|
|
if(attributes.inherit_name && !ds_list_empty(_to_list)) {
|
|
|
|
for( var i = 0; i < ds_list_size(_to_list); i++ ) {
|
|
|
|
if(_to_list[| i].value_from != outputs[| 0]) continue;
|
|
|
|
if(display_name == _to_list[| i].name) break;
|
|
|
|
onSetDisplayName = noone;
|
|
|
|
setDisplayName(_to_list[| i].name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(inParent.type == VALUE_TYPE.trigger) {
|
|
|
|
if(doTrigger == 1) {
|
|
|
|
outputs[| 0].setValue(true);
|
|
|
|
doTrigger = -1;
|
|
|
|
} else if(doTrigger == -1) {
|
|
|
|
outputs[| 0].setValue(false);
|
|
|
|
doTrigger = 0;
|
|
|
|
}
|
|
|
|
}
|
2022-01-18 05:31:19 +01:00
|
|
|
}
|
|
|
|
|
2023-03-08 14:59:54 +01:00
|
|
|
PATCH_STATIC
|
|
|
|
|
2023-07-06 19:49:16 +02:00
|
|
|
static update = function(frame = PROJECT.animator.current_frame) {
|
2022-01-18 05:31:19 +01:00
|
|
|
if(is_undefined(inParent)) return;
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-06-13 14:42:06 +02:00
|
|
|
var _dstype = inputs[| 0].getValue();
|
2022-12-23 04:45:52 +01:00
|
|
|
var _data = inputs[| 2].getValue();
|
2023-06-17 18:59:20 +02:00
|
|
|
_dstype = array_safe_get(array_safe_get(display_list, _data, []), _dstype);
|
2023-06-13 14:42:06 +02:00
|
|
|
|
|
|
|
var _datype = data_type_map[_data];
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2022-01-19 06:11:17 +01:00
|
|
|
inputs[| 1].setVisible(false);
|
|
|
|
inputs[| 3].setVisible(false);
|
|
|
|
inputs[| 4].setVisible(false);
|
2023-03-08 07:35:51 +01:00
|
|
|
inputs[| 7].setVisible(false);
|
2023-06-13 14:42:06 +02:00
|
|
|
inputs[| 8].setVisible(_datype == VALUE_TYPE.trigger);
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-06-13 14:42:06 +02:00
|
|
|
switch(_dstype) {
|
2022-12-23 04:45:52 +01:00
|
|
|
case "Slider" :
|
|
|
|
case "Slider range" :
|
2023-03-08 07:35:51 +01:00
|
|
|
inputs[| 7].setVisible(true);
|
|
|
|
case "Range" :
|
2022-01-19 06:11:17 +01:00
|
|
|
inputs[| 1].setVisible(true);
|
2022-01-13 05:24:03 +01:00
|
|
|
break;
|
2022-12-23 04:45:52 +01:00
|
|
|
case "Enum button" :
|
|
|
|
case "Menu scroll" :
|
2022-01-19 06:11:17 +01:00
|
|
|
inputs[| 3].setVisible(true);
|
2022-01-13 05:24:03 +01:00
|
|
|
break;
|
2022-12-23 04:45:52 +01:00
|
|
|
case "Vector" :
|
|
|
|
case "Vector range" :
|
2022-01-19 06:11:17 +01:00
|
|
|
inputs[| 4].setVisible(true);
|
2022-01-13 05:24:03 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-18 05:31:19 +01:00
|
|
|
static postDeserialize = function() {
|
2022-01-25 04:05:30 +01:00
|
|
|
createInput(false);
|
2023-02-14 05:32:32 +01:00
|
|
|
|
2023-06-13 14:42:06 +02:00
|
|
|
var _inputs = load_map.inputs;
|
|
|
|
inputs[| 5].applyDeserialize(_inputs[5], load_scale);
|
2023-02-14 05:32:32 +01:00
|
|
|
group.sortIO();
|
2022-12-23 04:45:52 +01:00
|
|
|
|
2023-06-13 14:42:06 +02:00
|
|
|
inputs[| 2].applyDeserialize(_inputs[2], load_scale);
|
2022-12-23 04:45:52 +01:00
|
|
|
onValueUpdate(2);
|
2022-12-21 02:30:23 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static applyDeserialize = function() {
|
2023-06-13 14:42:06 +02:00
|
|
|
var _inputs = load_map.inputs;
|
|
|
|
var amo = min(array_length(_inputs), ds_list_size(inputs));
|
2023-01-01 02:06:02 +01:00
|
|
|
|
|
|
|
for(var i = 0; i < amo; i++) {
|
2022-12-23 04:45:52 +01:00
|
|
|
if(i == 2 || i == 5) continue;
|
2023-06-13 14:42:06 +02:00
|
|
|
inputs[| i].applyDeserialize(_inputs[i], load_scale);
|
2022-12-21 02:30:23 +01:00
|
|
|
}
|
2022-12-23 04:45:52 +01:00
|
|
|
|
2023-01-17 08:11:55 +01:00
|
|
|
inParent.name = name;
|
2022-01-13 05:24:03 +01:00
|
|
|
onValueUpdate(0);
|
|
|
|
}
|
|
|
|
|
2022-01-19 03:05:13 +01:00
|
|
|
static onDestroy = function() {
|
2022-01-18 05:31:19 +01:00
|
|
|
if(is_undefined(inParent)) return;
|
|
|
|
ds_list_remove(group.inputs, inParent);
|
2022-01-13 05:24:03 +01:00
|
|
|
}
|
2023-02-14 05:32:32 +01:00
|
|
|
|
|
|
|
static ungroup = function() {
|
|
|
|
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];
|
|
|
|
if(to.value_from != outputs[| 0]) continue;
|
|
|
|
|
|
|
|
to.setFrom(fr);
|
|
|
|
}
|
|
|
|
}
|
2022-01-13 05:24:03 +01:00
|
|
|
}
|