- [Graph Panel] Fix view context not resetting when close project.

This commit is contained in:
Tanasart 2023-09-19 14:21:55 +02:00
parent 67844f8d6b
commit fc7f9c28a9
3 changed files with 22 additions and 18 deletions

View file

@ -1325,10 +1325,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
if(type == VALUE_TYPE.trigger && connect_type == JUNCTION_CONNECT.output) //trigger even will not propagate from input to output, need to be done manually
return [ __getAnimValue(_time), self ];
if(value_from == noone) {
var _val = __getAnimValue(_time);
return [ _val, self ];
} else if(value_from != self)
if(value_from && value_from != self)
return value_from.getValueRecursive(_time);
if(expUse && is_struct(expTree) && expTree.validate()) {
@ -1336,10 +1333,9 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
//print(debug_get_callstack(8));
if(global.EVALUATE_HEAD != noone && global.EVALUATE_HEAD == self) {
//noti_warning($"Expression evaluation error : recursive call detected.");
noti_warning($"Expression evaluation error : recursive call detected.");
} else {
printIf(global.LOG_EXPRESSION, $"==================== EVAL BEGIN {expTree} ====================");
//print(json_beautify(json_stringify(expTree)));
//printIf(global.LOG_EXPRESSION, $"==================== EVAL BEGIN {expTree} ====================");
//printCallStack();
global.EVALUATE_HEAD = self;
@ -1350,6 +1346,9 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
};
var _exp_res = expTree.eval(variable_clone(params));
//print(json_stringify(expTree, true));
//print($"======= {_exp_res}");
if(is_undefined(_exp_res)) {
val[0] = 0;
noti_warning("Expression not returning any values.");
@ -1357,9 +1356,11 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
val[0] = _exp_res;
global.EVALUATE_HEAD = noone;
}
}
return val;
}
return val;
return [ __getAnimValue(_time), self ];
} #endregion
static setAnim = function(anim) { #region

View file

@ -1242,13 +1242,9 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
PANEL_PREVIEW.resetNodePreview();
setContextFrame(true, node_context[| i + 1]);
if(i == -1) {
ds_list_clear(node_context);
title = __txt("Graph");
nodes_list = project.nodes;
toCenterNode();
PANEL_ANIMATION.updatePropertyList();
} else {
if(i == -1)
resetContext();
else {
for(var j = ds_list_size(node_context) - 1; j > i; j--)
ds_list_delete(node_context, j);
nodes_list = node_context[| i].getNodeList();
@ -1440,6 +1436,14 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
draw_set_alpha(1);
} #endregion
function resetContext() { #region
ds_list_clear(node_context);
title = __txt("Graph");
nodes_list = project.nodes;
toCenterNode();
PANEL_ANIMATION.updatePropertyList();
} #endregion
function addContext(node) { #region
title = node.display_name == ""? node.name : node.display_name;

View file

@ -1,6 +1,4 @@
function closeProject(project) {
//print($"Close {PROJECT.path}");
project.active = false;
array_remove(PROJECTS, project);
if(array_length(PROJECTS) == 0) {
@ -19,6 +17,7 @@ function closeProject(project) {
if(array_length(panels) == 1) {
panel.setProject(PROJECT);
panel.onFocusBegin();
panel.resetContext();
} else {
panel.panel.remove(panel);
array_remove(panels, panel);