mirror of
				https://github.com/godotengine/godot.git
				synced 2025-11-04 07:31:16 +00:00 
			
		
		
		
	Merge pull request #101503 from devloglogan/openxr-api-action-handle
Expose OpenXR action handles to GDExtension
This commit is contained in:
		
						commit
						d19147e09a
					
				
					 3 changed files with 32 additions and 0 deletions
				
			
		| 
						 | 
					@ -17,6 +17,13 @@
 | 
				
			||||||
		<link title="XrPosef documentation">https://registry.khronos.org/OpenXR/specs/1.0/man/html/XrPosef.html</link>
 | 
							<link title="XrPosef documentation">https://registry.khronos.org/OpenXR/specs/1.0/man/html/XrPosef.html</link>
 | 
				
			||||||
	</tutorials>
 | 
						</tutorials>
 | 
				
			||||||
	<methods>
 | 
						<methods>
 | 
				
			||||||
 | 
							<method name="action_get_handle">
 | 
				
			||||||
 | 
								<return type="int" />
 | 
				
			||||||
 | 
								<param index="0" name="action" type="RID" />
 | 
				
			||||||
 | 
								<description>
 | 
				
			||||||
 | 
									Returns the corresponding [code]XrAction[/code] OpenXR handle for the given action RID.
 | 
				
			||||||
 | 
								</description>
 | 
				
			||||||
 | 
							</method>
 | 
				
			||||||
		<method name="begin_debug_label_region">
 | 
							<method name="begin_debug_label_region">
 | 
				
			||||||
			<return type="void" />
 | 
								<return type="void" />
 | 
				
			||||||
			<param index="0" name="label_name" type="String" />
 | 
								<param index="0" name="label_name" type="String" />
 | 
				
			||||||
| 
						 | 
					@ -36,6 +43,14 @@
 | 
				
			||||||
				Marks the end of a debug label region. Removes the latest debug label region added by calling [method begin_debug_label_region].
 | 
									Marks the end of a debug label region. Removes the latest debug label region added by calling [method begin_debug_label_region].
 | 
				
			||||||
			</description>
 | 
								</description>
 | 
				
			||||||
		</method>
 | 
							</method>
 | 
				
			||||||
 | 
							<method name="find_action">
 | 
				
			||||||
 | 
								<return type="RID" />
 | 
				
			||||||
 | 
								<param index="0" name="name" type="String" />
 | 
				
			||||||
 | 
								<param index="1" name="action_set" type="RID" />
 | 
				
			||||||
 | 
								<description>
 | 
				
			||||||
 | 
									Returns the [RID] corresponding to an [code]Action[/code] of a matching name, optionally limited to a specified action set.
 | 
				
			||||||
 | 
								</description>
 | 
				
			||||||
 | 
							</method>
 | 
				
			||||||
		<method name="get_error_string">
 | 
							<method name="get_error_string">
 | 
				
			||||||
			<return type="String" />
 | 
								<return type="String" />
 | 
				
			||||||
			<param index="0" name="result" type="int" />
 | 
								<param index="0" name="result" type="int" />
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -56,6 +56,9 @@ void OpenXRAPIExtension::_bind_methods() {
 | 
				
			||||||
	ClassDB::bind_method(D_METHOD("get_next_frame_time"), &OpenXRAPIExtension::get_next_frame_time);
 | 
						ClassDB::bind_method(D_METHOD("get_next_frame_time"), &OpenXRAPIExtension::get_next_frame_time);
 | 
				
			||||||
	ClassDB::bind_method(D_METHOD("can_render"), &OpenXRAPIExtension::can_render);
 | 
						ClassDB::bind_method(D_METHOD("can_render"), &OpenXRAPIExtension::can_render);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						ClassDB::bind_method(D_METHOD("find_action", "name", "action_set"), &OpenXRAPIExtension::find_action);
 | 
				
			||||||
 | 
						ClassDB::bind_method(D_METHOD("action_get_handle", "action"), &OpenXRAPIExtension::action_get_handle);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ClassDB::bind_method(D_METHOD("get_hand_tracker", "hand_index"), &OpenXRAPIExtension::get_hand_tracker);
 | 
						ClassDB::bind_method(D_METHOD("get_hand_tracker", "hand_index"), &OpenXRAPIExtension::get_hand_tracker);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ClassDB::bind_method(D_METHOD("register_composition_layer_provider", "extension"), &OpenXRAPIExtension::register_composition_layer_provider);
 | 
						ClassDB::bind_method(D_METHOD("register_composition_layer_provider", "extension"), &OpenXRAPIExtension::register_composition_layer_provider);
 | 
				
			||||||
| 
						 | 
					@ -201,6 +204,17 @@ bool OpenXRAPIExtension::can_render() {
 | 
				
			||||||
	return OpenXRAPI::get_singleton()->can_render();
 | 
						return OpenXRAPI::get_singleton()->can_render();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					RID OpenXRAPIExtension::find_action(const String &p_name, const RID &p_action_set) {
 | 
				
			||||||
 | 
						ERR_FAIL_NULL_V(OpenXRAPI::get_singleton(), RID());
 | 
				
			||||||
 | 
						return OpenXRAPI::get_singleton()->find_action(p_name, p_action_set);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					uint64_t OpenXRAPIExtension::action_get_handle(RID p_action) {
 | 
				
			||||||
 | 
						ERR_FAIL_NULL_V(OpenXRAPI::get_singleton(), 0);
 | 
				
			||||||
 | 
						XrAction action_hanlde = OpenXRAPI::get_singleton()->action_get_handle(p_action);
 | 
				
			||||||
 | 
						return reinterpret_cast<uint64_t>(action_hanlde);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
uint64_t OpenXRAPIExtension::get_hand_tracker(int p_hand_index) {
 | 
					uint64_t OpenXRAPIExtension::get_hand_tracker(int p_hand_index) {
 | 
				
			||||||
	ERR_FAIL_NULL_V(OpenXRAPI::get_singleton(), 0);
 | 
						ERR_FAIL_NULL_V(OpenXRAPI::get_singleton(), 0);
 | 
				
			||||||
	return (uint64_t)OpenXRAPI::get_singleton()->get_hand_tracker(p_hand_index);
 | 
						return (uint64_t)OpenXRAPI::get_singleton()->get_hand_tracker(p_hand_index);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -76,6 +76,9 @@ public:
 | 
				
			||||||
	int64_t get_next_frame_time();
 | 
						int64_t get_next_frame_time();
 | 
				
			||||||
	bool can_render();
 | 
						bool can_render();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						RID find_action(const String &p_name, const RID &p_action_set = RID());
 | 
				
			||||||
 | 
						uint64_t action_get_handle(RID p_action);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	uint64_t get_hand_tracker(int p_hand_index);
 | 
						uint64_t get_hand_tracker(int p_hand_index);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void register_composition_layer_provider(OpenXRExtensionWrapperExtension *p_extension);
 | 
						void register_composition_layer_provider(OpenXRExtensionWrapperExtension *p_extension);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue