| 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 "../action_map/openxr_action_map.h" |
| 34 |
#include "../action_map/openxr_interaction_profile.h" |
| 35 |
#include "../action_map/openxr_interaction_profile_metadata.h" |
| 36 |
#include "../editor/openxr_binding_modifiers_dialog.h" |
| 37 |
#include "editor/editor_undo_redo_manager.h" |
| 38 |
#include "openxr_select_action_dialog.h" |
| 39 |
#include "scene/gui/box_container.h" |
| 40 |
#include "scene/gui/button.h" |
| 41 |
|
| 42 |
class OpenXRInteractionProfileEditorBase : public HBoxContainer { |
| 43 |
GDCLASS(OpenXRInteractionProfileEditorBase, HBoxContainer); |
| 44 |
|
| 45 |
private: |
| 46 |
OpenXRBindingModifiersDialog *binding_modifiers_dialog = nullptr; |
| 47 |
VBoxContainer *toolbar_vb = nullptr; |
| 48 |
Button *binding_modifiers_btn = nullptr; |
| 49 |
|
| 50 |
void _on_open_binding_modifiers(); |
| 51 |
|
| 52 |
protected: |
| 53 |
EditorUndoRedoManager *undo_redo; |
| 54 |
Ref<OpenXRInteractionProfile> interaction_profile; |
| 55 |
Ref<OpenXRActionMap> action_map; |
| 56 |
|
| 57 |
ScrollContainer *interaction_profile_sc = nullptr; |
| 58 |
|
| 59 |
bool is_dirty = false; |
| 60 |
|
| 61 |
static void _bind_methods(); |
| 62 |
void _notification(int p_what); |
| 63 |
|
| 64 |
const OpenXRInteractionProfileMetadata::InteractionProfile *profile_def = nullptr; |
| 65 |
|
| 66 |
public: |
| 67 |
String tooltip; |
| 68 |
|
| 69 |
Ref<OpenXRInteractionProfile> get_interaction_profile() { return interaction_profile; } |
| 70 |
|
| 71 |
virtual void _update_interaction_profile(); |
| 72 |
virtual void _theme_changed(); |
| 73 |
|
| 74 |
void _do_update_interaction_profile(); |
| 75 |
void _add_binding(const String &p_action, const String &p_path); |
| 76 |
void _remove_binding(const String &p_action, const String &p_path); |
| 77 |
|
| 78 |
void remove_all_for_action_set(const Ref<OpenXRActionSet> &p_action_set); |
| 79 |
void remove_all_for_action(const Ref<OpenXRAction> &p_action); |
| 80 |
|
| 81 |
virtual void setup(const Ref<OpenXRActionMap> &p_action_map, const Ref<OpenXRInteractionProfile> &p_interaction_profile); |
| 82 |
|
| 83 |
OpenXRInteractionProfileEditorBase(); |
| 84 |
}; |
| 85 |
|
| 86 |
class OpenXRInteractionProfileEditor : public OpenXRInteractionProfileEditorBase { |
| 87 |
GDCLASS(OpenXRInteractionProfileEditor, OpenXRInteractionProfileEditorBase); |
| 88 |
|
| 89 |
private: |
| 90 |
String selecting_for_io_path; |
| 91 |
HBoxContainer *interaction_profile_hb = nullptr; |
| 92 |
|
| 93 |
OpenXRSelectActionDialog *select_action_dialog = nullptr; |
| 94 |
|
| 95 |
void _add_io_path(VBoxContainer *p_container, const OpenXRInteractionProfileMetadata::IOPath *p_io_path); |
| 96 |
|
| 97 |
public: |
| 98 |
void select_action_for(const String &p_io_path); |
| 99 |
void _on_action_selected(const String &p_action); |
| 100 |
void _on_remove_pressed(const String &p_action, const String &p_for_io_path); |
| 101 |
|
| 102 |
virtual void _update_interaction_profile() override; |
| 103 |
virtual void _theme_changed() override; |
| 104 |
virtual void setup(const Ref<OpenXRActionMap> &p_action_map, const Ref<OpenXRInteractionProfile> &p_interaction_profile) override; |
| 105 |
|
| 106 |
OpenXRInteractionProfileEditor(); |
| 107 |
}; |