Skip to content

Commit 16508ea

Browse files
authored
Merge pull request #78745 from RandomShaper/fix_node_pr
Fix node processing order
2 parents 5e2f03f + 70ca659 commit 16508ea

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

scene/main/node.cpp

+8-6
Original file line numberDiff line numberDiff line change
@@ -933,9 +933,11 @@ void Node::set_process_thread_group_order(int p_order) {
933933
if (data.process_thread_group_order == p_order) {
934934
return;
935935
}
936-
// Make sure we are in SceneTree and an actual process owner
936+
937+
data.process_thread_group_order = p_order;
938+
939+
// Not yet in the tree (or not a group owner, in whose case this is pointless but harmless); trivial update.
937940
if (!is_inside_tree() || data.process_thread_group_owner != this) {
938-
data.process_thread_group_order = p_order;
939941
return;
940942
}
941943

@@ -951,8 +953,8 @@ void Node::set_process_priority(int p_priority) {
951953
if (data.process_priority == p_priority) {
952954
return;
953955
}
954-
// Make sure we are in SceneTree and an actual process owner
955956
if (!is_inside_tree()) {
957+
// Not yet in the tree; trivial update.
956958
data.process_priority = p_priority;
957959
return;
958960
}
@@ -973,8 +975,8 @@ void Node::set_physics_process_priority(int p_priority) {
973975
if (data.physics_process_priority == p_priority) {
974976
return;
975977
}
976-
// Make sure we are in SceneTree and an actual physics_process owner
977978
if (!is_inside_tree()) {
979+
// Not yet in the tree; trivial update.
978980
data.physics_process_priority = p_priority;
979981
return;
980982
}
@@ -997,11 +999,11 @@ void Node::set_process_thread_group(ProcessThreadGroup p_mode) {
997999
}
9981000

9991001
if (!is_inside_tree()) {
1002+
// Not yet in the tree; trivial update.
10001003
data.process_thread_group = p_mode;
10011004
return;
10021005
}
10031006

1004-
// Mode changed, must update everything.
10051007
_remove_tree_from_process_thread_group();
10061008
if (data.process_thread_group != PROCESS_THREAD_GROUP_INHERIT) {
10071009
_remove_process_group();
@@ -1031,7 +1033,7 @@ Node::ProcessThreadGroup Node::get_process_thread_group() const {
10311033

10321034
void Node::set_process_thread_messages(BitField<ProcessThreadMessages> p_flags) {
10331035
ERR_THREAD_GUARD
1034-
if (data.process_thread_group_order == p_flags) {
1036+
if (data.process_thread_messages == p_flags) {
10351037
return;
10361038
}
10371039

scene/main/scene_tree.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -932,19 +932,19 @@ void SceneTree::_process_group(ProcessGroup *p_group, bool p_physics) {
932932
}
933933

934934
if (p_physics) {
935-
if (n->is_physics_processing()) {
936-
n->notification(Node::NOTIFICATION_PHYSICS_PROCESS);
937-
}
938935
if (n->is_physics_processing_internal()) {
939936
n->notification(Node::NOTIFICATION_INTERNAL_PHYSICS_PROCESS);
940937
}
941-
} else {
942-
if (n->is_processing()) {
943-
n->notification(Node::NOTIFICATION_PROCESS);
938+
if (n->is_physics_processing()) {
939+
n->notification(Node::NOTIFICATION_PHYSICS_PROCESS);
944940
}
941+
} else {
945942
if (n->is_processing_internal()) {
946943
n->notification(Node::NOTIFICATION_INTERNAL_PROCESS);
947944
}
945+
if (n->is_processing()) {
946+
n->notification(Node::NOTIFICATION_PROCESS);
947+
}
948948
}
949949
}
950950

0 commit comments

Comments
 (0)