summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
Diffstat (limited to 'scene')
-rw-r--r--scene/main/node.cpp17
-rw-r--r--scene/main/scene_tree.cpp1
2 files changed, 12 insertions, 6 deletions
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index 05409b7bfe..f5d2d2f2a2 100644
--- a/scene/main/node.cpp
+++ b/scene/main/node.cpp
@@ -70,7 +70,9 @@ void Node::_notification(int p_notification) {
if (data.parent) {
data.process_owner = data.parent->data.process_owner;
} else {
- data.process_owner = nullptr;
+ ERR_PRINT("The root node can't be set to Inherit process mode, reverting to Pausable instead.");
+ data.process_mode = PROCESS_MODE_PAUSABLE;
+ data.process_owner = this;
}
} else {
data.process_owner = this;
@@ -436,18 +438,18 @@ void Node::set_process_mode(ProcessMode p_mode) {
bool prev_can_process = can_process();
bool prev_enabled = _is_enabled();
- data.process_mode = p_mode;
-
- if (data.process_mode == PROCESS_MODE_INHERIT) {
+ if (p_mode == PROCESS_MODE_INHERIT) {
if (data.parent) {
- data.process_owner = data.parent->data.owner;
+ data.process_owner = data.parent->data.process_owner;
} else {
- data.process_owner = nullptr;
+ ERR_FAIL_MSG("The root node can't be set to Inherit process mode.");
}
} else {
data.process_owner = this;
}
+ data.process_mode = p_mode;
+
bool next_can_process = can_process();
bool next_enabled = _is_enabled();
@@ -702,6 +704,9 @@ bool Node::_can_process(bool p_paused) const {
process_mode = data.process_mode;
}
+ // The owner can't be set to inherit, must be a bug.
+ ERR_FAIL_COND_V(process_mode == PROCESS_MODE_INHERIT, false);
+
if (process_mode == PROCESS_MODE_DISABLED) {
return false;
} else if (process_mode == PROCESS_MODE_ALWAYS) {
diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp
index e1b1b356a9..6e78193717 100644
--- a/scene/main/scene_tree.cpp
+++ b/scene/main/scene_tree.cpp
@@ -1322,6 +1322,7 @@ SceneTree::SceneTree() {
// Create with mainloop.
root = memnew(Window);
+ root->set_process_mode(Node::PROCESS_MODE_PAUSABLE);
root->set_name("root");
#ifndef _3D_DISABLED
if (!root->get_world_3d().is_valid()) {