Skip to content
0.2.0-dev Download ZIP
107 lines ·4.1 KB Raw
1/**************************************************************************/
2/* audio_stream_interactive_editor_plugin.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#pragma once
32
33#include "editor/inspector/editor_inspector.h"
34#include "editor/plugins/editor_plugin.h"
35#include "scene/gui/dialogs.h"
36
37class CheckBox;
38class HSplitContainer;
39class VSplitContainer;
40class Tree;
41class TreeItem;
42class AudioStreamInteractive;
43
44class AudioStreamInteractiveTransitionEditor : public AcceptDialog {
45 GDCLASS(AudioStreamInteractiveTransitionEditor, AcceptDialog);
46
47 AudioStreamInteractive *audio_stream_interactive = nullptr;
48
49 HSplitContainer *split = nullptr;
50 Tree *tree = nullptr;
51
52 Vector<TreeItem *> rows;
53
54 CheckBox *transition_enabled = nullptr;
55 OptionButton *transition_from = nullptr;
56 OptionButton *transition_to = nullptr;
57 OptionButton *fade_mode = nullptr;
58 SpinBox *fade_beats = nullptr;
59 OptionButton *filler_clip = nullptr;
60 CheckBox *hold_previous = nullptr;
61
62 bool updating_selection = false;
63 int order_counter = 0;
64 HashMap<Vector2i, int> selection_order;
65
66 Vector<Vector2i> selected;
67 bool updating = false;
68 void _cell_selected(TreeItem *p_item, int p_column, bool p_selected);
69 void _update_transitions();
70
71 void _update_selection();
72 void _edited();
73
74protected:
75 void _notification(int p_what);
76 static void _bind_methods();
77
78public:
79 void edit(Object *p_obj);
80
81 AudioStreamInteractiveTransitionEditor();
82};
83
84//
85
86class EditorInspectorPluginAudioStreamInteractive : public EditorInspectorPlugin {
87 GDCLASS(EditorInspectorPluginAudioStreamInteractive, EditorInspectorPlugin);
88
89 AudioStreamInteractiveTransitionEditor *audio_stream_interactive_transition_editor = nullptr;
90
91 void _edit(Object *p_object);
92
93public:
94 virtual bool can_handle(Object *p_object) override;
95 virtual void parse_end(Object *p_object) override;
96
97 EditorInspectorPluginAudioStreamInteractive();
98};
99
100class AudioStreamInteractiveEditorPlugin : public EditorPlugin {
101 GDCLASS(AudioStreamInteractiveEditorPlugin, EditorPlugin);
102
103public:
104 virtual String get_plugin_name() const override { return "AudioStreamInteractive"; }
105
106 AudioStreamInteractiveEditorPlugin();
107};