From d53ddc5baa29a4fdcdcd56c772d1430747661229 Mon Sep 17 00:00:00 2001 From: PouleyKetchoupp Date: Wed, 4 Sep 2019 20:00:09 +0200 Subject: [PATCH] Fixed resource loading when editing built-in script from resource Fixes #27380 --- editor/plugins/script_editor_plugin.cpp | 43 ++++++++++++++++--------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 8b6bab374c1..f79c9d50621 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -538,9 +538,13 @@ void ScriptEditor::_open_recent_script(int p_idx) { // if it's a path then it's most likely a deleted file not help } else if (path.find("::") != -1) { // built-in script - String scene_path = path.get_slice("::", 0); - if (!EditorNode::get_singleton()->is_scene_open(scene_path)) { - EditorNode::get_singleton()->load_scene(scene_path); + String res_path = path.get_slice("::", 0); + if (ResourceLoader::get_resource_type(res_path) == "PackedScene") { + if (!EditorNode::get_singleton()->is_scene_open(res_path)) { + EditorNode::get_singleton()->load_scene(res_path); + } + } else { + EditorNode::get_singleton()->load_resource(res_path); } Ref