Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
godotengine
GitHub Repository: godotengine/godot
Path: blob/master/editor/animation/animation_track_editor_plugins.h
21382 views
1
/**************************************************************************/
2
/* animation_track_editor_plugins.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/animation/animation_track_editor.h"
34
35
class AnimationTrackEditBool : public AnimationTrackEdit {
36
GDCLASS(AnimationTrackEditBool, AnimationTrackEdit);
37
38
public:
39
virtual int get_key_height() const override;
40
virtual Rect2 get_key_rect(int p_index, float p_pixels_sec) override;
41
virtual bool is_key_selectable_by_distance() const override;
42
virtual void draw_key(int p_index, float p_pixels_sec, int p_x, bool p_selected, int p_clip_left, int p_clip_right) override;
43
};
44
45
class AnimationTrackEditColor : public AnimationTrackEdit {
46
GDCLASS(AnimationTrackEditColor, AnimationTrackEdit);
47
48
public:
49
virtual int get_key_height() const override;
50
virtual Rect2 get_key_rect(int p_index, float p_pixels_sec) override;
51
virtual bool is_key_selectable_by_distance() const override;
52
virtual void draw_key(int p_index, float p_pixels_sec, int p_x, bool p_selected, int p_clip_left, int p_clip_right) override;
53
virtual void draw_key_link(int p_index_from, int p_index_to, float p_pixels_sec, int p_x, int p_next_x, int p_clip_left, int p_clip_right) override;
54
};
55
56
class AnimationTrackEditAudio : public AnimationTrackEdit {
57
GDCLASS(AnimationTrackEditAudio, AnimationTrackEdit);
58
59
ObjectID id;
60
61
void _preview_changed(ObjectID p_which);
62
63
public:
64
virtual int get_key_height() const override;
65
virtual Rect2 get_key_rect(int p_index, float p_pixels_sec) override;
66
virtual bool is_key_selectable_by_distance() const override;
67
virtual void draw_key(int p_index, float p_pixels_sec, int p_x, bool p_selected, int p_clip_left, int p_clip_right) override;
68
69
void set_node(Object *p_object);
70
71
AnimationTrackEditAudio();
72
};
73
74
class AnimationTrackEditSpriteFrame : public AnimationTrackEdit {
75
GDCLASS(AnimationTrackEditSpriteFrame, AnimationTrackEdit);
76
77
ObjectID id;
78
bool is_coords = false;
79
80
public:
81
virtual int get_key_height() const override;
82
virtual Rect2 get_key_rect(int p_index, float p_pixels_sec) override;
83
virtual bool is_key_selectable_by_distance() const override;
84
virtual void draw_key(int p_index, float p_pixels_sec, int p_x, bool p_selected, int p_clip_left, int p_clip_right) override;
85
86
void set_node(Object *p_object);
87
void set_as_coords();
88
};
89
90
class AnimationTrackEditSubAnim : public AnimationTrackEdit {
91
GDCLASS(AnimationTrackEditSubAnim, AnimationTrackEdit);
92
93
ObjectID id;
94
95
public:
96
virtual int get_key_height() const override;
97
virtual Rect2 get_key_rect(int p_index, float p_pixels_sec) override;
98
virtual bool is_key_selectable_by_distance() const override;
99
virtual void draw_key(int p_index, float p_pixels_sec, int p_x, bool p_selected, int p_clip_left, int p_clip_right) override;
100
101
void set_node(Object *p_object);
102
};
103
104
class AnimationTrackEditTypeAudio : public AnimationTrackEdit {
105
GDCLASS(AnimationTrackEditTypeAudio, AnimationTrackEdit);
106
107
void _preview_changed(ObjectID p_which);
108
109
bool len_resizing = false;
110
bool len_resizing_start = false;
111
int len_resizing_index = 0;
112
float len_resizing_from_px = 0.0f;
113
float len_resizing_rel = 0.0f;
114
bool over_drag_position = false;
115
116
public:
117
virtual void gui_input(const Ref<InputEvent> &p_event) override;
118
119
virtual bool can_drop_data(const Point2 &p_point, const Variant &p_data) const override;
120
virtual void drop_data(const Point2 &p_point, const Variant &p_data) override;
121
122
virtual int get_key_height() const override;
123
virtual Rect2 get_key_rect(int p_index, float p_pixels_sec) override;
124
virtual bool is_key_selectable_by_distance() const override;
125
virtual void draw_key(int p_index, float p_pixels_sec, int p_x, bool p_selected, int p_clip_left, int p_clip_right) override;
126
127
virtual CursorShape get_cursor_shape(const Point2 &p_pos) const override;
128
129
AnimationTrackEditTypeAudio();
130
};
131
132
class AnimationTrackEditTypeAnimation : public AnimationTrackEdit {
133
GDCLASS(AnimationTrackEditTypeAnimation, AnimationTrackEdit);
134
135
ObjectID id;
136
137
public:
138
virtual int get_key_height() const override;
139
virtual Rect2 get_key_rect(int p_index, float p_pixels_sec) override;
140
virtual bool is_key_selectable_by_distance() const override;
141
virtual void draw_key(int p_index, float p_pixels_sec, int p_x, bool p_selected, int p_clip_left, int p_clip_right) override;
142
143
void set_node(Object *p_object);
144
};
145
146
class AnimationTrackEditVolumeDB : public AnimationTrackEdit {
147
GDCLASS(AnimationTrackEditVolumeDB, AnimationTrackEdit);
148
149
public:
150
virtual void draw_bg(int p_clip_left, int p_clip_right) override;
151
virtual void draw_fg(int p_clip_left, int p_clip_right) override;
152
virtual int get_key_height() const override;
153
virtual void draw_key_link(int p_index_from, int p_index_to, float p_pixels_sec, int p_x, int p_next_x, int p_clip_left, int p_clip_right) override;
154
};
155
156
class AnimationTrackEditDefaultPlugin : public AnimationTrackEditPlugin {
157
GDCLASS(AnimationTrackEditDefaultPlugin, AnimationTrackEditPlugin);
158
159
public:
160
virtual AnimationTrackEdit *create_value_track_edit(Object *p_object, Variant::Type p_type, const String &p_property, PropertyHint p_hint, const String &p_hint_string, int p_usage) override;
161
virtual AnimationTrackEdit *create_audio_track_edit() override;
162
virtual AnimationTrackEdit *create_animation_track_edit(Object *p_object) override;
163
};
164
165