diff options
author | Martin Capitanio <capnm@capitanio.org> | 2019-11-21 17:26:28 +0100 |
---|---|---|
committer | Martin Capitanio <capnm@capitanio.org> | 2019-11-21 18:08:52 +0100 |
commit | a7df198c942c3c325c6ec7ac189b1d19517395c2 (patch) | |
tree | ef1a68c67508a6476134fa8204364c240e72566b /scene | |
parent | 37b230fe3af3c7e20a6f938d03b61a79b117d354 (diff) |
Setting the node process priority should not trigger an error
Fixes #33749
This function can be called outside the scene tree.
Diffstat (limited to 'scene')
-rw-r--r-- | scene/main/node.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/scene/main/node.cpp b/scene/main/node.cpp index 2a2a6bb41d..616ccc00cb 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -835,19 +835,26 @@ bool Node::is_processing_internal() const { void Node::set_process_priority(int 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"); + } - if (is_processing_internal()) + if (is_processing_internal()) { data.tree->make_group_changed("idle_process_internal"); + } - if (is_physics_processing()) + if (is_physics_processing()) { 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"); + } } int Node::get_process_priority() const { |