From dbb2fabca411ad64132ed991be134761c9d6a981 Mon Sep 17 00:00:00 2001 From: Tanasart Date: Sat, 6 Jul 2024 08:16:01 +0700 Subject: [PATCH] - [Graph Panel] Fix error when dropping project file to the panel. --- scripts/globals/globals.gml | 6 +++--- scripts/load_function/load_function.gml | 16 ++++++++++------ scripts/load_function/load_function.yy | 2 +- scripts/panel_data/panel_data.yy | 2 +- scripts/panel_graph/panel_graph.gml | 2 +- 5 files changed, 16 insertions(+), 12 deletions(-) diff --git a/scripts/globals/globals.gml b/scripts/globals/globals.gml index befeebba2..d62d99431 100644 --- a/scripts/globals/globals.gml +++ b/scripts/globals/globals.gml @@ -36,10 +36,10 @@ globalvar VERSION, SAVE_VERSION, VERSION_STRING, BUILD_NUMBER, LATEST_VERSION; LATEST_VERSION = 11700; - VERSION = 11760; + VERSION = 11761; SAVE_VERSION = 11700; - VERSION_STRING = "1.17.6"; - BUILD_NUMBER = 11760; + VERSION_STRING = "1.17.6.1"; + BUILD_NUMBER = 11761; globalvar HOTKEYS, HOTKEY_CONTEXT; HOTKEYS = ds_map_create(); diff --git a/scripts/load_function/load_function.gml b/scripts/load_function/load_function.gml index 5c43e0e3c..0ed74cdf6 100644 --- a/scripts/load_function/load_function.gml +++ b/scripts/load_function/load_function.gml @@ -28,12 +28,17 @@ function TEST_PATH(path) { #region LOAD_AT(path); } #endregion -function LOAD_PATH(path, readonly = false, safe_mode = false) { #region +function LOAD_PATH(path, readonly = false, safe_mode = false) { + var _rep = false; + for( var i = array_length(PROJECTS) - 1; i >= 0; i-- ) { var _p = array_safe_get_fast(PROJECTS, i); if(!is_instanceof(_p, Project)) continue; - if(_p.path == path) closeProject(_p); + if(_p.path == path) { + _rep = true; + closeProject(_p); + } } var _PROJECT = PROJECT; @@ -42,7 +47,7 @@ function LOAD_PATH(path, readonly = false, safe_mode = false) { #region if(_PROJECT == noone) { PROJECTS = [ PROJECT ]; - } else if(_PROJECT.path == "" && !_PROJECT.modified) { + } else if(!_rep && _PROJECT.path == "" && !_PROJECT.modified) { var ind = array_find(PROJECTS, _PROJECT); if(ind == -1) ind = 0; PROJECTS[ind] = PROJECT; @@ -62,11 +67,10 @@ function LOAD_PATH(path, readonly = false, safe_mode = false) { #region if(!res) return false; PROJECT.safeMode = safe_mode; - if(!IS_CMD) - setFocus(PANEL_GRAPH.panel); + if(!IS_CMD) setFocus(PANEL_GRAPH.panel); return PROJECT; -} #endregion +} function LOAD_AT(path, params = new __loadParams()) { #region static log = false; diff --git a/scripts/load_function/load_function.yy b/scripts/load_function/load_function.yy index 1fd07be7d..57deaf3e9 100644 --- a/scripts/load_function/load_function.yy +++ b/scripts/load_function/load_function.yy @@ -1,5 +1,5 @@ { - "$GMScript":"v1", + "$GMScript":"", "%Name":"load_function", "isCompatibility":false, "isDnD":false, diff --git a/scripts/panel_data/panel_data.yy b/scripts/panel_data/panel_data.yy index 43e0193ee..66e100951 100644 --- a/scripts/panel_data/panel_data.yy +++ b/scripts/panel_data/panel_data.yy @@ -1,5 +1,5 @@ { - "$GMScript":"v1", + "$GMScript":"", "%Name":"panel_data", "isCompatibility":false, "isDnD":false, diff --git a/scripts/panel_graph/panel_graph.gml b/scripts/panel_graph/panel_graph.gml index 499d5c300..d01073de3 100644 --- a/scripts/panel_graph/panel_graph.gml +++ b/scripts/panel_graph/panel_graph.gml @@ -2188,7 +2188,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { if(FILE_DROPPED && !array_empty(FILE_DROPPING)) { _gx = mx / graph_s - graph_x; _gy = my / graph_s - graph_y; - load_file_path(FILE_DROPPING, _gx, _gy); + run_in(1, load_file_path, [ FILE_DROPPING, _gx, _gy ]); } }