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