| 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 "openxr_action_set_editor.h" |
| 35 |
#include "openxr_interaction_profile_editor.h" |
| 36 |
#include "openxr_select_interaction_profile_dialog.h" |
| 37 |
|
| 38 |
#include "core/templates/hash_map.h" |
| 39 |
#include "editor/docks/editor_dock.h" |
| 40 |
#include "editor/editor_undo_redo_manager.h" |
| 41 |
#include "editor/plugins/editor_plugin.h" |
| 42 |
#include "scene/gui/box_container.h" |
| 43 |
#include "scene/gui/button.h" |
| 44 |
#include "scene/gui/label.h" |
| 45 |
#include "scene/gui/scroll_container.h" |
| 46 |
#include "scene/gui/tab_container.h" |
| 47 |
|
| 48 |
class OpenXRActionMapEditor : public EditorDock { |
| 49 |
GDCLASS(OpenXRActionMapEditor, EditorDock); |
| 50 |
|
| 51 |
private: |
| 52 |
static HashMap<String, String> interaction_profile_editors; |
| 53 |
static HashMap<String, String> binding_modifier_editors; |
| 54 |
|
| 55 |
EditorUndoRedoManager *undo_redo; |
| 56 |
String edited_path; |
| 57 |
Ref<OpenXRActionMap> action_map; |
| 58 |
|
| 59 |
HBoxContainer *top_hb = nullptr; |
| 60 |
Label *header_label = nullptr; |
| 61 |
Button *add_action_set = nullptr; |
| 62 |
Button *add_interaction_profile = nullptr; |
| 63 |
Button *load = nullptr; |
| 64 |
Button *save_as = nullptr; |
| 65 |
Button *_default = nullptr; |
| 66 |
TabContainer *tabs = nullptr; |
| 67 |
ScrollContainer *actionsets_scroll = nullptr; |
| 68 |
VBoxContainer *actionsets_vb = nullptr; |
| 69 |
OpenXRSelectInteractionProfileDialog *select_interaction_profile_dialog = nullptr; |
| 70 |
|
| 71 |
OpenXRActionSetEditor *_add_action_set_editor(const Ref<OpenXRActionSet> &p_action_set); |
| 72 |
void _create_action_sets(); |
| 73 |
OpenXRInteractionProfileEditorBase *_add_interaction_profile_editor(const Ref<OpenXRInteractionProfile> &p_interaction_profile); |
| 74 |
void _create_interaction_profiles(); |
| 75 |
|
| 76 |
OpenXRActionSetEditor *_add_action_set(const String &p_name); |
| 77 |
void _remove_action_set(const String &p_name); |
| 78 |
|
| 79 |
void _on_add_action_set(); |
| 80 |
void _set_focus_on_action_set(OpenXRActionSetEditor *p_action_set_editor); |
| 81 |
void _on_remove_action_set(Object *p_action_set_editor); |
| 82 |
void _on_action_removed(const Ref<OpenXRAction> &p_action); |
| 83 |
|
| 84 |
void _on_add_interaction_profile(); |
| 85 |
void _on_interaction_profile_selected(const String &p_path); |
| 86 |
|
| 87 |
void _load_action_map(const String &p_path, bool p_create_new_if_missing = false); |
| 88 |
void _on_save_action_map(); |
| 89 |
void _on_reset_to_default_layout(); |
| 90 |
|
| 91 |
void _on_tabs_tab_changed(int p_tab); |
| 92 |
void _on_tab_button_pressed(int p_tab); |
| 93 |
|
| 94 |
protected: |
| 95 |
static void _bind_methods(); |
| 96 |
void _notification(int p_what); |
| 97 |
|
| 98 |
void _clear_action_map(); |
| 99 |
|
| 100 |
|
| 101 |
void _do_add_action_set_editor(OpenXRActionSetEditor *p_action_set_editor); |
| 102 |
void _do_remove_action_set_editor(OpenXRActionSetEditor *p_action_set_editor); |
| 103 |
void _do_add_interaction_profile_editor(OpenXRInteractionProfileEditorBase *p_interaction_profile_editor); |
| 104 |
void _do_remove_interaction_profile_editor(OpenXRInteractionProfileEditorBase *p_interaction_profile_editor); |
| 105 |
|
| 106 |
public: |
| 107 |
static void register_interaction_profile_editor(const String &p_for_path, const String &p_editor_class); |
| 108 |
static void register_binding_modifier_editor(const String &p_binding_modifier_class, const String &p_editor_class); |
| 109 |
static String get_binding_modifier_editor_class(const String &p_binding_modifier_class); |
| 110 |
|
| 111 |
void open_action_map(const String &p_path); |
| 112 |
|
| 113 |
OpenXRActionMapEditor(); |
| 114 |
}; |