- [Array Loop] Fix error on creation.

This commit is contained in:
Tanasart 2024-05-24 15:33:27 +07:00
parent 338d2bd129
commit 214b152424
6 changed files with 26 additions and 8 deletions

View file

@ -49,6 +49,12 @@ function Node_Collection_Inline(_x, _y, _group = noone) : Node(_x, _y, _group) c
onAddNode(node);
} #endregion
static addPoint = function(_x, _y) {
add_point = true;
point_x = _x;
point_y = _y;
}
static onAddNode = function(node) {}
static ccw = function(a, b, c) { return (b[0] - a[0]) * (c[1] - a[1]) - (c[0] - a[0]) * (b[1] - a[1]); }

View file

@ -279,7 +279,9 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
array_push(attributes.layer_selectable, true);
return inputs[| index + 0];
} setDynamicInput(6);
}
setDynamicInput(6, true, VALUE_TYPE.surface);
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);

View file

@ -496,9 +496,9 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
for( var j = 0; j < data_length; j++ ) {
var _ind = i + j;
ds_list_add(_in, inputs[| _ind]);
if(input_display_list != -1)
array_push(input_display_list, _ind);
array_push(input_display_list, ds_list_size(_in));
ds_list_add(_in, inputs[| _ind]);
}
} else {
for( var j = 0; j < data_length; j++ )
@ -511,6 +511,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
ds_list_destroy(inputs);
inputs = _in;
} #endregion
static getInputAmount = function() { return (ds_list_size(inputs) - input_fix_len) / data_length; }

View file

@ -27,6 +27,8 @@ function Node_Iterator_Each_Inline_Input(_x, _y, _group = noone) : Node(_x, _y,
var val = inputs[| 0].getValue();
var itr = loop.iterated - 1;
outputs[| 0].setValue(val[itr]);
if(!is_array(val)) return;
outputs[| 0].setValue(array_safe_get_fast(val, itr));
} #endregion
}

View file

@ -30,6 +30,8 @@ function Node_Iterator_Each_Inline_Output(_x, _y, _group = noone) : Node(_x, _y,
var arr = outputs[| 0].getValue();
var itr = loop.iterated - 1;
if(!is_array(arr)) return;
if(_typ == VALUE_TYPE.surface) {
if(is_instanceof(val, SurfaceAtlas))
arr[@ itr] = val.clone();

View file

@ -1419,12 +1419,17 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
if(target) target.drawJunction(graph_s, target.x, target.y);
var _inline_ctx = value_dragging.node.inline_context;
if(_inline_ctx && !key_mod_press(SHIFT)) {
_inline_ctx.add_point = true;
_inline_ctx.point_x = mouse_graph_x;
_inline_ctx.point_y = mouse_graph_y;
if(_inline_ctx) {
if(is_instanceof(value_dragging.node, _inline_ctx.input_node_type) && value_dragging.connect_type == JUNCTION_CONNECT.input)
_inline_ctx = noone;
else if(is_instanceof(value_dragging.node, _inline_ctx.output_node_type) && value_dragging.connect_type == JUNCTION_CONNECT.output)
_inline_ctx = noone;
}
if(_inline_ctx && !key_mod_press(SHIFT))
_inline_ctx.addPoint(mouse_graph_x, mouse_graph_y);
if(mouse_release(mb_left)) { //// CONNECT junction
var _connect = [ 0, noone, noone ];