From d731418507d6ec9760d6cc05658fa299fcc59dc8 Mon Sep 17 00:00:00 2001 From: Jayden Sipe Date: Sun, 1 Feb 2026 18:35:16 -0500 Subject: [PATCH] Use class name instead of Object ID in remote scene view --- scene/debugger/scene_debugger_object.cpp | 68 ++++++++++++++++++------ scene/debugger/scene_debugger_object.h | 1 + 2 files changed, 52 insertions(+), 17 deletions(-) diff --git a/scene/debugger/scene_debugger_object.cpp b/scene/debugger/scene_debugger_object.cpp index 6e3b695ea0..59cb8c178a 100644 --- a/scene/debugger/scene_debugger_object.cpp +++ b/scene/debugger/scene_debugger_object.cpp @@ -75,9 +75,15 @@ SceneDebuggerObject::SceneDebuggerObject(Object *p_obj) { // Add base object properties. List pinfo; p_obj->get_property_list(&pinfo, true); - for (const PropertyInfo &E : pinfo) { + for (PropertyInfo &E : pinfo) { + const Variant &m = p_obj->get(E.name); + + if (!m.is_null() && E.type == Variant::OBJECT && E.hint == PROPERTY_HINT_NODE_TYPE && E.usage & PROPERTY_USAGE_EDITOR) { + E.hint_string = _parse_type_from_remote_object(m); + } + if (E.usage & (PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_CATEGORY)) { - properties.push_back(SceneDebuggerProperty(E, p_obj->get(E.name))); + properties.push_back(SceneDebuggerProperty(E, m)); } } } @@ -139,28 +145,31 @@ void SceneDebuggerObject::_parse_script_properties(Script *p_script, ScriptInsta Variant m; if (p_instance->get(E, m)) { const String script_path = sm.key == p_script ? "" : sm.key->get_path().get_file() + "/"; - - PropertyInfo pi; - const PropertyInfo *pi_ptr = non_exported_members.getptr(E); - if (pi_ptr == nullptr) { - pi.type = m.get_type(); + if (!m.is_null() && m.get_type() == Variant::OBJECT) { + PropertyInfo pi(m.get_type(), "Members/" + script_path + E, PROPERTY_HINT_OBJECT_ID, _parse_type_from_remote_object(m)); + properties.push_back(SceneDebuggerProperty(pi, m)); } else { - pi = *pi_ptr; - } - pi.name = "Members/" + script_path + E; + PropertyInfo pi; + const PropertyInfo *pi_ptr = non_exported_members.getptr(E); + if (pi_ptr == nullptr) { + pi.type = m.get_type(); + } else { + pi = *pi_ptr; + } + pi.name = "Members/" + script_path + E; - properties.push_back(SceneDebuggerProperty(pi, m)); + properties.push_back(SceneDebuggerProperty(pi, m)); + } } } } // Constants for (KeyValue> &sc : constants) { for (const KeyValue &E : sc.value) { - String script_path = sc.key == p_script ? "" : sc.key->get_path().get_file() + "/"; - if (E.value.get_type() == Variant::OBJECT) { - Variant inst_id = ((Object *)E.value)->get_instance_id(); - PropertyInfo pi(inst_id.get_type(), "Constants/" + E.key, PROPERTY_HINT_OBJECT_ID, "Object", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_READ_ONLY); - properties.push_back(SceneDebuggerProperty(pi, inst_id)); + const String script_path = sc.key == p_script ? "" : sc.key->get_path().get_file() + "/"; + if (!E.value.is_null() && E.value.get_type() == Variant::OBJECT) { + PropertyInfo pi(E.value.get_type(), "Constants/" + E.key, PROPERTY_HINT_OBJECT_ID, _parse_type_from_remote_object(E.value), PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_READ_ONLY); + properties.push_back(SceneDebuggerProperty(pi, E.value)); } else { PropertyInfo pi(E.value.get_type(), "Constants/" + script_path + E.key); pi.usage |= PROPERTY_USAGE_READ_ONLY; @@ -170,6 +179,29 @@ void SceneDebuggerObject::_parse_script_properties(Script *p_script, ScriptInsta } } } +String SceneDebuggerObject::_parse_type_from_remote_object(const Variant &p_variant) { + String name; + + if (p_variant.get_type() == Variant::OBJECT) { + const Object *obj = p_variant.get_validated_object(); + if (obj) { + const ScriptInstance *script_instance = obj->get_script_instance(); + + if (script_instance) { + Ref