- [Group] Fix output junction order changing between session.

This commit is contained in:
Tanasart 2024-07-29 11:35:10 +07:00
parent dcfc41379c
commit aec420ef15
5 changed files with 26 additions and 14 deletions

View file

@ -682,7 +682,9 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc
for( var i = 0, n = array_length(_ilist); i < n; i++ ) { for( var i = 0, n = array_length(_ilist); i < n; i++ ) {
if(!struct_has(_inarr, _ilist[i])) continue; if(!struct_has(_inarr, _ilist[i])) continue;
ds_list_add(inputs, _inarr[$ _ilist[i]]); var _inJunc = _inarr[$ _ilist[i]];
_inJunc.index = ds_list_size(inputs);
ds_list_add(inputs, _inJunc);
} }
} }
@ -708,7 +710,9 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc
for( var i = 0, n = array_length(_ilist); i < n; i++ ) { for( var i = 0, n = array_length(_ilist); i < n; i++ ) {
if(!struct_has(_inarr, _ilist[i])) continue; if(!struct_has(_inarr, _ilist[i])) continue;
ds_list_add(outputs, _inarr[$ _ilist[i]]); var _outJunc = _inarr[$ _ilist[i]];
_outJunc.index = ds_list_size(outputs);
ds_list_add(outputs, _outJunc);
} }
} }

View file

@ -23,6 +23,8 @@ enum NODE_3D {
function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
#region ---- main & active ---- #region ---- main & active ----
project = PROJECT;
active = true; active = true;
renderActive = true; renderActive = true;

View file

@ -165,14 +165,15 @@ function Node_Frame(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
var x0 = x1 - 16; var x0 = x1 - 16;
var y0 = y1 - 16; var y0 = y1 - 16;
var ics = 0.5; var ics = 0.5;
var shf = 8 + 8 * ics;
if(w * _s < 32 || h * _s < 32) return point_in_rectangle(_mx, _my, xx, yy, x1, y1); if(w * _s < 32 || h * _s < 32) return point_in_rectangle(_mx, _my, xx, yy, x1, y1);
if(point_in_rectangle(_mx, _my, xx, yy, x1, y1) || size_dragging) if(point_in_rectangle(_mx, _my, xx, yy, x1, y1) || size_dragging)
draw_sprite_ext_add(THEME.node_resize, 0, x1 - 4, y1 - 4, ics, ics, 0, c_white, 0.5); draw_sprite_ext_add(THEME.node_resize, 0, x1 - shf, y1 - shf, ics, ics, 0, c_white, 0.5);
if(!name_hover && point_in_rectangle(_mx, _my, x0, y0, x1, y1)) { if(!name_hover && point_in_rectangle(_mx, _my, x0, y0, x1, y1)) {
draw_sprite_ext_add(THEME.node_resize, 0, x1 - 4, y1 - 4, ics, ics, 0, c_white, 1); draw_sprite_ext_add(THEME.node_resize, 0, x1 - shf, y1 - shf, ics, ics, 0, c_white, 1);
PANEL_GRAPH.drag_locking = true; PANEL_GRAPH.drag_locking = true;

View file

@ -527,8 +527,8 @@ function Panel_Inspector() : PanelContent() constructor {
_inspecting.inspecting = true; _inspecting.inspecting = true;
prop_hover = noone; prop_hover = noone;
var jun = noone; var jun = noone;
var amoIn = _inspecting.input_display_list == -1? ds_list_size(_inspecting.inputs) : array_length(_inspecting.input_display_list); var amoIn = is_array(_inspecting.input_display_list)? array_length(_inspecting.input_display_list) : ds_list_size(_inspecting.inputs);
var amoOut = _inspecting.output_display_list == -1? ds_list_size(_inspecting.outputs) : array_length(_inspecting.output_display_list); var amoOut = is_array(_inspecting.output_display_list)? array_length(_inspecting.output_display_list) : ds_list_size(_inspecting.outputs);
var amo = inspectGroup == 0? amoIn + 1 + amoOut : amoIn; var amo = inspectGroup == 0? amoIn + 1 + amoOut : amoIn;
var hh = 0; var hh = 0;
@ -637,9 +637,9 @@ function Panel_Inspector() : PanelContent() constructor {
var yy = hh + _y; var yy = hh + _y;
if(i < amoIn) { // inputs if(i < amoIn) { // inputs
if(_inspecting.input_display_list == -1) jun = _inspecting.inputs[| i]; if(!is_array(_inspecting.input_display_list)) jun = _inspecting.inputs[| i];
else if(is_real(_inspecting.input_display_list[i])) jun = _inspecting.inputs[| _inspecting.input_display_list[i]]; else if(is_real(_inspecting.input_display_list[i])) jun = _inspecting.inputs[| _inspecting.input_display_list[i]];
else jun = _inspecting.input_display_list[i]; else jun = _inspecting.input_display_list[i];
} else if(i == amoIn) { // output label } else if(i == amoIn) { // output label
hh += ui(8 + 32 + 8); hh += ui(8 + 32 + 8);
@ -652,8 +652,8 @@ function Panel_Inspector() : PanelContent() constructor {
} else { // outputs } else { // outputs
var _oi = i - amoIn - 1; var _oi = i - amoIn - 1;
if(_inspecting.output_display_list == -1) jun = _inspecting.outputs[| _oi]; if(!is_array(_inspecting.output_display_list)) jun = _inspecting.outputs[| _oi];
else if(is_real(_inspecting.output_display_list[i])) jun = _inspecting.outputs[| _inspecting.output_display_list[_oi]]; else if(is_real(_inspecting.output_display_list[_oi])) jun = _inspecting.outputs[| _inspecting.output_display_list[_oi]];
else jun = _inspecting.output_display_list[_oi]; else jun = _inspecting.output_display_list[_oi];
} }

View file

@ -389,14 +389,20 @@ function Panel_Preview() : PanelContent() constructor {
if(preview_node[1] == node) preview_node[1] = noone; if(preview_node[1] == node) preview_node[1] = noone;
} #endregion } #endregion
function resetNodePreview() { #region function resetNodePreview() {
preview_node = [ noone, noone ]; preview_node = [ noone, noone ];
locked = false; locked = false;
} #endregion }
function __getNodePreview() { return preview_node[splitView? splitSelection : 0]; } function __getNodePreview() { return preview_node[splitView? splitSelection : 0]; }
function getNodePreview() { function getNodePreview() {
var _node = __getNodePreview(); var _node = __getNodePreview();
if(_node == noone) return noone;
if(!_node.project.active) {
resetNodePreview();
return noone;
}
if(is_instanceof(_node, Node)) if(is_instanceof(_node, Node))
_node = _node.getPreviewingNode(); _node = _node.getPreviewingNode();
@ -2030,7 +2036,6 @@ function Panel_Preview() : PanelContent() constructor {
var _prev_node = getNodePreview(); var _prev_node = getNodePreview();
d3_active = _prev_node == noone? NODE_3D.none : _prev_node.is_3D; d3_active = _prev_node == noone? NODE_3D.none : _prev_node.is_3D;
//print($"{_prev_node} : {d3_active}")
bg_color = lerp_color(bg_color, d3_active? COLORS.panel_3d_bg : COLORS.panel_bg_clear, 0.3); bg_color = lerp_color(bg_color, d3_active? COLORS.panel_3d_bg : COLORS.panel_bg_clear, 0.3);
draw_clear(bg_color); draw_clear(bg_color);