Fix "Edit Script" in task palette not switching workspace

This commit is contained in:
Serhii Snitsaruk 2023-09-20 10:32:38 +02:00
parent e7687d7a57
commit 22d82d7c02
1 changed files with 4 additions and 1 deletions

View File

@ -15,6 +15,7 @@
#include "modules/limboai/util/limbo_utility.h"
#include "core/config/project_settings.h"
#include "core/error/error_macros.h"
#include "editor/editor_help.h"
#include "editor/editor_node.h"
#include "editor/editor_paths.h"
@ -155,7 +156,9 @@ void TaskPalette::_menu_action_selected(int p_id) {
} break;
case MENU_EDIT_SCRIPT: {
ERR_FAIL_COND(!context_task.begins_with("res://"));
ScriptEditor::get_singleton()->open_file(context_task);
Ref<Resource> res = ScriptEditor::get_singleton()->open_file(context_task);
ERR_FAIL_COND_MSG(res.is_null(), "Failed to load script: " + context_task);
EditorNode::get_singleton()->edit_resource(res);
} break;
case MENU_FAVORITE: {
PackedStringArray favorite_tasks = GLOBAL_GET("limbo_ai/behavior_tree/favorite_tasks");