summaryrefslogtreecommitdiff
path: root/scene/main/node.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/main/node.cpp')
-rw-r--r--scene/main/node.cpp24
1 files changed, 19 insertions, 5 deletions
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index 217dacfbfe..616ccc00cb 100644
--- a/scene/main/node.cpp
+++ b/scene/main/node.cpp
@@ -835,19 +835,31 @@ 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 {
+
+ return data.process_priority;
}
void Node::set_process_input(bool p_enable) {
@@ -2754,6 +2766,7 @@ void Node::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_process_delta_time"), &Node::get_process_delta_time);
ClassDB::bind_method(D_METHOD("set_process", "enable"), &Node::set_process);
ClassDB::bind_method(D_METHOD("set_process_priority", "priority"), &Node::set_process_priority);
+ ClassDB::bind_method(D_METHOD("get_process_priority"), &Node::get_process_priority);
ClassDB::bind_method(D_METHOD("is_processing"), &Node::is_processing);
ClassDB::bind_method(D_METHOD("set_process_input", "enable"), &Node::set_process_input);
ClassDB::bind_method(D_METHOD("is_processing_input"), &Node::is_processing_input);
@@ -2894,6 +2907,7 @@ void Node::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "owner", PROPERTY_HINT_RESOURCE_TYPE, "Node", 0), "set_owner", "get_owner");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "multiplayer", PROPERTY_HINT_RESOURCE_TYPE, "MultiplayerAPI", 0), "", "get_multiplayer");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "custom_multiplayer", PROPERTY_HINT_RESOURCE_TYPE, "MultiplayerAPI", 0), "set_custom_multiplayer", "get_custom_multiplayer");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "process_priority"), "set_process_priority", "get_process_priority");
BIND_VMETHOD(MethodInfo("_process", PropertyInfo(Variant::REAL, "delta")));
BIND_VMETHOD(MethodInfo("_physics_process", PropertyInfo(Variant::REAL, "delta")));