mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-12-25 22:46:19 +01:00
- [Graph Panel] Fix crash when deleting multiple noeds.
This commit is contained in:
parent
e67d134d2a
commit
94330dd272
4 changed files with 43 additions and 4 deletions
|
@ -576,7 +576,7 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc
|
||||||
instanceBase = noone;
|
instanceBase = noone;
|
||||||
} #endregion
|
} #endregion
|
||||||
|
|
||||||
static onDoubleClick = function(panel) { #region
|
function onDoubleClick(panel) { #region
|
||||||
if(PREFERENCES.panel_graph_group_require_shift && !key_mod_press(SHIFT)) return false;
|
if(PREFERENCES.panel_graph_group_require_shift && !key_mod_press(SHIFT)) return false;
|
||||||
|
|
||||||
__temp_panel = panel;
|
__temp_panel = panel;
|
||||||
|
|
|
@ -2251,7 +2251,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
||||||
array_remove(group == noone? PROJECT.nodes : group.getNodeList(), self);
|
array_remove(group == noone? PROJECT.nodes : group.getNodeList(), self);
|
||||||
|
|
||||||
if(PANEL_GRAPH.node_hover == self) PANEL_GRAPH.node_hover = noone;
|
if(PANEL_GRAPH.node_hover == self) PANEL_GRAPH.node_hover = noone;
|
||||||
PANEL_GRAPH.nodes_selecting = [];
|
array_remove(PANEL_GRAPH.nodes_selecting, self);
|
||||||
|
|
||||||
if(PANEL_INSPECTOR.inspecting == self) PANEL_INSPECTOR.inspecting = noone;
|
if(PANEL_INSPECTOR.inspecting == self) PANEL_INSPECTOR.inspecting = noone;
|
||||||
|
|
||||||
|
|
|
@ -162,39 +162,53 @@ function Node_Group_Input(_x, _y, _group = noone) : Node(_x, _y, _group) constru
|
||||||
case "Range" :
|
case "Range" :
|
||||||
if(!is_array(_val) || array_length(_val) != 2)
|
if(!is_array(_val) || array_length(_val) != 2)
|
||||||
inParent.animator = new valueAnimator([0, 0], inParent);
|
inParent.animator = new valueAnimator([0, 0], inParent);
|
||||||
|
|
||||||
|
inParent.def_val = [0, 0];
|
||||||
inParent.setDisplay(VALUE_DISPLAY.range);
|
inParent.setDisplay(VALUE_DISPLAY.range);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "Slider" :
|
case "Slider" :
|
||||||
if(is_array(_val)) inParent.animator = new valueAnimator(0, inParent);
|
if(is_array(_val)) inParent.animator = new valueAnimator(0, inParent);
|
||||||
|
|
||||||
|
inParent.def_val = 0;
|
||||||
inParent.setDisplay(VALUE_DISPLAY.slider, { range: [_range[0], _range[1], _step] });
|
inParent.setDisplay(VALUE_DISPLAY.slider, { range: [_range[0], _range[1], _step] });
|
||||||
break;
|
break;
|
||||||
case "Slider range" :
|
case "Slider range" :
|
||||||
if(!is_array(_val) || array_length(_val) != 2)
|
if(!is_array(_val) || array_length(_val) != 2)
|
||||||
inParent.animator = new valueAnimator([0, 0], inParent);
|
inParent.animator = new valueAnimator([0, 0], inParent);
|
||||||
|
|
||||||
|
inParent.def_val = [0, 0];
|
||||||
inParent.setDisplay(VALUE_DISPLAY.slider_range, { range: [_range[0], _range[1], _step] });
|
inParent.setDisplay(VALUE_DISPLAY.slider_range, { range: [_range[0], _range[1], _step] });
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "Rotation" :
|
case "Rotation" :
|
||||||
if(is_array(_val)) inParent.animator = new valueAnimator(0, inParent);
|
if(is_array(_val)) inParent.animator = new valueAnimator(0, inParent);
|
||||||
|
|
||||||
|
inParent.def_val = 0;
|
||||||
inParent.setDisplay(VALUE_DISPLAY.rotation);
|
inParent.setDisplay(VALUE_DISPLAY.rotation);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "Rotation range" :
|
case "Rotation range" :
|
||||||
if(!is_array(_val) || array_length(_val) != 2)
|
if(!is_array(_val) || array_length(_val) != 2)
|
||||||
inParent.animator = new valueAnimator([0, 0], inParent);
|
inParent.animator = new valueAnimator([0, 0], inParent);
|
||||||
|
|
||||||
|
inParent.def_val = [0, 0];
|
||||||
inParent.setDisplay(VALUE_DISPLAY.rotation_range);
|
inParent.setDisplay(VALUE_DISPLAY.rotation_range);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "Padding" :
|
case "Padding" :
|
||||||
if(!is_array(_val) || array_length(_val) != 4)
|
if(!is_array(_val) || array_length(_val) != 4)
|
||||||
inParent.animator = new valueAnimator([0, 0, 0, 0], inParent);
|
inParent.animator = new valueAnimator([0, 0, 0, 0], inParent);
|
||||||
|
|
||||||
|
inParent.def_val = [0, 0, 0, 0];
|
||||||
inParent.setDisplay(VALUE_DISPLAY.padding);
|
inParent.setDisplay(VALUE_DISPLAY.padding);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "Area" :
|
case "Area" :
|
||||||
if(!is_array(_val) || array_length(_val) != 5)
|
if(!is_array(_val) || array_length(_val) != 5)
|
||||||
inParent.animator = new valueAnimator(DEF_AREA, inParent);
|
inParent.animator = new valueAnimator(DEF_AREA, inParent);
|
||||||
|
|
||||||
|
inParent.def_val = array_clone(DEF_AREA);
|
||||||
inParent.setDisplay(VALUE_DISPLAY.area);
|
inParent.setDisplay(VALUE_DISPLAY.area);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -204,14 +218,20 @@ function Node_Group_Input(_x, _y, _group = noone) : Node(_x, _y, _group) constru
|
||||||
case 0 :
|
case 0 :
|
||||||
if(!is_array(_val) || array_length(_val) != 2)
|
if(!is_array(_val) || array_length(_val) != 2)
|
||||||
inParent.animator = new valueAnimator([0, 0], inParent);
|
inParent.animator = new valueAnimator([0, 0], inParent);
|
||||||
|
|
||||||
|
inParent.def_val = [0, 0];
|
||||||
break;
|
break;
|
||||||
case 1 :
|
case 1 :
|
||||||
if(!is_array(_val) || array_length(_val) != 3)
|
if(!is_array(_val) || array_length(_val) != 3)
|
||||||
inParent.animator = new valueAnimator([0, 0, 0], inParent);
|
inParent.animator = new valueAnimator([0, 0, 0], inParent);
|
||||||
|
|
||||||
|
inParent.def_val = [0, 0, 0];
|
||||||
break;
|
break;
|
||||||
case 2 :
|
case 2 :
|
||||||
if(!is_array(_val) || array_length(_val) != 4)
|
if(!is_array(_val) || array_length(_val) != 4)
|
||||||
inParent.animator = new valueAnimator([0, 0, 0, 0], inParent);
|
inParent.animator = new valueAnimator([0, 0, 0, 0], inParent);
|
||||||
|
|
||||||
|
inParent.def_val = [0, 0, 0, 0];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(_dtype == "Vector") inParent.setDisplay(VALUE_DISPLAY.vector);
|
if(_dtype == "Vector") inParent.setDisplay(VALUE_DISPLAY.vector);
|
||||||
|
@ -220,17 +240,23 @@ function Node_Group_Input(_x, _y, _group = noone) : Node(_x, _y, _group) constru
|
||||||
|
|
||||||
case "Enum button" :
|
case "Enum button" :
|
||||||
if(is_array(_val)) inParent.animator = new valueAnimator(0, inParent);
|
if(is_array(_val)) inParent.animator = new valueAnimator(0, inParent);
|
||||||
|
|
||||||
|
inParent.def_val = 0;
|
||||||
inParent.setDisplay(VALUE_DISPLAY.enum_button, string_splice(_enum_label, ","));
|
inParent.setDisplay(VALUE_DISPLAY.enum_button, string_splice(_enum_label, ","));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "Menu scroll" :
|
case "Menu scroll" :
|
||||||
if(is_array(_val)) inParent.animator = new valueAnimator(0, inParent);
|
if(is_array(_val)) inParent.animator = new valueAnimator(0, inParent);
|
||||||
|
|
||||||
|
inParent.def_val = 0;
|
||||||
inParent.setDisplay(VALUE_DISPLAY.enum_scroll, string_splice(_enum_label, ","));
|
inParent.setDisplay(VALUE_DISPLAY.enum_scroll, string_splice(_enum_label, ","));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "Palette" :
|
case "Palette" :
|
||||||
if(!is_array(_val))
|
if(!is_array(_val))
|
||||||
inParent.animator = new valueAnimator([c_black], inParent);
|
inParent.animator = new valueAnimator([c_black], inParent);
|
||||||
|
|
||||||
|
inParent.def_val = [c_black];
|
||||||
inParent.setDisplay(VALUE_DISPLAY.palette);
|
inParent.setDisplay(VALUE_DISPLAY.palette);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -239,16 +265,22 @@ function Node_Group_Input(_x, _y, _group = noone) : Node(_x, _y, _group) constru
|
||||||
outputs[| 0].setType(inParent.type);
|
outputs[| 0].setType(inParent.type);
|
||||||
|
|
||||||
inParent.animator = new valueAnimator(new gradientObject(c_white), inParent);
|
inParent.animator = new valueAnimator(new gradientObject(c_white), inParent);
|
||||||
|
|
||||||
|
inParent.def_val = new gradientObject(c_white);
|
||||||
inParent.setDisplay(VALUE_DISPLAY._default);
|
inParent.setDisplay(VALUE_DISPLAY._default);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "Curve":
|
case "Curve":
|
||||||
inParent.animator = new valueAnimator(CURVE_DEF_11, inParent);
|
inParent.animator = new valueAnimator(CURVE_DEF_11, inParent);
|
||||||
|
|
||||||
|
inParent.def_val = array_clone(CURVE_DEF_11);
|
||||||
inParent.setDisplay(VALUE_DISPLAY.curve);
|
inParent.setDisplay(VALUE_DISPLAY.curve);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if(is_array(_val)) inParent.animator = new valueAnimator(0, inParent);
|
if(is_array(_val)) inParent.animator = new valueAnimator(0, inParent);
|
||||||
|
|
||||||
|
inParent.def_val = 0;
|
||||||
inParent.setDisplay(VALUE_DISPLAY._default);
|
inParent.setDisplay(VALUE_DISPLAY._default);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1055,8 +1055,10 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
||||||
if(node_hovering != noone)
|
if(node_hovering != noone)
|
||||||
_HOVERING_ELEMENT = node_hovering;
|
_HOVERING_ELEMENT = node_hovering;
|
||||||
|
|
||||||
if(node_hovering != noone && _focus && DOUBLE_CLICK && node_hovering.onDoubleClick != -1) {
|
if(DOUBLE_CLICK) {
|
||||||
|
// print($"Double click {node_hovering} || {_focus} || {instanceof(node_hovering)}");
|
||||||
|
|
||||||
|
if(node_hovering != noone && _focus && node_hovering.onDoubleClick != -1)
|
||||||
if(node_hovering.onDoubleClick(self)) {
|
if(node_hovering.onDoubleClick(self)) {
|
||||||
DOUBLE_CLICK = false;
|
DOUBLE_CLICK = false;
|
||||||
node_hovering = noone;
|
node_hovering = noone;
|
||||||
|
@ -2405,7 +2407,12 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
||||||
|
|
||||||
function doDelete(_merge = false) { #region
|
function doDelete(_merge = false) { #region
|
||||||
__temp_merge = _merge;
|
__temp_merge = _merge;
|
||||||
array_foreach(nodes_selecting, function(node) { if(node.manual_deletable) node.destroy(__temp_merge); });
|
|
||||||
|
for(i = array_length(nodes_selecting) - 1; i >= 0; i--) {
|
||||||
|
var _node = array_safe_get_fast(nodes_selecting, i, 0);
|
||||||
|
if(_node && _node.manual_deletable)
|
||||||
|
_node.destroy(__temp_merge);
|
||||||
|
}
|
||||||
nodes_selecting = [];
|
nodes_selecting = [];
|
||||||
} #endregion
|
} #endregion
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue