Path: blob/master/modules/openxr/editor/openxr_action_map_editor.h
10278 views
/**************************************************************************/1/* openxr_action_map_editor.h */2/**************************************************************************/3/* This file is part of: */4/* GODOT ENGINE */5/* https://godotengine.org */6/**************************************************************************/7/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */8/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */9/* */10/* Permission is hereby granted, free of charge, to any person obtaining */11/* a copy of this software and associated documentation files (the */12/* "Software"), to deal in the Software without restriction, including */13/* without limitation the rights to use, copy, modify, merge, publish, */14/* distribute, sublicense, and/or sell copies of the Software, and to */15/* permit persons to whom the Software is furnished to do so, subject to */16/* the following conditions: */17/* */18/* The above copyright notice and this permission notice shall be */19/* included in all copies or substantial portions of the Software. */20/* */21/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */22/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */23/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */24/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */25/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */26/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */27/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */28/**************************************************************************/2930#pragma once3132#include "../action_map/openxr_action_map.h"33#include "openxr_action_set_editor.h"34#include "openxr_interaction_profile_editor.h"35#include "openxr_select_interaction_profile_dialog.h"3637#include "core/templates/hash_map.h"38#include "editor/editor_undo_redo_manager.h"39#include "editor/plugins/editor_plugin.h"40#include "scene/gui/box_container.h"41#include "scene/gui/button.h"42#include "scene/gui/label.h"43#include "scene/gui/scroll_container.h"44#include "scene/gui/tab_container.h"4546class OpenXRActionMapEditor : public VBoxContainer {47GDCLASS(OpenXRActionMapEditor, VBoxContainer);4849private:50static HashMap<String, String> interaction_profile_editors; // interaction profile path, interaction profile editor51static HashMap<String, String> binding_modifier_editors; // binding modifier class, binding modifiers editor5253EditorUndoRedoManager *undo_redo;54String edited_path;55Ref<OpenXRActionMap> action_map;5657HBoxContainer *top_hb = nullptr;58Label *header_label = nullptr;59Button *add_action_set = nullptr;60Button *add_interaction_profile = nullptr;61Button *load = nullptr;62Button *save_as = nullptr;63Button *_default = nullptr;64TabContainer *tabs = nullptr;65ScrollContainer *actionsets_scroll = nullptr;66VBoxContainer *actionsets_vb = nullptr;67OpenXRSelectInteractionProfileDialog *select_interaction_profile_dialog = nullptr;6869OpenXRActionSetEditor *_add_action_set_editor(Ref<OpenXRActionSet> p_action_set);70void _create_action_sets();71OpenXRInteractionProfileEditorBase *_add_interaction_profile_editor(Ref<OpenXRInteractionProfile> p_interaction_profile);72void _create_interaction_profiles();7374OpenXRActionSetEditor *_add_action_set(String p_name);75void _remove_action_set(String p_name);7677void _on_add_action_set();78void _set_focus_on_action_set(OpenXRActionSetEditor *p_action_set_editor);79void _on_remove_action_set(Object *p_action_set_editor);80void _on_action_removed(Ref<OpenXRAction> p_action);8182void _on_add_interaction_profile();83void _on_interaction_profile_selected(const String p_path);8485void _load_action_map(const String p_path, bool p_create_new_if_missing = false);86void _on_save_action_map();87void _on_reset_to_default_layout();8889void _on_tabs_tab_changed(int p_tab);90void _on_tab_button_pressed(int p_tab);9192protected:93static void _bind_methods();94void _notification(int p_what);9596void _clear_action_map();9798// used for undo/redo99void _do_add_action_set_editor(OpenXRActionSetEditor *p_action_set_editor);100void _do_remove_action_set_editor(OpenXRActionSetEditor *p_action_set_editor);101void _do_add_interaction_profile_editor(OpenXRInteractionProfileEditorBase *p_interaction_profile_editor);102void _do_remove_interaction_profile_editor(OpenXRInteractionProfileEditorBase *p_interaction_profile_editor);103104public:105static void register_interaction_profile_editor(const String &p_for_path, const String &p_editor_class);106static void register_binding_modifier_editor(const String &p_binding_modifier_class, const String &p_editor_class);107static String get_binding_modifier_editor_class(const String &p_binding_modifier_class);108109void open_action_map(String p_path);110111OpenXRActionMapEditor();112};113114115