Merge pull request #78925 from theraot/fix_rename_unique
Do not change a node unique name to the same name
This commit is contained in:
commit
a2604ff712
@ -1019,11 +1019,18 @@ void SceneTreeEditor::_renamed() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (n->is_unique_name_in_owner() && get_tree()->get_edited_scene_root()->get_node_or_null("%" + new_name) != nullptr) {
|
if (n->is_unique_name_in_owner()) {
|
||||||
error->set_text(TTR("Another node already uses this unique name in the scene."));
|
Node *existing = get_tree()->get_edited_scene_root()->get_node_or_null("%" + new_name);
|
||||||
error->popup_centered();
|
if (existing == n) {
|
||||||
which->set_text(0, n->get_name());
|
which->set_text(0, n->get_name());
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
if (existing != nullptr) {
|
||||||
|
error->set_text(TTR("Another node already uses this unique name in the scene."));
|
||||||
|
error->popup_centered();
|
||||||
|
which->set_text(0, n->get_name());
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_rename_node(n, new_name);
|
_rename_node(n, new_name);
|
||||||
|
Loading…
Reference in New Issue
Block a user