Merge pull request #101503 from devloglogan/openxr-api-action-handle

Expose OpenXR action handles to GDExtension
This commit is contained in:
Rémi Verschelde 2025-01-13 20:22:57 +01:00
commit d19147e09a
3 changed files with 32 additions and 0 deletions

View file

@ -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("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("register_composition_layer_provider", "extension"), &OpenXRAPIExtension::register_composition_layer_provider);
@ -201,6 +204,17 @@ bool OpenXRAPIExtension::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) {
ERR_FAIL_NULL_V(OpenXRAPI::get_singleton(), 0);
return (uint64_t)OpenXRAPI::get_singleton()->get_hand_tracker(p_hand_index);