Setting the node process priority should not trigger an error

Fixes #33749
This function can be called outside the scene tree.
This commit is contained in:
Martin Capitanio 2019-11-21 17:26:28 +01:00
parent 37b230fe3a
commit a7df198c94

View file

@ -835,20 +835,27 @@ bool Node::is_processing_internal() const {
void Node::set_process_priority(int p_priority) { void Node::set_process_priority(int p_priority) {
data.process_priority = p_priority; data.process_priority = p_priority;
ERR_FAIL_COND(!data.tree); // Make sure we are in SceneTree.
if (data.tree == NULL) {
return;
}
if (is_processing()) if (is_processing()) {
data.tree->make_group_changed("idle_process"); data.tree->make_group_changed("idle_process");
}
if (is_processing_internal()) if (is_processing_internal()) {
data.tree->make_group_changed("idle_process_internal"); data.tree->make_group_changed("idle_process_internal");
}
if (is_physics_processing()) if (is_physics_processing()) {
data.tree->make_group_changed("physics_process"); data.tree->make_group_changed("physics_process");
}
if (is_physics_processing_internal()) if (is_physics_processing_internal()) {
data.tree->make_group_changed("physics_process_internal"); data.tree->make_group_changed("physics_process_internal");
} }
}
int Node::get_process_priority() const { int Node::get_process_priority() const {