1 | /**************************************************************************/ |
2 | /* animation_library_editor.h */ |
3 | /**************************************************************************/ |
4 | /* This file is part of: */ |
5 | /* GODOT ENGINE */ |
6 | /* https://godotengine.org */ |
7 | /**************************************************************************/ |
8 | /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ |
9 | /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ |
10 | /* */ |
11 | /* Permission is hereby granted, free of charge, to any person obtaining */ |
12 | /* a copy of this software and associated documentation files (the */ |
13 | /* "Software"), to deal in the Software without restriction, including */ |
14 | /* without limitation the rights to use, copy, modify, merge, publish, */ |
15 | /* distribute, sublicense, and/or sell copies of the Software, and to */ |
16 | /* permit persons to whom the Software is furnished to do so, subject to */ |
17 | /* the following conditions: */ |
18 | /* */ |
19 | /* The above copyright notice and this permission notice shall be */ |
20 | /* included in all copies or substantial portions of the Software. */ |
21 | /* */ |
22 | /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ |
23 | /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ |
24 | /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ |
25 | /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ |
26 | /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ |
27 | /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ |
28 | /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ |
29 | /**************************************************************************/ |
30 | |
31 | #ifndef ANIMATION_LIBRARY_EDITOR_H |
32 | #define ANIMATION_LIBRARY_EDITOR_H |
33 | |
34 | #include "editor/animation_track_editor.h" |
35 | #include "editor/editor_plugin.h" |
36 | #include "scene/animation/animation_player.h" |
37 | #include "scene/gui/dialogs.h" |
38 | #include "scene/gui/tree.h" |
39 | |
40 | class EditorFileDialog; |
41 | |
42 | class AnimationLibraryEditor : public AcceptDialog { |
43 | GDCLASS(AnimationLibraryEditor, AcceptDialog) |
44 | |
45 | enum { |
46 | LIB_BUTTON_ADD, |
47 | LIB_BUTTON_LOAD, |
48 | LIB_BUTTON_PASTE, |
49 | LIB_BUTTON_FILE, |
50 | LIB_BUTTON_DELETE, |
51 | }; |
52 | enum { |
53 | ANIM_BUTTON_COPY, |
54 | ANIM_BUTTON_FILE, |
55 | ANIM_BUTTON_DELETE, |
56 | }; |
57 | |
58 | enum { |
59 | , |
60 | , |
61 | , |
62 | , |
63 | |
64 | , |
65 | , |
66 | , |
67 | , |
68 | }; |
69 | |
70 | enum FileDialogAction { |
71 | FILE_DIALOG_ACTION_OPEN_LIBRARY, |
72 | FILE_DIALOG_ACTION_SAVE_LIBRARY, |
73 | FILE_DIALOG_ACTION_OPEN_ANIMATION, |
74 | FILE_DIALOG_ACTION_SAVE_ANIMATION, |
75 | }; |
76 | |
77 | FileDialogAction file_dialog_action = FILE_DIALOG_ACTION_OPEN_ANIMATION; |
78 | |
79 | StringName file_dialog_animation; |
80 | StringName file_dialog_library; |
81 | |
82 | AcceptDialog *error_dialog = nullptr; |
83 | bool adding_animation = false; |
84 | StringName adding_animation_to_library; |
85 | EditorFileDialog *file_dialog = nullptr; |
86 | ConfirmationDialog *add_library_dialog = nullptr; |
87 | LineEdit *add_library_name = nullptr; |
88 | Label *add_library_validate = nullptr; |
89 | PopupMenu * = nullptr; |
90 | |
91 | Tree *tree = nullptr; |
92 | |
93 | Object *player = nullptr; |
94 | |
95 | void _add_library(); |
96 | void _add_library_validate(const String &p_name); |
97 | void _add_library_confirm(); |
98 | void _load_library(); |
99 | void _load_file(String p_path); |
100 | |
101 | void _item_renamed(); |
102 | void _button_pressed(TreeItem *p_item, int p_column, int p_id, MouseButton p_button); |
103 | |
104 | void (int p_id); |
105 | |
106 | bool updating = false; |
107 | |
108 | protected: |
109 | void _update_editor(Object *p_player); |
110 | static void _bind_methods(); |
111 | |
112 | public: |
113 | void set_animation_player(Object *p_player); |
114 | void show_dialog(); |
115 | void update_tree(); |
116 | AnimationLibraryEditor(); |
117 | }; |
118 | |
119 | #endif // ANIMATION_LIBRARY_EDITOR_H |
120 | |