mirror of
https://github.com/godotengine/godot.git
synced 2024-11-27 09:16:35 +08:00
Fix renaming a node to the name of its siblings breaking NodePath
Also fix cases where node name was not visually updated because name was not changed Co-Authored-By: Nông Văn Tình <53887662+nongvantinh@users.noreply.github.com>
This commit is contained in:
parent
04eafd557f
commit
2f697926b0
@ -1051,10 +1051,9 @@ void SceneTreeEditor::_rename_node(Node *p_node, const String &p_name) {
|
||||
}
|
||||
}
|
||||
|
||||
new_name = p_node->get_parent()->prevalidate_child_name(p_node, new_name);
|
||||
if (new_name == p_node->get_name()) {
|
||||
if (item->get_text(0).is_empty()) {
|
||||
item->set_text(0, new_name);
|
||||
}
|
||||
item->set_text(0, new_name);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1214,6 +1214,11 @@ String Node::validate_child_name(Node *p_child) {
|
||||
_generate_serial_child_name(p_child, name);
|
||||
return name;
|
||||
}
|
||||
|
||||
String Node::prevalidate_child_name(Node *p_child, StringName p_name) {
|
||||
_generate_serial_child_name(p_child, p_name);
|
||||
return p_name;
|
||||
}
|
||||
#endif
|
||||
|
||||
String Node::adjust_name_casing(const String &p_name) {
|
||||
|
@ -614,6 +614,7 @@ public:
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
String validate_child_name(Node *p_child);
|
||||
String prevalidate_child_name(Node *p_child, StringName p_name);
|
||||
#endif
|
||||
static String adjust_name_casing(const String &p_name);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user