Add some checks to avoid disaster when making a node the scene root. Fixes #24484
This commit is contained in:
parent
f958ba5abc
commit
e0336996ce
2 changed files with 15 additions and 0 deletions
|
@ -563,6 +563,20 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
|||
if (node == root)
|
||||
return;
|
||||
|
||||
//check that from node to root, all owners are right
|
||||
|
||||
if (node->get_owner() != root) {
|
||||
accept->set_text(TTR("Node must belong to the edited scene to become root."));
|
||||
accept->popup_centered_minsize();
|
||||
return;
|
||||
}
|
||||
|
||||
if (node->get_filename() != String()) {
|
||||
accept->set_text(TTR("Instantiated scenes can't become root"));
|
||||
accept->popup_centered_minsize();
|
||||
return;
|
||||
}
|
||||
|
||||
editor_data->get_undo_redo().create_action("Make node as Root");
|
||||
editor_data->get_undo_redo().add_do_method(node->get_parent(), "remove_child", node);
|
||||
editor_data->get_undo_redo().add_do_method(root->get_parent(), "remove_child", root);
|
||||
|
|
|
@ -64,6 +64,7 @@ void CanvasItemMaterial::init_shaders() {
|
|||
void CanvasItemMaterial::finish_shaders() {
|
||||
|
||||
memdelete(dirty_materials);
|
||||
memdelete(shader_names);
|
||||
dirty_materials = NULL;
|
||||
|
||||
#ifndef NO_THREADS
|
||||
|
|
Loading…
Reference in a new issue