diff options
| author | Rémi Verschelde <rverschelde@gmail.com> | 2019-11-17 21:43:28 +0100 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-11-17 21:43:28 +0100 | 
| commit | cc025fc8e7e379cb157890d08720f2cbcc96e3ad (patch) | |
| tree | 37349ad3b2d96b88f8c558ee3d6ed0bd1ea4fee2 | |
| parent | d75b43e961deb75303e3b05f8887a7a3571880ea (diff) | |
| parent | ae76c626017b48fb98d9acb453662adbe6ffabfc (diff) | |
Merge pull request #33663 from Calinou/add-node-get-process-priority
Implement `Node::get_process_priority()` and its associated property
| -rw-r--r-- | doc/classes/Node.xml | 12 | ||||
| -rw-r--r-- | doc/classes/String.xml | 1 | ||||
| -rw-r--r-- | scene/main/node.cpp | 7 | ||||
| -rw-r--r-- | scene/main/node.h | 1 | 
4 files changed, 11 insertions, 10 deletions
diff --git a/doc/classes/Node.xml b/doc/classes/Node.xml index 1f685aab81..cecbce90b3 100644 --- a/doc/classes/Node.xml +++ b/doc/classes/Node.xml @@ -783,15 +783,6 @@  				Enables or disabled internal processing for this node. Internal processing happens in isolation from the normal [method _process] calls and is used by some nodes internally to guarantee proper functioning even if the node is paused or processing is disabled for scripting ([method set_process]). Only useful for advanced uses to manipulate built-in nodes' behaviour.  			</description>  		</method> -		<method name="set_process_priority"> -			<return type="void"> -			</return> -			<argument index="0" name="priority" type="int"> -			</argument> -			<description> -				Sets the node's priority in the execution order of the enabled processing callbacks (i.e. [constant NOTIFICATION_PROCESS], [constant NOTIFICATION_PHYSICS_PROCESS] and their internal counterparts). Nodes with a higher process priority will have their processing callbacks executed first. -			</description> -		</method>  		<method name="set_process_unhandled_input">  			<return type="void">  			</return> @@ -847,6 +838,9 @@  		<member name="pause_mode" type="int" setter="set_pause_mode" getter="get_pause_mode" enum="Node.PauseMode" default="0">  			Pause mode. How the node will behave if the [SceneTree] is paused.  		</member> +		<member name="process_priority" type="int" setter="set_process_priority" getter="get_process_priority" default="0"> +			The node's priority in the execution order of the enabled processing callbacks (i.e. [constant NOTIFICATION_PROCESS], [constant NOTIFICATION_PHYSICS_PROCESS] and their internal counterparts). Nodes with a higher process priority will have their processing callbacks executed first. +		</member>  	</members>  	<signals>  		<signal name="ready"> diff --git a/doc/classes/String.xml b/doc/classes/String.xml index 11a9f6dc0d..f5597d89e5 100644 --- a/doc/classes/String.xml +++ b/doc/classes/String.xml @@ -752,7 +752,6 @@  				print(some_array[0]) # Prints "Four"  				print(some_array[1]) # Prints "Three,Two,One"  				[/codeblock] -  			</description>  		</method>  		<method name="rstrip"> diff --git a/scene/main/node.cpp b/scene/main/node.cpp index 217dacfbfe..2a2a6bb41d 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -850,6 +850,11 @@ void Node::set_process_priority(int p_priority) {  		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) {  	if (p_enable == data.input) @@ -2754,6 +2759,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 +2900,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"))); diff --git a/scene/main/node.h b/scene/main/node.h index a8bcd2f273..6d0ff7e5cf 100644 --- a/scene/main/node.h +++ b/scene/main/node.h @@ -350,6 +350,7 @@ public:  	bool is_processing_internal() const;  	void set_process_priority(int p_priority); +	int get_process_priority() const;  	void set_process_input(bool p_enable);  	bool is_processing_input() const;  |