From 8c7e2838a6e5f3911cd1caa9825c363d6caa6b20 Mon Sep 17 00:00:00 2001 From: Kaleb Reid <78945904+Kaleb-Reid@users.noreply.github.com> Date: Thu, 13 Nov 2025 17:20:52 -0800 Subject: [PATCH] Show NodePath subnames in editor inspector --- editor/docks/scene_tree_dock.cpp | 14 ++++++++++++-- editor/inspector/editor_properties.cpp | 8 ++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/editor/docks/scene_tree_dock.cpp b/editor/docks/scene_tree_dock.cpp index 0abf21f834..84c457ae4c 100644 --- a/editor/docks/scene_tree_dock.cpp +++ b/editor/docks/scene_tree_dock.cpp @@ -2029,9 +2029,14 @@ bool SceneTreeDock::_update_node_path(Node *p_root_node, NodePath &r_node_path, // Try to find the target node in modified node paths. HashMap::Iterator found_node_path = p_renames->find(target_node); if (found_node_path) { + String old_subnames; + if (r_node_path.get_subname_count() > 0) { + old_subnames = ":" + r_node_path.get_concatenated_subnames(); + } + HashMap::Iterator found_root_path = p_renames->find(p_root_node); NodePath root_path_new = found_root_path ? found_root_path->value : p_root_node->get_path(); - r_node_path = root_path_new.rel_path_to(found_node_path->value); + r_node_path = NodePath(String(root_path_new.rel_path_to(found_node_path->value)) + old_subnames); return true; } @@ -2041,9 +2046,14 @@ bool SceneTreeDock::_update_node_path(Node *p_root_node, NodePath &r_node_path, if (found_root_path) { NodePath root_path_new = found_root_path->value; if (!root_path_new.is_empty()) { + String old_subnames; + if (r_node_path.get_subname_count() > 0) { + old_subnames = ":" + r_node_path.get_concatenated_subnames(); + } + NodePath old_abs_path = NodePath(String(p_root_node->get_path()).path_join(String(r_node_path))); old_abs_path.simplify(); - r_node_path = root_path_new.rel_path_to(old_abs_path); + r_node_path = NodePath(String(root_path_new.rel_path_to(old_abs_path)) + old_subnames); } return true; diff --git a/editor/inspector/editor_properties.cpp b/editor/inspector/editor_properties.cpp index 42ef7a6791..706073646f 100644 --- a/editor/inspector/editor_properties.cpp +++ b/editor/inspector/editor_properties.cpp @@ -3181,13 +3181,17 @@ void EditorPropertyNodePath::update_property() { const Node *target_node = base_node->get_node(p); ERR_FAIL_NULL(target_node); - if (String(target_node->get_name()).contains_char('@')) { + String new_text = target_node->get_name(); + if (new_text.contains_char('@')) { assign->set_button_icon(Ref()); assign->set_text(String(p)); return; } - assign->set_text(target_node->get_name()); + if (p.get_subname_count() > 0) { + new_text += ":" + p.get_concatenated_subnames(); + } + assign->set_text(new_text); assign->set_button_icon(EditorNode::get_singleton()->get_object_icon(target_node)); }