diff options
Diffstat (limited to 'editor/script_editor_debugger.cpp')
-rw-r--r-- | editor/script_editor_debugger.cpp | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/editor/script_editor_debugger.cpp b/editor/script_editor_debugger.cpp index e96dfdd7b9..c1899b2bde 100644 --- a/editor/script_editor_debugger.cpp +++ b/editor/script_editor_debugger.cpp @@ -597,10 +597,30 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da if (var.is_zero()) { var = RES(); } else if (var.get_type() == Variant::STRING) { - var = ResourceLoader::load(var); - - if (pinfo.hint_string == "Script") - debugObj->set_script(var); + String path = var; + if (path.find("::") != -1) { + // built-in resource + String base_path = path.get_slice("::", 0); + if (ResourceLoader::get_resource_type(base_path) == "PackedScene") { + if (!EditorNode::get_singleton()->is_scene_open(base_path)) { + EditorNode::get_singleton()->load_scene(base_path); + } + } else { + EditorNode::get_singleton()->load_resource(base_path); + } + } + var = ResourceLoader::load(path); + + if (pinfo.hint_string == "Script") { + if (debugObj->get_script() != var) { + debugObj->set_script(RefPtr()); + Ref<Script> script(var); + if (!script.is_null()) { + ScriptInstance *script_instance = script->placeholder_instance_create(debugObj); + debugObj->set_script_and_instance(var, script_instance); + } + } + } } else if (var.get_type() == Variant::OBJECT) { if (((Object *)var)->is_class("EncodedObjectAsID")) { var = Object::cast_to<EncodedObjectAsID>(var)->get_object_id(); @@ -728,6 +748,10 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da } variables->add_property("Members/" + n, v, h, hs); + + if (n == "self") { + _scene_tree_property_select_object(v); + } } ofs += mcount * 2; |