- [PCX] Fix expression not evaluate if the junction is connected.

- [PCX] Fix square bracket break autocomplete.
This commit is contained in:
MakhamDev 2023-10-12 17:25:38 +07:00
parent 4b1ff8bf07
commit 81d54ea3e3
7 changed files with 33 additions and 24 deletions

View file

@ -6,9 +6,10 @@ function __Node_Base(x, y) constructor {
inputs = ds_list_create();
outputs = ds_list_create();
preview_index = 0;
anim_show = true;
anim_priority = -999;
active_index = -1;
preview_index = 0;
anim_show = true;
anim_priority = -999;
static step = function() {}
static update = function(frame = CURRENT_FRAME) {}

View file

@ -26,10 +26,10 @@
globalvar VERSION, SAVE_VERSION, VERSION_STRING, BUILD_NUMBER;
VERSION = 11542;
VERSION = 11543;
SAVE_VERSION = 11530;
VERSION_STRING = "1.15.4.2";
BUILD_NUMBER = 11542;
VERSION_STRING = "1.14.3";
BUILD_NUMBER = 11543;
globalvar APPEND_MAP;
APPEND_MAP = ds_map_create();

View file

@ -1150,7 +1150,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
} #endregion
static expressionUpdate = function() { #region
expTree = evaluateFunctionList(expression);
expTree = evaluateFunctionList(expression);
resetCache();
node.triggerRender();
} #endregion
@ -1437,13 +1437,13 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
} #endregion
static getValueRecursive = function(_time = CURRENT_FRAME) { #region
var val = [ -1, self ];
var val = [ __getAnimValue(_time), self ];
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(type == VALUE_TYPE.trigger && connect_type == JUNCTION_CONNECT.output) //trigger event will not propagate from input to output, need to be done manually
return val;
if(value_from && value_from != self)
return value_from.getValueRecursive(_time);
val = value_from.getValueRecursive(_time);
if(expUse && is_struct(expTree) && expTree.validate()) {
//print($"========== EXPRESSION CALLED ==========");
@ -1452,14 +1452,15 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
if(global.EVALUATE_HEAD != noone && global.EVALUATE_HEAD == self) {
noti_warning($"Expression evaluation error : recursive call detected.");
} else {
//printIf(global.LOG_EXPRESSION, $"==================== EVAL BEGIN {expTree} ====================");
//print($"==================== EVAL BEGIN {expTree} ====================");
//printCallStack();
global.EVALUATE_HEAD = self;
var params = {
name: name,
node_name: node.display_name,
value: val[0]
node: self,
value: val[0]
};
var _exp_res = expTree.eval(variable_clone(params));
@ -1475,9 +1476,9 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
}
return val;
}
}
return [ __getAnimValue(_time), self ];
return val;
} #endregion
static setAnim = function(anim) { #region

View file

@ -25,8 +25,9 @@ function Panel_Globalvar() : PanelContent() constructor {
var hh = 0;
var yy = _y;
var _x = ui(8);
var gvh = globalvar_viewer_draw(0, yy, contentPane.surface_w, _m, pFOCUS, _hover, contentPane, x + ui(padding), y + ui(title_height));
var gvh = globalvar_viewer_draw(_x, yy, contentPane.surface_w - _x - ui(8), _m, pFOCUS, _hover, contentPane, x + _x + ui(padding), y + ui(title_height));
yy += gvh + ui(8);
hh += gvh + ui(8);
@ -55,7 +56,7 @@ function Panel_Globalvar() : PanelContent() constructor {
PROJECT.globalNode.createValue();
bx -= ui(32 + 4);
if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), [mx, my], pFOCUS, pHOVER, __txt("Edit"), var_editing? THEME.accept : THEME.gear,,,, 0.9) == 2)
if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), [mx, my], pFOCUS, pHOVER, __txt("Edit"), var_editing? THEME.accept : THEME.gear) == 2)
var_editing = !var_editing;
}
}

View file

@ -89,12 +89,12 @@
PROJECT_VARIABLES = {};
PROJECT_VARIABLES.Project = {};
PROJECT_VARIABLES.Project.frame = [ function() { return CURRENT_FRAME }, EXPRESS_TREE_ANIM.animated ];
PROJECT_VARIABLES.Project.progress = [ function() { return CURRENT_FRAME / (TOTAL_FRAMES - 1) }, EXPRESS_TREE_ANIM.animated ];
PROJECT_VARIABLES.Project.frameTotal = [ function() { return TOTAL_FRAMES }, EXPRESS_TREE_ANIM.none ];
PROJECT_VARIABLES.Project.fps = [ function() { return PROJECT.animator.framerate }, EXPRESS_TREE_ANIM.none ];
PROJECT_VARIABLES.Project.time = [ function() { return CURRENT_FRAME / PROJECT.animator.framerate }, EXPRESS_TREE_ANIM.animated ];
PROJECT_VARIABLES.Project.name = [ function() { return filename_name_only(PROJECT.path) }, EXPRESS_TREE_ANIM.none ];
PROJECT_VARIABLES.Project.frame = [ function() { return CURRENT_FRAME }, EXPRESS_TREE_ANIM.animated ];
PROJECT_VARIABLES.Project.progress = [ function() { return CURRENT_FRAME / (TOTAL_FRAMES - 1) }, EXPRESS_TREE_ANIM.animated ];
PROJECT_VARIABLES.Project.frameTotal = [ function() { return TOTAL_FRAMES }, EXPRESS_TREE_ANIM.none ];
PROJECT_VARIABLES.Project.fps = [ function() { return PROJECT.animator.framerate }, EXPRESS_TREE_ANIM.none ];
PROJECT_VARIABLES.Project.time = [ function() { return CURRENT_FRAME / PROJECT.animator.framerate }, EXPRESS_TREE_ANIM.animated ];
PROJECT_VARIABLES.Project.name = [ function() { return filename_name_only(PROJECT.path) }, EXPRESS_TREE_ANIM.none ];
PROJECT_VARIABLES.Program = {};
PROJECT_VARIABLES.Program.time = [ function() { return current_time / 1000 }, EXPRESS_TREE_ANIM.animated ];
@ -403,6 +403,8 @@
res = string_char_at(v1, v2 + 1);
}
}
//print($"Array getter {v1}, {v2} = {res}");
} else if(symbol == "=") { // value assignment
if(is_array(v1)) {
var val = params[$ v1[0]];

View file

@ -36,6 +36,10 @@ function pxl_autocomplete_server(prompt, params = []) {
ds_priority_add(pr_list, [[THEME.ac_constant, 2], gl, "local", gl], match);
}
gl = "value";
var match = string_partial_match(string_lower(gl), string_lower(prompt));
if(match != -9999) ds_priority_add(pr_list, [[THEME.ac_constant, 2], gl, "local", gl], match);
repeat(ds_priority_size(pr_list))
array_push(res, ds_priority_delete_max(pr_list));

View file

@ -100,7 +100,7 @@ function textArea(_input, _onModify) : textInput(_input, _onModify) constructor
}
var crop = string_copy(_input_text, 1, cursor);
var slp = string_splice(crop, [" ", "(", ",", "\n"]);
var slp = string_splice(crop, [" ", "(", "[", "{", ",", "\n"]);
var pmt = array_safe_get(slp, -1,, ARRAY_OVERFLOW.loop);
var params = [];