-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
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
Call EditorNode::set_edited_scene()
manually instead of via the replacing_by
signal
#92760
Call EditorNode::set_edited_scene()
manually instead of via the replacing_by
signal
#92760
Conversation
Is this the only case when |
This is for the case of replacing the edited scene root. If you want to replace the original scene root with a new node, you need to manually call
The main purpose of using |
Just as long as there aren't cases where the editor depends on the signal alone that should be fine, but I'm unsure if it doesn't depend on it for other contexts or I feel signals just wouldn't have been used for this it's quite odd |
What confuses me is that |
c11f5c0
to
41dfea7
Compare
Allow the previous node to be set again as before, as we are not sure which one is used as the flag, we may need to unify the 3 |
Node *old_edited_scene_root = get_editor_data().get_edited_scene_root(); | ||
if (old_edited_scene_root) { | ||
ERR_FAIL_COND_MSG(p_scene && p_scene != old_edited_scene_root && p_scene->get_parent(), "Non-null nodes that are set as edited scene should not have a parent node."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what this condition is trying to do 🤔
If p_auto_add
is false, it doesn't matter if p_scene
has a parent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is to improve the condition when adding child:
if (p_scene->get_parent() != scene_root) {
scene_root->add_child(p_scene, true);
}
add_child()
does not allow the adding node already has a parent.
Put it here to prevent scene_root
from removing old_edited_scene_root
but not adding p_scene
. The main purpose is to provide more detailed error messages instead of just relying on the error messages in add_child
.
…placing_by` signal Cannot change `scene_root`'s child node in `EditorNode::set_edited_scene()` if replaced later using `replace_by`.
41dfea7
to
85a1662
Compare
Thanks! |
Should not change
scene_root
's child node inEditorNode::set_edited_scene()
if replaced later usingreplace_by
. Therefore, it is better to allow the child nodes ofscene_root
not to be modified automatically.Supersedes #90479.
Fix #73009.