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 node processing order #78745

Merged
merged 1 commit into from
Jun 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions scene/main/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -933,9 +933,11 @@ void Node::set_process_thread_group_order(int p_order) {
if (data.process_thread_group_order == p_order) {
return;
}
// Make sure we are in SceneTree and an actual process owner

data.process_thread_group_order = p_order;

// Not yet in the tree (or not a group owner, in whose case this is pointless but harmless); trivial update.
if (!is_inside_tree() || data.process_thread_group_owner != this) {
data.process_thread_group_order = p_order;
return;
}

Expand All @@ -951,8 +953,8 @@ void Node::set_process_priority(int p_priority) {
if (data.process_priority == p_priority) {
return;
}
// Make sure we are in SceneTree and an actual process owner
if (!is_inside_tree()) {
// Not yet in the tree; trivial update.
data.process_priority = p_priority;
return;
}
Expand All @@ -973,8 +975,8 @@ void Node::set_physics_process_priority(int p_priority) {
if (data.physics_process_priority == p_priority) {
return;
}
// Make sure we are in SceneTree and an actual physics_process owner
if (!is_inside_tree()) {
// Not yet in the tree; trivial update.
data.physics_process_priority = p_priority;
return;
}
Expand All @@ -997,11 +999,11 @@ void Node::set_process_thread_group(ProcessThreadGroup p_mode) {
}

if (!is_inside_tree()) {
// Not yet in the tree; trivial update.
data.process_thread_group = p_mode;
return;
}

// Mode changed, must update everything.
_remove_tree_from_process_thread_group();
if (data.process_thread_group != PROCESS_THREAD_GROUP_INHERIT) {
_remove_process_group();
Expand Down Expand Up @@ -1031,7 +1033,7 @@ Node::ProcessThreadGroup Node::get_process_thread_group() const {

void Node::set_process_thread_messages(BitField<ProcessThreadMessages> p_flags) {
ERR_THREAD_GUARD
if (data.process_thread_group_order == p_flags) {
if (data.process_thread_messages == p_flags) {
return;
}

Expand Down
12 changes: 6 additions & 6 deletions scene/main/scene_tree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -932,19 +932,19 @@ void SceneTree::_process_group(ProcessGroup *p_group, bool p_physics) {
}

if (p_physics) {
if (n->is_physics_processing()) {
n->notification(Node::NOTIFICATION_PHYSICS_PROCESS);
}
if (n->is_physics_processing_internal()) {
n->notification(Node::NOTIFICATION_INTERNAL_PHYSICS_PROCESS);
}
} else {
if (n->is_processing()) {
n->notification(Node::NOTIFICATION_PROCESS);
if (n->is_physics_processing()) {
n->notification(Node::NOTIFICATION_PHYSICS_PROCESS);
}
} else {
if (n->is_processing_internal()) {
n->notification(Node::NOTIFICATION_INTERNAL_PROCESS);
}
if (n->is_processing()) {
n->notification(Node::NOTIFICATION_PROCESS);
}
}
}

Expand Down