Path: blob/master/editor/animation/animation_library_editor.h
9902 views
/**************************************************************************/1/* animation_library_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 "core/io/config_file.h"33#include "core/templates/vector.h"34#include "editor/plugins/editor_plugin.h"35#include "scene/animation/animation_mixer.h"36#include "scene/gui/dialogs.h"37#include "scene/gui/tree.h"3839class AnimationMixer;40class EditorFileDialog;4142class AnimationLibraryEditor : public AcceptDialog {43GDCLASS(AnimationLibraryEditor, AcceptDialog)4445enum {46LIB_BUTTON_ADD,47LIB_BUTTON_LOAD,48LIB_BUTTON_PASTE,49LIB_BUTTON_FILE,50LIB_BUTTON_DELETE,51};52enum {53ANIM_BUTTON_COPY,54ANIM_BUTTON_FILE,55ANIM_BUTTON_DELETE,56};5758enum FileMenuAction {59FILE_MENU_SAVE_LIBRARY,60FILE_MENU_SAVE_AS_LIBRARY,61FILE_MENU_MAKE_LIBRARY_UNIQUE,62FILE_MENU_EDIT_LIBRARY,6364FILE_MENU_SAVE_ANIMATION,65FILE_MENU_SAVE_AS_ANIMATION,66FILE_MENU_MAKE_ANIMATION_UNIQUE,67FILE_MENU_EDIT_ANIMATION,68};6970enum FileDialogAction {71FILE_DIALOG_ACTION_OPEN_LIBRARY,72FILE_DIALOG_ACTION_SAVE_LIBRARY,73FILE_DIALOG_ACTION_OPEN_ANIMATION,74FILE_DIALOG_ACTION_SAVE_ANIMATION,75};7677FileDialogAction file_dialog_action = FILE_DIALOG_ACTION_OPEN_ANIMATION;7879StringName file_dialog_animation;80StringName file_dialog_library;8182Button *new_library_button = nullptr;83Button *load_library_button = nullptr;8485AcceptDialog *error_dialog = nullptr;86bool adding_animation = false;87StringName adding_animation_to_library;88EditorFileDialog *file_dialog = nullptr;89ConfirmationDialog *add_library_dialog = nullptr;90LineEdit *add_library_name = nullptr;91Label *add_library_validate = nullptr;92PopupMenu *file_popup = nullptr;9394Tree *tree = nullptr;9596AnimationMixer *mixer = nullptr;9798void _add_library();99void _add_library_validate(const String &p_name);100void _add_library_confirm();101void _load_library();102void _load_file(const String &p_path);103void _load_files(const PackedStringArray &p_paths);104105void _save_mixer_lib_folding(TreeItem *p_item);106Vector<uint64_t> _load_mixer_libs_folding();107void _load_config_libs_folding(Vector<uint64_t> &p_lib_ids, ConfigFile *p_config, String p_section);108String _get_mixer_signature() const;109110void _item_renamed();111void _button_pressed(TreeItem *p_item, int p_column, int p_id, MouseButton p_button);112113void _file_popup_selected(int p_id);114115bool updating = false;116117protected:118void _notification(int p_what);119void _update_editor(Object *p_mixer);120virtual void shortcut_input(const Ref<InputEvent> &p_event) override;121static void _bind_methods();122123public:124void set_animation_mixer(Object *p_mixer);125void show_dialog();126void update_tree();127AnimationLibraryEditor();128};129130131