| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
#pragma once |
| 32 |
|
| 33 |
#include "openxr_action.h" |
| 34 |
#include "openxr_binding_modifier.h" |
| 35 |
#include "openxr_interaction_profile_metadata.h" |
| 36 |
|
| 37 |
#include "core/io/resource.h" |
| 38 |
|
| 39 |
class OpenXRActionMap; |
| 40 |
|
| 41 |
class OpenXRIPBinding : public Resource { |
| 42 |
GDCLASS(OpenXRIPBinding, Resource); |
| 43 |
|
| 44 |
private: |
| 45 |
Ref<OpenXRAction> action; |
| 46 |
String binding_path; |
| 47 |
Vector<Ref<OpenXRActionBindingModifier>> binding_modifiers; |
| 48 |
|
| 49 |
protected: |
| 50 |
friend class OpenXRActionMap; |
| 51 |
|
| 52 |
OpenXRActionMap *action_map = nullptr; |
| 53 |
|
| 54 |
static void _bind_methods(); |
| 55 |
|
| 56 |
public: |
| 57 |
static Ref<OpenXRIPBinding> new_binding(const Ref<OpenXRAction> &p_action, const String &p_binding_path); |
| 58 |
|
| 59 |
OpenXRActionMap *get_action_map() { return action_map; } |
| 60 |
|
| 61 |
void set_action(const Ref<OpenXRAction> &p_action); |
| 62 |
Ref<OpenXRAction> get_action() const; |
| 63 |
|
| 64 |
void set_binding_path(const String &p_path); |
| 65 |
String get_binding_path() const; |
| 66 |
|
| 67 |
int get_binding_modifier_count() const; |
| 68 |
Ref<OpenXRActionBindingModifier> get_binding_modifier(int p_index) const; |
| 69 |
void clear_binding_modifiers(); |
| 70 |
void set_binding_modifiers(const Array &p_bindings); |
| 71 |
Array get_binding_modifiers() const; |
| 72 |
|
| 73 |
void add_binding_modifier(const Ref<OpenXRActionBindingModifier> &p_binding_modifier); |
| 74 |
void remove_binding_modifier(const Ref<OpenXRActionBindingModifier> &p_binding_modifier); |
| 75 |
|
| 76 |
|
| 77 |
#ifndef DISABLE_DEPRECATED |
| 78 |
void set_paths(const PackedStringArray &p_paths); |
| 79 |
PackedStringArray get_paths() const; |
| 80 |
int get_path_count() const; |
| 81 |
bool has_path(const String &p_path) const; |
| 82 |
void add_path(const String &p_path); |
| 83 |
void remove_path(const String &p_path); |
| 84 |
#endif |
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
~OpenXRIPBinding(); |
| 89 |
}; |
| 90 |
|
| 91 |
class OpenXRInteractionProfile : public Resource { |
| 92 |
GDCLASS(OpenXRInteractionProfile, Resource); |
| 93 |
|
| 94 |
private: |
| 95 |
String interaction_profile_path; |
| 96 |
Array bindings; |
| 97 |
Vector<Ref<OpenXRIPBindingModifier>> binding_modifiers; |
| 98 |
|
| 99 |
protected: |
| 100 |
friend class OpenXRActionMap; |
| 101 |
|
| 102 |
OpenXRActionMap *action_map = nullptr; |
| 103 |
|
| 104 |
static void _bind_methods(); |
| 105 |
|
| 106 |
public: |
| 107 |
static Ref<OpenXRInteractionProfile> new_profile(const char *p_input_profile_path); |
| 108 |
|
| 109 |
OpenXRActionMap *get_action_map() { return action_map; } |
| 110 |
|
| 111 |
void set_interaction_profile_path(const String &p_input_profile_path); |
| 112 |
String get_interaction_profile_path() const; |
| 113 |
|
| 114 |
int get_binding_count() const; |
| 115 |
Ref<OpenXRIPBinding> get_binding(int p_index) const; |
| 116 |
void set_bindings(const Array &p_bindings); |
| 117 |
Array get_bindings() const; |
| 118 |
|
| 119 |
Ref<OpenXRIPBinding> find_binding(const Ref<OpenXRAction> &p_action, const String &p_binding_path) const; |
| 120 |
Vector<Ref<OpenXRIPBinding>> get_bindings_for_action(const Ref<OpenXRAction> &p_action) const; |
| 121 |
void add_binding(const Ref<OpenXRIPBinding> &p_binding); |
| 122 |
void remove_binding(const Ref<OpenXRIPBinding> &p_binding); |
| 123 |
|
| 124 |
void add_new_binding(const Ref<OpenXRAction> &p_action, const String &p_paths); |
| 125 |
void remove_binding_for_action(const Ref<OpenXRAction> &p_action); |
| 126 |
bool has_binding_for_action(const Ref<OpenXRAction> &p_action); |
| 127 |
|
| 128 |
int get_binding_modifier_count() const; |
| 129 |
Ref<OpenXRIPBindingModifier> get_binding_modifier(int p_index) const; |
| 130 |
void clear_binding_modifiers(); |
| 131 |
void set_binding_modifiers(const Array &p_bindings); |
| 132 |
Array get_binding_modifiers() const; |
| 133 |
|
| 134 |
void add_binding_modifier(const Ref<OpenXRIPBindingModifier> &p_binding_modifier); |
| 135 |
void remove_binding_modifier(const Ref<OpenXRIPBindingModifier> &p_binding_modifier); |
| 136 |
|
| 137 |
~OpenXRInteractionProfile(); |
| 138 |
}; |