From 3e5e34f5f8bd09509adac29b7aeecf991cd8fe67 Mon Sep 17 00:00:00 2001 From: yds Date: Wed, 10 Jul 2024 13:15:35 -0300 Subject: [PATCH] Fix new task script path don't update after changing the setting --- editor/limbo_ai_editor_plugin.cpp | 6 +++++- editor/limbo_ai_editor_plugin.h | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/editor/limbo_ai_editor_plugin.cpp b/editor/limbo_ai_editor_plugin.cpp index 816c8bf..93bde14 100644 --- a/editor/limbo_ai_editor_plugin.cpp +++ b/editor/limbo_ai_editor_plugin.cpp @@ -903,6 +903,10 @@ void LimboAIEditor::_on_resources_reload(const PackedStringArray &p_resources) { #endif } +void LimboAIEditor::_on_new_script_pressed() { + SCRIPT_EDITOR()->open_script_create_dialog("BTAction", String(GLOBAL_GET("limbo_ai/behavior_tree/user_task_dir_1")).path_join("new_task")); +} + void LimboAIEditor::_task_type_selected(const String &p_class_or_path) { change_type_popup->hide(); @@ -1378,7 +1382,7 @@ void LimboAIEditor::_notification(int p_what) { disk_changed->connect("confirmed", callable_mp(this, &LimboAIEditor::_reload_modified)); disk_changed->connect("custom_action", callable_mp(this, &LimboAIEditor::_resave_modified)); rename_dialog->connect("confirmed", callable_mp(this, &LimboAIEditor::_rename_task_confirmed)); - new_script_btn->connect(LW_NAME(pressed), callable_mp(SCRIPT_EDITOR(), &ScriptEditor::open_script_create_dialog).bind("BTAction", String(GLOBAL_GET("limbo_ai/behavior_tree/user_task_dir_1")).path_join("new_task"))); + new_script_btn->connect(LW_NAME(pressed), callable_mp(this, &LimboAIEditor::_on_new_script_pressed)); tab_bar->connect("tab_clicked", callable_mp(this, &LimboAIEditor::_tab_clicked)); tab_bar->connect("active_tab_rearranged", callable_mp(this, &LimboAIEditor::_move_active_tab)); tab_bar->connect("tab_close_pressed", callable_mp(this, &LimboAIEditor::_tab_closed)); diff --git a/editor/limbo_ai_editor_plugin.h b/editor/limbo_ai_editor_plugin.h index 57ba68c..858f161 100644 --- a/editor/limbo_ai_editor_plugin.h +++ b/editor/limbo_ai_editor_plugin.h @@ -236,6 +236,7 @@ private: void _on_history_forward(); void _on_task_dragged(Ref p_task, Ref p_to_task, int p_type); void _on_resources_reload(const PackedStringArray &p_resources); + void _on_new_script_pressed(); void _task_type_selected(const String &p_class_or_path); void _copy_version_info();