Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix "Make Scene Root" deleting previous root whenever focusing another scene #32412

Merged

Conversation

bojidar-bg
Copy link
Contributor

Hopefully fixes #24484 and fixes #27222.

@bojidar-bg bojidar-bg added this to the 3.2 milestone Sep 28, 2019
_node_replace_owner(root, root, root, MODE_UNDO);

editor_data->get_undo_redo().add_do_method(scene_tree, "update_tree");
editor_data->get_undo_redo().add_undo_method(scene_tree, "update_tree");
editor_data->get_undo_redo().add_undo_reference(root);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line was the main culprit: the other are mostly stylistic/correctness changes.

add_undo_reference adds a reference which should persist as long as the undo history does. Unfortunately, the root node is preserved, not scrapped, so it actually "outlives" the undo history.

A cool side effect of this was that doing "Make Scene Root" twice, once on a node and then again on the old root node, followed by changing the scene would crash the editor.

@akien-mga akien-mga merged commit ae6c390 into godotengine:master Sep 29, 2019
@akien-mga
Copy link
Member

Thanks!

@akien-mga
Copy link
Member

Cherry-picked for 3.1.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

disapperaring nodes after reparenting Make Scene Root deletes other nodes from the scene
2 participants