From 81d54ea3e3518d1b7a0bbb1cda697e375d73b24d Mon Sep 17 00:00:00 2001 From: MakhamDev Date: Thu, 12 Oct 2023 17:25:38 +0700 Subject: [PATCH] - [PCX] Fix expression not evaluate if the junction is connected. - [PCX] Fix square bracket break autocomplete. --- scripts/__node/__node.gml | 7 ++++--- scripts/globals/globals.gml | 6 +++--- scripts/node_value/node_value.gml | 19 ++++++++++--------- scripts/panel_globalvar/panel_globalvar.gml | 5 +++-- scripts/pcx_ast/pcx_ast.gml | 14 ++++++++------ scripts/pcx_server/pcx_server.gml | 4 ++++ scripts/textArea/textArea.gml | 2 +- 7 files changed, 33 insertions(+), 24 deletions(-) diff --git a/scripts/__node/__node.gml b/scripts/__node/__node.gml index 4c65d9dd7..127654634 100644 --- a/scripts/__node/__node.gml +++ b/scripts/__node/__node.gml @@ -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) {} diff --git a/scripts/globals/globals.gml b/scripts/globals/globals.gml index f2873aed3..3bf837a05 100644 --- a/scripts/globals/globals.gml +++ b/scripts/globals/globals.gml @@ -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(); diff --git a/scripts/node_value/node_value.gml b/scripts/node_value/node_value.gml index 28474f6ba..24b3b56e7 100644 --- a/scripts/node_value/node_value.gml +++ b/scripts/node_value/node_value.gml @@ -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 diff --git a/scripts/panel_globalvar/panel_globalvar.gml b/scripts/panel_globalvar/panel_globalvar.gml index 5137ec3f7..8e73a9393 100644 --- a/scripts/panel_globalvar/panel_globalvar.gml +++ b/scripts/panel_globalvar/panel_globalvar.gml @@ -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; } } \ No newline at end of file diff --git a/scripts/pcx_ast/pcx_ast.gml b/scripts/pcx_ast/pcx_ast.gml index 7a4bfcd81..971a50bf6 100644 --- a/scripts/pcx_ast/pcx_ast.gml +++ b/scripts/pcx_ast/pcx_ast.gml @@ -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]]; diff --git a/scripts/pcx_server/pcx_server.gml b/scripts/pcx_server/pcx_server.gml index 0d9450132..f6f3def51 100644 --- a/scripts/pcx_server/pcx_server.gml +++ b/scripts/pcx_server/pcx_server.gml @@ -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)); diff --git a/scripts/textArea/textArea.gml b/scripts/textArea/textArea.gml index 6122ad63e..eca87d32f 100644 --- a/scripts/textArea/textArea.gml +++ b/scripts/textArea/textArea.gml @@ -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 = [];