diff --git a/editor/docks/scene_tree_dock.cpp b/editor/docks/scene_tree_dock.cpp index e4a069a212..598efb926b 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 4bf98ae031..befd74884c 100644 --- a/editor/inspector/editor_properties.cpp +++ b/editor/inspector/editor_properties.cpp @@ -3172,13 +3172,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)); }