[Composite] Dynamic selection now allow none selection.

This commit is contained in:
Tanasart 2025-01-29 10:24:29 +07:00
parent ea505889d9
commit 662e1dee54
6 changed files with 151 additions and 162 deletions

Binary file not shown.

View file

@ -22,6 +22,7 @@ function Node_2D_light(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
new scrollItem("Spot", s_node_2d_light_shape, 5), new scrollItem("Spot", s_node_2d_light_shape, 5),
new scrollItem("Flame", s_node_2d_light_shape, 6), new scrollItem("Flame", s_node_2d_light_shape, 6),
]; ];
typeListStr = array_create_ext(array_length(typeList), function(i) /*=>*/ {return typeList[i].name}); typeListStr = array_create_ext(array_length(typeList), function(i) /*=>*/ {return typeList[i].name});
static createNewInput = function() { static createNewInput = function() {

View file

@ -24,6 +24,7 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
attribute_surface_depth(); attribute_surface_depth();
attribute_interpolation(); attribute_interpolation();
dynamic_input_inspecting = noone;
attributes.layer_visible = []; attributes.layer_visible = [];
attributes.layer_selectable = []; attributes.layer_selectable = [];
properties_expand = []; properties_expand = [];
@ -44,9 +45,9 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
if(is_real(renaming)) if(is_real(renaming))
inputs[renaming].setName(_name); inputs[renaming].setName(_name);
else if(is_struct(renaming) && is_instanceof(renaming, Node)) else if(is_struct(renaming) && is(renaming, Node))
renaming.setDisplayName(_name) renaming.setDisplayName(_name)
renaming = noone; renaming = noone;
renaming_index = noone; renaming_index = noone;
}); });
@ -92,37 +93,35 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
var _lh = lh + ui(4) + _exp * eh; var _lh = lh + ui(4) + _exp * eh;
_h += _lh; _h += _lh;
#region extended if(_exp) { // expanded
if(_exp) { var _px = _x + ui(4);
var _px = _x + ui(4); var _py = _cy + lh + ui(4);
var _py = _cy + lh + ui(4); var _pw = _w - ui(8);
var _pw = _w - ui(8); var _ph = eh - ui(4);
var _ph = eh - ui(4);
var _pww = (_pw - ui(8)) / 2 - ui(8);
var _pww = (_pw - ui(8)) / 2 - ui(8); var _pwh = _ph - ui(8);
var _pwh = _ph - ui(8);
draw_sprite_stretched_ext(THEME.ui_panel_bg, 0, _px, _py, _pw, _ph, COLORS.node_composite_bg_blend, 1);
draw_sprite_stretched_ext(THEME.ui_panel_bg, 0, _px, _py, _pw, _ph, COLORS.node_composite_bg_blend, 1);
var jn_bld = inputs[index + 4];
var jn_bld = inputs[index + 4]; var jn_alp = inputs[index + 5];
var jn_alp = inputs[index + 5];
var wd_bld = jn_bld.editWidget;
var wd_bld = jn_bld.editWidget; var wd_alp = jn_alp.editWidget;
var wd_alp = jn_alp.editWidget;
var _param = new widgetParam(_px + ui(4), _py + ui(4), _pww, _pwh, jn_bld.showValue(), jn_bld.display_data, _m, layer_renderer.rx, layer_renderer.ry);
var _param = new widgetParam(_px + ui(4), _py + ui(4), _pww, _pwh, jn_bld.showValue(), jn_bld.display_data, _m, layer_renderer.rx, layer_renderer.ry); _param.font = f_p2;
_param.font = f_p2;
wd_bld.setFocusHover(_focus, _hover);
wd_bld.setFocusHover(_focus, _hover); wd_bld.drawParam(_param);
wd_bld.drawParam(_param);
var _param = new widgetParam(_px + ui(4) + _pww + ui(8), _py + ui(4), _pww, _pwh, jn_alp.showValue(), jn_alp.display_data, _m, layer_renderer.rx, layer_renderer.ry);
var _param = new widgetParam(_px + ui(4) + _pww + ui(8), _py + ui(4), _pww, _pwh, jn_alp.showValue(), jn_alp.display_data, _m, layer_renderer.rx, layer_renderer.ry); _param.font = f_p2;
_param.font = f_p2;
wd_alp.setFocusHover(_focus, _hover);
wd_alp.setFocusHover(_focus, _hover); wd_alp.drawParam(_param);
wd_alp.drawParam(_param); }
}
#endregion
#region draw buttons #region draw buttons
if(point_in_circle(_m[0], _m[1], _bx, _cy + lh / 2, ui(16))) { if(point_in_circle(_m[0], _m[1], _bx, _cy + lh / 2, ui(16))) {
@ -175,8 +174,8 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
var _sss = min(ssh / _ssw, ssh / _ssh); var _sss = min(ssh / _ssw, ssh / _ssh);
draw_surface_ext_safe(_surf, _sx0, _sy0, _sss, _sss, 0, c_white, 1); draw_surface_ext_safe(_surf, _sx0, _sy0, _sss, _sss, 0, c_white, 1);
if(surface_selecting == index) draw_sprite_stretched_add(THEME.box_r2, 1, _sx0, _sy0, ssh, ssh, COLORS._main_accent, 1); if(dynamic_input_inspecting == ind) draw_sprite_stretched_add(THEME.box_r2, 1, _sx0, _sy0, ssh, ssh, COLORS._main_accent, 1);
else draw_sprite_stretched_add(THEME.box_r2, 1, _sx0, _sy0, ssh, ssh, COLORS._main_icon, 0.3); else draw_sprite_stretched_add(THEME.box_r2, 1, _sx0, _sy0, ssh, ssh, COLORS._main_icon, 0.3);
#endregion #endregion
#region canvas layers #region canvas layers
@ -196,9 +195,10 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
if(_junc_canvas) hover &= _m[0] > _txx + ui(8 + 16); if(_junc_canvas) hover &= _m[0] > _txx + ui(8 + 16);
var tc = ind == dynamic_input_inspecting? COLORS._main_text_accent : COLORS._main_icon; var tc = ind == dynamic_input_inspecting? COLORS._main_text_accent : COLORS._main_icon;
var tf = ind == dynamic_input_inspecting? f_p1b : f_p1;
if(hover) tc = COLORS._main_text; if(hover) tc = COLORS._main_text;
draw_set_text(f_p1, fa_left, fa_center, tc); draw_set_text(tf, fa_left, fa_center, tc);
if(canvas_draw != noone && _junc_canvas) if(canvas_draw != noone && _junc_canvas)
_txt = _junc_canvas.display_name; _txt = _junc_canvas.display_name;
@ -238,49 +238,47 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
} }
#endregion #endregion
#region modifiers if(_jun_layer) { // modifiers
if(_jun_layer) { var _modis = _jun_layer.modifier;
var _modis = _jun_layer.modifier; var _mdx = _sx0;
var _mdx = _sx0; var _mdy = _cy + _lh;
var _mdy = _cy + _lh; var mh = ui(24);
var mh = ui(24);
for (var j = array_length(_modis) - 1; j >= 0; j--) {
var _modi = _modis[j];
var _mtx = _mdx;
for (var j = array_length(_modis) - 1; j >= 0; j--) { if(_modi.active_index != -1) {
var _modi = _modis[j]; var _bx = _mtx + ui(12);
var _mtx = _mdx; var _by = _mdy + mh / 2;
if(_modi.active_index != -1) { var _acti = _modi.getInputData(_modi.active_index);
var _bx = _mtx + ui(12);
var _by = _mdy + mh / 2; if(_hover && point_in_circle(_m[0], _m[1], _bx, _by, ui(12))) {
draw_sprite_ui_uniform(THEME.visible_12, _acti, _bx, _by - ui(2), 1, c_white);
var _acti = _modi.getInputData(_modi.active_index); if(mouse_press(mb_left, _focus))
_modi.inputs[_modi.active_index].setValue(!_acti);
} else
draw_sprite_ui_uniform(THEME.visible_12, _acti, _bx, _by - ui(2), 1, COLORS._main_icon);
if(_hover && point_in_circle(_m[0], _m[1], _bx, _by, ui(12))) {
draw_sprite_ui_uniform(THEME.visible_12, _acti, _bx, _by - ui(2), 1, c_white);
if(mouse_press(mb_left, _focus))
_modi.inputs[_modi.active_index].setValue(!_acti);
} else
draw_sprite_ui_uniform(THEME.visible_12, _acti, _bx, _by - ui(2), 1, COLORS._main_icon);
}
_mtx += ui(24);
var _mhov = _hover && point_in_rectangle(_m[0], _m[1], _mtx, _mdy, _x + _w, _mdy + mh - 1);
draw_set_text(f_p2, fa_left, fa_center, _mhov? COLORS._main_text : COLORS._main_text_sub);
draw_text_add(_mtx, _mdy + mh / 2 - ui(2), _modi.display_name);
if(_mhov && DOUBLE_CLICK) {
var pan = panelAdd("Panel_Inspector", true);
pan.content.setInspecting(_modi, true);
}
_h += mh;
_lh += mh;
_mdy += mh;
} }
_mtx += ui(24);
var _mhov = _hover && point_in_rectangle(_m[0], _m[1], _mtx, _mdy, _x + _w, _mdy + mh - 1);
draw_set_text(f_p2, fa_left, fa_center, _mhov? COLORS._main_text : COLORS._main_text_sub);
draw_text_add(_mtx, _mdy + mh / 2 - ui(2), _modi.display_name);
if(_mhov && DOUBLE_CLICK) {
var pan = panelAdd("Panel_Inspector", true);
pan.content.setInspecting(_modi, true);
}
_h += mh;
_lh += mh;
_mdy += mh;
} }
#endregion }
if(_hover && point_in_rectangle(_m[0], _m[1], _x, _cy, _x + _w, _cy + lh)) { if(_hover && point_in_rectangle(_m[0], _m[1], _x, _cy, _x + _w, _cy + lh)) {
hoverIndex = ind; hoverIndex = ind;
@ -319,10 +317,8 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
} }
if(mouse_press(mb_left, _focus)) { if(mouse_press(mb_left, _focus)) {
layer_dragging = ind; dynamic_input_inspecting = dynamic_input_inspecting == ind? noone : ind;
surface_selecting = index; layer_dragging = ind;
dynamic_input_inspecting = ind;
refreshDynamicDisplay(); refreshDynamicDisplay();
} }
} }
@ -419,9 +415,7 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
.setUnitRef(function(index) { return [ overlay_w, overlay_h ]; }); .setUnitRef(function(index) { return [ overlay_w, overlay_h ]; });
newInput(index + 2, nodeValue_Rotation($"Rotation {_s}", self, 0)); newInput(index + 2, nodeValue_Rotation($"Rotation {_s}", self, 0));
inputs[index + 2].options_histories = [ BLEND_TYPES, inputs[index + 2].options_histories = [ BLEND_TYPES, { cond: function() /*=>*/ {return LOADING_VERSION < 1_18_00_0}, list: global.BLEND_TYPES_18 } ];
{ cond: function() /*=>*/ {return LOADING_VERSION < 1_18_00_0}, list: global.BLEND_TYPES_18 }
];
newInput(index + 3, nodeValue_Vec2($"Scale {_s}", self, [ 1, 1 ] )); newInput(index + 3, nodeValue_Vec2($"Scale {_s}", self, [ 1, 1 ] ));
@ -430,11 +424,8 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
newInput(index + 5, nodeValue_Float($"Opacity {_s}", self, 1)) newInput(index + 5, nodeValue_Float($"Opacity {_s}", self, 1))
.setDisplay(VALUE_DISPLAY.slider); .setDisplay(VALUE_DISPLAY.slider);
while(_s >= array_length(attributes.layer_visible)) while(_s >= array_length(attributes.layer_visible)) array_push(attributes.layer_visible, true);
array_push(attributes.layer_visible, true); while(_s >= array_length(attributes.layer_selectable)) array_push(attributes.layer_selectable, true);
while(_s >= array_length(attributes.layer_selectable))
array_push(attributes.layer_selectable, true);
refreshDynamicDisplay(); refreshDynamicDisplay();
return inputs[index + 0]; return inputs[index + 0];
@ -445,6 +436,10 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
["Transform", false], 1, 2, 3, ["Transform", false], 1, 2, 3,
]; ];
input_display_dynamic_full = [
["Surface", false], 0, 4, 5, 1, 2, 3,
];
input_display_list = [ input_display_list = [
["Output", true], 0, 1, 2, ["Output", true], 0, 1, 2,
["Layers", false], layer_renderer, ["Layers", false], layer_renderer,
@ -463,7 +458,6 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
temp_surface = [ surface_create(1, 1), surface_create(1, 1), surface_create(1, 1) ]; temp_surface = [ surface_create(1, 1), surface_create(1, 1), surface_create(1, 1) ];
blend_temp_surface = temp_surface[2]; blend_temp_surface = temp_surface[2];
surface_selecting = noone;
surf_dragging = -1; surf_dragging = -1;
input_dragging = -1; input_dragging = -1;
drag_type = 0; drag_type = 0;
@ -479,13 +473,6 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
overlay_h = 0; overlay_h = 0;
static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) { static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) {
// var amo = getInputAmount();
// for( var i = 0; i < amo; i++ ) {
// var index = input_fix_len + i * data_length;
// var _surf = inputs[index].getValue();
// draw_surface_ext_safe(_surf, 8 + 128 * i, 64, .5, .5, 0, c_white, 1);
// }
PROCESSOR_OVERLAY_CHECK PROCESSOR_OVERLAY_CHECK
var pad = current_data[0]; var pad = current_data[0];
@ -670,19 +657,23 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
var a = anchors[index]; var a = anchors[index];
if(!is_struct(a)) continue; if(!is_struct(a)) continue;
if(surface_selecting == index) { var _hov = point_in_rectangle_points(_mx, _my, a.d0[0], a.d0[1], a.d1[0], a.d1[1], a.d2[0], a.d2[1], a.d3[0], a.d3[1]);
if(dynamic_input_inspecting == i) {
var _ri = 0; var _ri = 0;
var _si = 0; var _si = 0;
if(point_in_circle(_mx, _my, a.d3[0], a.d3[1], 12)) { if(point_in_circle(_mx, _my, a.d3[0], a.d3[1], 12)) {
hovering = index; hovering = i;
hovering_type = NODE_COMPOSE_DRAG.scale; hovering_type = NODE_COMPOSE_DRAG.scale;
_si = 1; _si = 1;
} else if(point_in_rectangle_points(_mx, _my, a.d0[0], a.d0[1], a.d1[0], a.d1[1], a.d2[0], a.d2[1], a.d3[0], a.d3[1])) {
hovering = index; } else if(_hov) {
hovering = i;
hovering_type = NODE_COMPOSE_DRAG.move; hovering_type = NODE_COMPOSE_DRAG.move;
} else if(point_in_circle(_mx, _my, a.rr[0], a.rr[1], 12)) { } else if(point_in_circle(_mx, _my, a.rr[0], a.rr[1], 12)) {
hovering = index; hovering = i;
hovering_type = NODE_COMPOSE_DRAG.rotate; hovering_type = NODE_COMPOSE_DRAG.rotate;
_ri = 1; _ri = 1;
} }
@ -690,27 +681,27 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
draw_sprite_colored(THEME.anchor_rotate, _ri, a.rr[0], a.rr[1],, a.rot); draw_sprite_colored(THEME.anchor_rotate, _ri, a.rr[0], a.rr[1],, a.rot);
draw_sprite_colored(THEME.anchor_scale, _si, a.d3[0], a.d3[1],, a.rot); draw_sprite_colored(THEME.anchor_scale, _si, a.d3[0], a.d3[1],, a.rot);
} else if(point_in_rectangle_points(_mx, _my, a.d0[0], a.d0[1], a.d1[0], a.d1[1], a.d2[0], a.d2[1], a.d3[0], a.d3[1]) && } else if(_hov && (hovering != dynamic_input_inspecting || dynamic_input_inspecting == noone)) {
(hovering != surface_selecting || surface_selecting == noone)) { hovering = i;
hovering = index;
hovering_type = NODE_COMPOSE_DRAG.move; hovering_type = NODE_COMPOSE_DRAG.move;
} }
} }
if(mouse_press(mb_left, active)) { if(mouse_press(mb_left, active)) {
surface_selecting = hovering; dynamic_input_inspecting = hovering;
// dynamic_input_inspecting = hovering;
refreshDynamicDisplay(); refreshDynamicDisplay();
} }
if(surface_selecting != noone) { if(dynamic_input_inspecting != noone) {
var a = array_safe_get_fast(anchors, surface_selecting, noone); var _ss = input_fix_len + dynamic_input_inspecting * data_length;
if(!is_struct(a)) surface_selecting = noone; var a = array_safe_get_fast(anchors, _ss, noone);
if(!is_struct(a)) _ss = noone;
} }
if(hovering != noone) { if(hovering != noone) {
var a = anchors[hovering]; var hi = input_fix_len + hovering * data_length;
var a = anchors[hi];
draw_set_color(COLORS.node_composite_overlay_border); draw_set_color(COLORS.node_composite_overlay_border);
draw_line(a.d0[0], a.d0[1], a.d1[0], a.d1[1]); draw_line(a.d0[0], a.d0[1], a.d1[0], a.d1[1]);
@ -719,8 +710,9 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
draw_line(a.d3[0], a.d3[1], a.d2[0], a.d2[1]); draw_line(a.d3[0], a.d3[1], a.d2[0], a.d2[1]);
} }
if(surface_selecting != noone) { if(dynamic_input_inspecting != noone) {
var a = anchors[surface_selecting]; var _ss = input_fix_len + dynamic_input_inspecting * data_length;
var a = anchors[_ss];
draw_set_color(COLORS._main_accent); draw_set_color(COLORS._main_accent);
draw_line(a.d0[0], a.d0[1], a.d1[0], a.d1[1]); draw_line(a.d0[0], a.d0[1], a.d1[0], a.d1[1]);
@ -730,27 +722,30 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
} }
if(hovering != noone && mouse_press(mb_left, active)) { if(hovering != noone && mouse_press(mb_left, active)) {
var a = anchors[hovering]; var hi = input_fix_len + hovering * data_length;
var a = anchors[hi];
if(hovering_type == NODE_COMPOSE_DRAG.move) { if(hovering_type == NODE_COMPOSE_DRAG.move) {
surf_dragging = hovering; surf_dragging = hi;
input_dragging = hovering + 1; input_dragging = hi + 1;
drag_type = hovering_type; drag_type = hovering_type;
dragging_sx = current_data[hovering + 1][0]; dragging_sx = current_data[hi + 1][0];
dragging_sy = current_data[hovering + 1][1]; dragging_sy = current_data[hi + 1][1];
dragging_mx = _mx; dragging_mx = _mx;
dragging_my = _my; dragging_my = _my;
} else if(hovering_type == NODE_COMPOSE_DRAG.rotate) { //rot } else if(hovering_type == NODE_COMPOSE_DRAG.rotate) { //rot
surf_dragging = hovering; surf_dragging = hi;
input_dragging = hovering + 2; input_dragging = hi + 2;
drag_type = hovering_type; drag_type = hovering_type;
dragging_sx = current_data[hovering + 2]; dragging_sx = current_data[hi + 2];
rot_anc_x = overlay_x(a.cx, _x, _s); rot_anc_x = overlay_x(a.cx, _x, _s);
rot_anc_y = overlay_y(a.cy, _y, _s); rot_anc_y = overlay_y(a.cy, _y, _s);
dragging_mx = point_direction(rot_anc_x, rot_anc_y, _mx, _my); dragging_mx = point_direction(rot_anc_x, rot_anc_y, _mx, _my);
} else if(hovering_type == NODE_COMPOSE_DRAG.scale) { //sca } else if(hovering_type == NODE_COMPOSE_DRAG.scale) { //sca
surf_dragging = hovering; surf_dragging = hi;
input_dragging = hovering + 3; input_dragging = hi + 3;
drag_type = hovering_type; drag_type = hovering_type;
dragging_sx = _sca[0]; dragging_sx = _sca[0];
dragging_sy = _sca[1]; dragging_sy = _sca[1];
@ -763,18 +758,13 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
static step = function() { static step = function() {
var _dim_type = getSingleValue(1); var _dim_type = getSingleValue(1);
inputs[2].setVisible(_dim_type == COMPOSE_OUTPUT_SCALING.constant); inputs[2].setVisible(_dim_type == COMPOSE_OUTPUT_SCALING.constant);
if(canvas_draw != noone && surface_selecting == noone && getInputAmount())
surface_selecting = input_fix_len;
} }
static processData = function(_outData, _data, _output_index, _array_index) { static processData = function(_outData, _data, _output_index, _array_index) {
var _outSurf = _outData[0]; var _outSurf = _outData[0];
if(getInputAmount() == 0) return _outData; if(getInputAmount() == 0) return _outData;
dynamic_input_inspecting = clamp(dynamic_input_inspecting, 0, getInputAmount() - 1);
var _pad = _data[0]; var _pad = _data[0];
var _dim_type = _data[1]; var _dim_type = _data[1];
@ -840,8 +830,6 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
var _alp = _data[_ind + 5]; var _alp = _data[_ind + 5];
if(!is_surface(_s)) continue; if(!is_surface(_s)) continue;
// print($" < {CURRENT_FRAME}: in {_s}")
var _ww = surface_get_width_safe(_s); var _ww = surface_get_width_safe(_s);
var _hh = surface_get_height_safe(_s); var _hh = surface_get_height_safe(_s);
var _sw = _ww * _sca[0]; var _sw = _ww * _sca[0];
@ -867,11 +855,10 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
draw_surface_safe(temp_surface[!_bg]); draw_surface_safe(temp_surface[!_bg]);
surface_reset_shader(); surface_reset_shader();
// print($" > {CURRENT_FRAME}: out {_outSurf}\n")
_outData[0] = _outSurf; _outData[0] = _outSurf;
_outData[1] = _atlas; _outData[1] = _atlas;
_outData[2] = [ww, hh]; _outData[2] = [ww, hh];
return _outData; return _outData;
} }
@ -886,10 +873,7 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
static attributeDeserialize = function(attr) { static attributeDeserialize = function(attr) {
struct_append(attributes, attr); struct_append(attributes, attr);
if(struct_has(attr, "layer_visible")) if(struct_has(attr, "layer_visible")) attributes.layer_visible = attr.layer_visible;
attributes.layer_visible = attr.layer_visible; if(struct_has(attr, "layer_selectable")) attributes.layer_selectable = attr.layer_selectable;
if(struct_has(attr, "layer_selectable"))
attributes.layer_selectable = attr.layer_selectable;
} }
} }

View file

@ -404,12 +404,13 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
////- DYNAMIC IO ////- DYNAMIC IO
dummy_input = noone; dummy_input = noone;
auto_input = false; auto_input = false;
dyna_input_check_shift = 0; dyna_input_check_shift = 0;
input_display_dynamic = -1; input_display_dynamic = -1;
dynamic_input_inspecting = 0; input_display_dynamic_full = -1;
static createNewInput = -1; dynamic_input_inspecting = 0;
static createNewInput = -1;
static setDynamicInput = function(_data_length = 1, _auto_input = true, _dummy_type = VALUE_TYPE.any, _dynamic_input_cond = DYNA_INPUT_COND.connection) { static setDynamicInput = function(_data_length = 1, _auto_input = true, _dummy_type = VALUE_TYPE.any, _dynamic_input_cond = DYNA_INPUT_COND.connection) {
is_dynamic_input = true; is_dynamic_input = true;
@ -440,7 +441,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
for( var i = 0; i < input_fix_len; i++ ) for( var i = 0; i < input_fix_len; i++ )
array_push(_in, inputs[i]); array_push(_in, inputs[i]);
input_display_list = array_clone(input_display_list_raw, 1); var _input_display_list = array_clone(input_display_list_raw, 1);
var sep = false; var sep = false;
for( var i = input_fix_len; i < array_length(inputs); i += data_length ) { for( var i = input_fix_len; i < array_length(inputs); i += data_length ) {
@ -456,14 +457,14 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
} }
if(_active) { if(_active) {
if(sep && data_length > 1) array_push(input_display_list, new Inspector_Spacer(20, true)); if(sep && data_length > 1) array_push(_input_display_list, new Inspector_Spacer(20, true));
sep = true; sep = true;
for( var j = 0; j < data_length; j++ ) { for( var j = 0; j < data_length; j++ ) {
var _ind = i + j; var _ind = i + j;
if(input_display_list != -1) if(_input_display_list != -1)
array_push(input_display_list, array_length(_in)); array_push(_input_display_list, array_length(_in));
array_push(_in, inputs[_ind]); array_push(_in, inputs[_ind]);
} }
} else { } else {
@ -477,10 +478,10 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
_in[i].index = i; _in[i].index = i;
if(dummy_input) dummy_input.index = _ina; if(dummy_input) dummy_input.index = _ina;
inputs = _in; inputs = _in;
refreshNodeDisplay(); refreshNodeDisplay();
if(input_display_dynamic == -1) input_display_list = _input_display_list;
} }
static refreshDynamicDisplay = function() { static refreshDynamicDisplay = function() {
@ -488,18 +489,25 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
array_resize(input_display_list, array_length(input_display_list_raw)); array_resize(input_display_list, array_length(input_display_list_raw));
var _amo = getInputAmount(); var _amo = getInputAmount();
if(_amo == 0) { if(_amo == 0) { dynamic_input_inspecting = 0; return; }
dynamic_input_inspecting = 0;
dynamic_input_inspecting = min(dynamic_input_inspecting, _amo - 1);
if(dynamic_input_inspecting == noone) {
var _list = input_display_dynamic_full == -1? input_display_dynamic : input_display_dynamic_full;
for( var j = 0; j < _amo; j++ ) {
var _ind = input_fix_len + j * data_length;
for( var i = 0, n = array_length(_list); i < n; i++ ) {
var v = _list[i]; if(is_real(v)) v += _ind;
array_push(input_display_list, v);
}
}
return; return;
} }
dynamic_input_inspecting = clamp(dynamic_input_inspecting, 0, getInputAmount() - 1);
var _ind = input_fix_len + dynamic_input_inspecting * data_length; var _ind = input_fix_len + dynamic_input_inspecting * data_length;
for( var i = 0, n = array_length(input_display_dynamic); i < n; i++ ) { for( var i = 0, n = array_length(input_display_dynamic); i < n; i++ ) {
var v = input_display_dynamic[i]; var v = input_display_dynamic[i]; if(is_real(v)) v += _ind;
if(is_real(v)) v += _ind;
array_push(input_display_list, v); array_push(input_display_list, v);
} }
} }
@ -558,7 +566,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
var _ind = input_fix_len + index * data_length; var _ind = input_fix_len + index * data_length;
array_delete(inputs, _ind, data_length); array_delete(inputs, _ind, data_length);
dynamic_input_inspecting = clamp(dynamic_input_inspecting, 0, getInputAmount() - 1); dynamic_input_inspecting = min(dynamic_input_inspecting, getInputAmount() - 1);
refreshDynamicDisplay(); refreshDynamicDisplay();
triggerRender(); triggerRender();
} }

View file

@ -26,12 +26,8 @@ function Node_Processor(_x, _y, _group = noone) : Node(_x, _y, _group) construct
icon = THEME.node_processor_icon; icon = THEME.node_processor_icon;
array_push(attributeEditors, "Array processor"); array_push(attributeEditors, "Array processor");
array_push(attributeEditors, [ "Array process type", function() { return attributes.array_process; }, array_push(attributeEditors, [ "Array process type", function() /*=>*/ {return attributes.array_process},
new scrollBox([ "Loop", "Hold", "Expand", "Expand inverse" ], new scrollBox([ "Loop", "Hold", "Expand", "Expand inverse" ], function(val) /*=>*/ { attributes.array_process = val; triggerRender(); }, false) ]);
function(val) {
attributes.array_process = val;
triggerRender();
}, false) ]);
static getInputData = function(index, def = 0) { INLINE return array_safe_get_fast(inputs_data, index, def); } static getInputData = function(index, def = 0) { INLINE return array_safe_get_fast(inputs_data, index, def); }

View file

@ -3114,7 +3114,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
} }
cx = cx + 160; cx = cx + 160;
cy = round(cy / len / 32) * 32; cy = value_snap(cy / len, 16);
var _compose = nodeBuild(_ty, cx, cy, getCurrentContext()).skipDefault(); var _compose = nodeBuild(_ty, cx, cy, getCurrentContext()).skipDefault();