Path: blob/master/modules/openxr/editor/openxr_interaction_profile_editor.h
10278 views
/**************************************************************************/1/* openxr_interaction_profile_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 "../action_map/openxr_interaction_profile.h"34#include "../action_map/openxr_interaction_profile_metadata.h"35#include "../editor/openxr_binding_modifiers_dialog.h"36#include "editor/editor_undo_redo_manager.h"37#include "openxr_select_action_dialog.h"38#include "scene/gui/box_container.h"39#include "scene/gui/button.h"4041class OpenXRInteractionProfileEditorBase : public HBoxContainer {42GDCLASS(OpenXRInteractionProfileEditorBase, HBoxContainer);4344private:45OpenXRBindingModifiersDialog *binding_modifiers_dialog = nullptr;46VBoxContainer *toolbar_vb = nullptr;47Button *binding_modifiers_btn = nullptr;4849void _on_open_binding_modifiers();5051protected:52EditorUndoRedoManager *undo_redo;53Ref<OpenXRInteractionProfile> interaction_profile;54Ref<OpenXRActionMap> action_map;5556ScrollContainer *interaction_profile_sc = nullptr;5758bool is_dirty = false;5960static void _bind_methods();61void _notification(int p_what);6263const OpenXRInteractionProfileMetadata::InteractionProfile *profile_def = nullptr;6465public:66String tooltip; // Tooltip text to show on tab6768Ref<OpenXRInteractionProfile> get_interaction_profile() { return interaction_profile; }6970virtual void _update_interaction_profile();71virtual void _theme_changed();7273void _do_update_interaction_profile();74void _add_binding(const String p_action, const String p_path);75void _remove_binding(const String p_action, const String p_path);7677void remove_all_for_action_set(Ref<OpenXRActionSet> p_action_set);78void remove_all_for_action(Ref<OpenXRAction> p_action);7980virtual void setup(Ref<OpenXRActionMap> p_action_map, Ref<OpenXRInteractionProfile> p_interaction_profile);8182OpenXRInteractionProfileEditorBase();83};8485class OpenXRInteractionProfileEditor : public OpenXRInteractionProfileEditorBase {86GDCLASS(OpenXRInteractionProfileEditor, OpenXRInteractionProfileEditorBase);8788private:89String selecting_for_io_path;90HBoxContainer *interaction_profile_hb = nullptr;9192OpenXRSelectActionDialog *select_action_dialog = nullptr;9394void _add_io_path(VBoxContainer *p_container, const OpenXRInteractionProfileMetadata::IOPath *p_io_path);9596public:97void select_action_for(const String p_io_path);98void _on_action_selected(const String p_action);99void _on_remove_pressed(const String p_action, const String p_for_io_path);100101virtual void _update_interaction_profile() override;102virtual void _theme_changed() override;103virtual void setup(Ref<OpenXRActionMap> p_action_map, Ref<OpenXRInteractionProfile> p_interaction_profile) override;104105OpenXRInteractionProfileEditor();106};107108109