| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
#pragma once |
| 32 |
|
| 33 |
#include "editor/editor_data.h" |
| 34 |
#include "editor/inspector/editor_properties.h" |
| 35 |
#include "editor/inspector/property_selector.h" |
| 36 |
#include "scene/3d/node_3d.h" |
| 37 |
#include "scene/gui/control.h" |
| 38 |
#include "scene/gui/menu_button.h" |
| 39 |
#include "scene/gui/scroll_bar.h" |
| 40 |
#include "scene/gui/tree.h" |
| 41 |
#include "scene/resources/animation.h" |
| 42 |
|
| 43 |
class AnimationMarkerEdit; |
| 44 |
class AnimationTrackEditor; |
| 45 |
class AnimationTrackEdit; |
| 46 |
class CheckBox; |
| 47 |
class ColorPickerButton; |
| 48 |
class EditorSpinSlider; |
| 49 |
class HSlider; |
| 50 |
class OptionButton; |
| 51 |
class PanelContainer; |
| 52 |
class SceneTreeDialog; |
| 53 |
class SpinBox; |
| 54 |
class TextureRect; |
| 55 |
class ViewPanner; |
| 56 |
class EditorValidationPanel; |
| 57 |
|
| 58 |
class AnimationTrackKeyEdit : public Object { |
| 59 |
GDCLASS(AnimationTrackKeyEdit, Object); |
| 60 |
|
| 61 |
public: |
| 62 |
bool setting = false; |
| 63 |
bool animation_read_only = false; |
| 64 |
|
| 65 |
Ref<Animation> animation; |
| 66 |
int track = -1; |
| 67 |
float key_ofs = 0; |
| 68 |
Node *root_path = nullptr; |
| 69 |
|
| 70 |
PropertyInfo hint; |
| 71 |
NodePath base; |
| 72 |
bool use_fps = false; |
| 73 |
AnimationTrackEditor *editor = nullptr; |
| 74 |
|
| 75 |
bool _hide_script_from_inspector() { return true; } |
| 76 |
bool _hide_metadata_from_inspector() { return true; } |
| 77 |
bool _dont_undo_redo() { return true; } |
| 78 |
|
| 79 |
bool _is_read_only() { return animation_read_only; } |
| 80 |
|
| 81 |
void notify_change(); |
| 82 |
Node *get_root_path(); |
| 83 |
void set_use_fps(bool p_enable); |
| 84 |
|
| 85 |
protected: |
| 86 |
static void _bind_methods(); |
| 87 |
void _fix_node_path(Variant &value); |
| 88 |
void _update_obj(const Ref<Animation> &p_anim); |
| 89 |
void _key_ofs_changed(const Ref<Animation> &p_anim, float from, float to); |
| 90 |
bool _set(const StringName &p_name, const Variant &p_value); |
| 91 |
bool _get(const StringName &p_name, Variant &r_ret) const; |
| 92 |
void _get_property_list(List<PropertyInfo> *p_list) const; |
| 93 |
}; |
| 94 |
|
| 95 |
class AnimationMultiTrackKeyEdit : public Object { |
| 96 |
GDCLASS(AnimationMultiTrackKeyEdit, Object); |
| 97 |
|
| 98 |
public: |
| 99 |
bool setting = false; |
| 100 |
bool animation_read_only = false; |
| 101 |
|
| 102 |
Ref<Animation> animation; |
| 103 |
|
| 104 |
RBMap<int, List<float>> key_ofs_map; |
| 105 |
RBMap<int, NodePath> base_map; |
| 106 |
PropertyInfo hint; |
| 107 |
|
| 108 |
Node *root_path = nullptr; |
| 109 |
|
| 110 |
bool use_fps = false; |
| 111 |
AnimationTrackEditor *editor = nullptr; |
| 112 |
|
| 113 |
bool _hide_script_from_inspector() { return true; } |
| 114 |
bool _hide_metadata_from_inspector() { return true; } |
| 115 |
bool _dont_undo_redo() { return true; } |
| 116 |
|
| 117 |
bool _is_read_only() { return animation_read_only; } |
| 118 |
|
| 119 |
void notify_change(); |
| 120 |
Node *get_root_path(); |
| 121 |
void set_use_fps(bool p_enable); |
| 122 |
|
| 123 |
protected: |
| 124 |
static void _bind_methods(); |
| 125 |
void _fix_node_path(Variant &value, NodePath &base); |
| 126 |
void _update_obj(const Ref<Animation> &p_anim); |
| 127 |
void _key_ofs_changed(const Ref<Animation> &p_anim, float from, float to); |
| 128 |
bool _set(const StringName &p_name, const Variant &p_value); |
| 129 |
bool _get(const StringName &p_name, Variant &r_ret) const; |
| 130 |
void _get_property_list(List<PropertyInfo> *p_list) const; |
| 131 |
}; |
| 132 |
|
| 133 |
class AnimationMarkerKeyEdit : public Object { |
| 134 |
GDCLASS(AnimationMarkerKeyEdit, Object); |
| 135 |
|
| 136 |
public: |
| 137 |
bool animation_read_only = false; |
| 138 |
|
| 139 |
Ref<Animation> animation; |
| 140 |
StringName marker_name; |
| 141 |
bool use_fps = false; |
| 142 |
|
| 143 |
AnimationMarkerEdit *marker_edit = nullptr; |
| 144 |
|
| 145 |
bool _hide_script_from_inspector() { return true; } |
| 146 |
bool _hide_metadata_from_inspector() { return true; } |
| 147 |
bool _dont_undo_redo() { return true; } |
| 148 |
|
| 149 |
bool _is_read_only() { return animation_read_only; } |
| 150 |
|
| 151 |
float get_time() const; |
| 152 |
|
| 153 |
protected: |
| 154 |
static void _bind_methods(); |
| 155 |
void _set_marker_name(const StringName &p_name); |
| 156 |
bool _set(const StringName &p_name, const Variant &p_value); |
| 157 |
bool _get(const StringName &p_name, Variant &r_ret) const; |
| 158 |
void _get_property_list(List<PropertyInfo> *p_list) const; |
| 159 |
}; |
| 160 |
|
| 161 |
class AnimationMultiMarkerKeyEdit : public Object { |
| 162 |
GDCLASS(AnimationMultiMarkerKeyEdit, Object); |
| 163 |
|
| 164 |
public: |
| 165 |
bool animation_read_only = false; |
| 166 |
|
| 167 |
Ref<Animation> animation; |
| 168 |
Vector<StringName> marker_names; |
| 169 |
|
| 170 |
AnimationMarkerEdit *marker_edit = nullptr; |
| 171 |
|
| 172 |
bool _hide_script_from_inspector() { return true; } |
| 173 |
bool _hide_metadata_from_inspector() { return true; } |
| 174 |
bool _dont_undo_redo() { return true; } |
| 175 |
|
| 176 |
bool _is_read_only() { return animation_read_only; } |
| 177 |
|
| 178 |
protected: |
| 179 |
static void _bind_methods(); |
| 180 |
bool _set(const StringName &p_name, const Variant &p_value); |
| 181 |
bool _get(const StringName &p_name, Variant &r_ret) const; |
| 182 |
void _get_property_list(List<PropertyInfo> *p_list) const; |
| 183 |
}; |
| 184 |
|
| 185 |
class AnimationTimelineEdit : public Range { |
| 186 |
GDCLASS(AnimationTimelineEdit, Range); |
| 187 |
|
| 188 |
friend class AnimationBezierTrackEdit; |
| 189 |
friend class AnimationTrackEditor; |
| 190 |
friend class AnimationMarkerEdit; |
| 191 |
|
| 192 |
static constexpr float SCROLL_ZOOM_FACTOR_IN = 1.02f; |
| 193 |
static constexpr float SCROLL_ZOOM_FACTOR_OUT = 0.98f; |
| 194 |
|
| 195 |
Ref<Animation> animation; |
| 196 |
bool read_only = false; |
| 197 |
|
| 198 |
AnimationTrackEdit *track_edit = nullptr; |
| 199 |
AnimationTrackEditor *editor = nullptr; |
| 200 |
int name_limit = 0; |
| 201 |
Range *zoom = nullptr; |
| 202 |
Range *h_scroll = nullptr; |
| 203 |
float play_position_pos = 0.0f; |
| 204 |
|
| 205 |
HBoxContainer *add_track_hb = nullptr; |
| 206 |
HBoxContainer *len_hb = nullptr; |
| 207 |
EditorSpinSlider *length = nullptr; |
| 208 |
Button *loop = nullptr; |
| 209 |
TextureRect *time_icon = nullptr; |
| 210 |
|
| 211 |
MenuButton *add_track = nullptr; |
| 212 |
LineEdit *filter_track = nullptr; |
| 213 |
Control *play_position = nullptr; |
| 214 |
HScrollBar *hscroll = nullptr; |
| 215 |
|
| 216 |
void _zoom_changed(double); |
| 217 |
void _anim_length_changed(double p_new_len); |
| 218 |
void _anim_loop_pressed(); |
| 219 |
|
| 220 |
void _play_position_draw(); |
| 221 |
Rect2 hsize_rect; |
| 222 |
|
| 223 |
bool editing = false; |
| 224 |
bool use_fps = false; |
| 225 |
|
| 226 |
Ref<ViewPanner> panner; |
| 227 |
void _pan_callback(Vector2 p_scroll_vec, Ref<InputEvent> p_event); |
| 228 |
void _zoom_callback(float p_zoom_factor, Vector2 p_origin, Ref<InputEvent> p_event); |
| 229 |
|
| 230 |
Rect2 timeline_resize_rect; |
| 231 |
float timeline_resize_from = 0.0f; |
| 232 |
float timeline_resize_at = 0.0f; |
| 233 |
bool resizing_timeline = false; |
| 234 |
|
| 235 |
bool dragging_timeline = false; |
| 236 |
bool dragging_hsize = false; |
| 237 |
float dragging_hsize_from = 0.0f; |
| 238 |
float dragging_hsize_at = 0.0f; |
| 239 |
double last_zoom_scale = 1.0; |
| 240 |
double hscroll_on_zoom_buffer = -1.0; |
| 241 |
|
| 242 |
Vector2 zoom_scroll_origin; |
| 243 |
bool zoom_callback_occurred = false; |
| 244 |
|
| 245 |
virtual void gui_input(const Ref<InputEvent> &p_event) override; |
| 246 |
void _commit_timeline_resize(); |
| 247 |
void _stop_dragging(); |
| 248 |
void _track_added(int p_track); |
| 249 |
|
| 250 |
float _get_zoom_scale(double p_zoom_value) const; |
| 251 |
void _scroll_to_start(); |
| 252 |
|
| 253 |
protected: |
| 254 |
static void _bind_methods(); |
| 255 |
void _notification(int p_what); |
| 256 |
|
| 257 |
public: |
| 258 |
int get_name_limit() const; |
| 259 |
int get_buttons_width() const; |
| 260 |
|
| 261 |
float get_zoom_scale() const; |
| 262 |
|
| 263 |
virtual Size2 get_minimum_size() const override; |
| 264 |
void set_animation(const Ref<Animation> &p_animation, bool p_read_only); |
| 265 |
void set_track_edit(AnimationTrackEdit *p_track_edit); |
| 266 |
void set_editor(AnimationTrackEditor *p_editor); |
| 267 |
void set_zoom(Range *p_zoom); |
| 268 |
Range *get_zoom() const { return zoom; } |
| 269 |
void auto_fit(); |
| 270 |
|
| 271 |
void set_play_position(float p_pos); |
| 272 |
float get_play_position() const; |
| 273 |
void update_play_position(); |
| 274 |
|
| 275 |
void update_values(); |
| 276 |
|
| 277 |
void set_use_fps(bool p_use_fps); |
| 278 |
bool is_using_fps() const; |
| 279 |
|
| 280 |
void set_hscroll(HScrollBar *p_hscroll); |
| 281 |
|
| 282 |
virtual CursorShape get_cursor_shape(const Point2 &p_pos) const override; |
| 283 |
|
| 284 |
AnimationTimelineEdit(); |
| 285 |
}; |
| 286 |
|
| 287 |
class AnimationMarkerEdit : public Control { |
| 288 |
GDCLASS(AnimationMarkerEdit, Control); |
| 289 |
friend class AnimationTimelineEdit; |
| 290 |
|
| 291 |
enum { |
| 292 |
MENU_KEY_INSERT, |
| 293 |
MENU_KEY_RENAME, |
| 294 |
MENU_KEY_DELETE, |
| 295 |
MENU_KEY_TOGGLE_MARKER_NAMES, |
| 296 |
}; |
| 297 |
|
| 298 |
AnimationTimelineEdit *timeline = nullptr; |
| 299 |
Control *play_position = nullptr; |
| 300 |
float play_position_pos = 0.0f; |
| 301 |
|
| 302 |
HashSet<StringName> selection; |
| 303 |
|
| 304 |
Ref<Animation> animation; |
| 305 |
bool read_only = false; |
| 306 |
|
| 307 |
Ref<Texture2D> type_icon; |
| 308 |
Ref<Texture2D> selected_icon; |
| 309 |
|
| 310 |
PopupMenu *menu = nullptr; |
| 311 |
|
| 312 |
bool hovered = false; |
| 313 |
StringName hovering_marker; |
| 314 |
|
| 315 |
void _zoom_changed(); |
| 316 |
|
| 317 |
Ref<Texture2D> icon_cache; |
| 318 |
|
| 319 |
void _menu_selected(int p_index); |
| 320 |
|
| 321 |
void _play_position_draw(); |
| 322 |
bool _try_select_at_ui_pos(const Point2 &p_pos, bool p_aggregate, bool p_deselectable); |
| 323 |
bool _is_ui_pos_in_current_section(const Point2 &p_pos); |
| 324 |
|
| 325 |
float insert_at_pos = 0.0f; |
| 326 |
bool moving_selection_attempt = false; |
| 327 |
bool moving_selection_effective = false; |
| 328 |
float moving_selection_offset = 0.0f; |
| 329 |
float moving_selection_pivot = 0.0f; |
| 330 |
float moving_selection_mouse_begin_x = 0.0f; |
| 331 |
float moving_selection_mouse_begin_y = 0.0f; |
| 332 |
StringName select_single_attempt; |
| 333 |
bool moving_selection = false; |
| 334 |
void _move_selection_begin(); |
| 335 |
void _move_selection(float p_offset); |
| 336 |
void _move_selection_commit(); |
| 337 |
void _move_selection_cancel(); |
| 338 |
|
| 339 |
void _clear_selection_for_anim(const Ref<Animation> &p_anim); |
| 340 |
void _select_key(const StringName &p_name, bool is_single = false); |
| 341 |
void _deselect_key(const StringName &p_name); |
| 342 |
|
| 343 |
void _insert_marker(float p_ofs); |
| 344 |
void _rename_marker(const StringName &p_name); |
| 345 |
void _delete_selected_markers(); |
| 346 |
|
| 347 |
ConfirmationDialog *marker_insert_confirm = nullptr; |
| 348 |
LineEdit *marker_insert_new_name = nullptr; |
| 349 |
ColorPickerButton *marker_insert_color = nullptr; |
| 350 |
AcceptDialog *marker_insert_error_dialog = nullptr; |
| 351 |
float marker_insert_ofs = 0; |
| 352 |
|
| 353 |
ConfirmationDialog *marker_rename_confirm = nullptr; |
| 354 |
LineEdit *marker_rename_new_name = nullptr; |
| 355 |
StringName marker_rename_prev_name; |
| 356 |
|
| 357 |
AcceptDialog *marker_rename_error_dialog = nullptr; |
| 358 |
|
| 359 |
bool should_show_all_marker_names = false; |
| 360 |
|
| 361 |
|
| 362 |
|
| 363 |
void _marker_insert_confirmed(); |
| 364 |
void _marker_insert_new_name_changed(const String &p_text); |
| 365 |
void _marker_rename_confirmed(); |
| 366 |
void _marker_rename_new_name_changed(const String &p_text); |
| 367 |
|
| 368 |
AnimationTrackEditor *editor = nullptr; |
| 369 |
|
| 370 |
HBoxContainer *_create_hbox_labeled_control(const String &p_text, Control *p_control) const; |
| 371 |
|
| 372 |
void _update_key_edit(); |
| 373 |
void _clear_key_edit(); |
| 374 |
|
| 375 |
AnimationMarkerKeyEdit *key_edit = nullptr; |
| 376 |
AnimationMultiMarkerKeyEdit *multi_key_edit = nullptr; |
| 377 |
|
| 378 |
protected: |
| 379 |
static void _bind_methods(); |
| 380 |
void _notification(int p_what); |
| 381 |
|
| 382 |
virtual void gui_input(const Ref<InputEvent> &p_event) override; |
| 383 |
|
| 384 |
public: |
| 385 |
virtual String get_tooltip(const Point2 &p_pos) const override; |
| 386 |
|
| 387 |
virtual int get_key_height() const; |
| 388 |
virtual Rect2 get_key_rect(float p_pixels_sec) const; |
| 389 |
virtual bool is_key_selectable_by_distance() const; |
| 390 |
virtual void draw_key(const StringName &p_name, float p_pixels_sec, int p_x, bool p_selected, int p_clip_left, int p_clip_right); |
| 391 |
virtual void draw_bg(int p_clip_left, int p_clip_right); |
| 392 |
virtual void draw_fg(int p_clip_left, int p_clip_right); |
| 393 |
|
| 394 |
Ref<Animation> get_animation() const; |
| 395 |
AnimationTimelineEdit *get_timeline() const { return timeline; } |
| 396 |
AnimationTrackEditor *get_editor() const { return editor; } |
| 397 |
bool is_selection_active() const { return !selection.is_empty(); } |
| 398 |
bool is_moving_selection() const { return moving_selection; } |
| 399 |
float get_moving_selection_offset() const { return moving_selection_offset; } |
| 400 |
void set_animation(const Ref<Animation> &p_animation, bool p_read_only); |
| 401 |
virtual Size2 get_minimum_size() const override; |
| 402 |
|
| 403 |
void set_timeline(AnimationTimelineEdit *p_timeline); |
| 404 |
void set_editor(AnimationTrackEditor *p_editor); |
| 405 |
|
| 406 |
void set_play_position(float p_pos); |
| 407 |
void update_play_position(); |
| 408 |
|
| 409 |
void set_use_fps(bool p_use_fps); |
| 410 |
|
| 411 |
PackedStringArray get_selected_section() const; |
| 412 |
bool is_marker_selected(const StringName &p_marker) const; |
| 413 |
|
| 414 |
|
| 415 |
void _clear_selection(bool p_update); |
| 416 |
|
| 417 |
AnimationMarkerEdit(); |
| 418 |
}; |
| 419 |
|
| 420 |
class AnimationTrackEdit : public Control { |
| 421 |
GDCLASS(AnimationTrackEdit, Control); |
| 422 |
friend class AnimationTimelineEdit; |
| 423 |
|
| 424 |
enum { |
| 425 |
MENU_CALL_MODE_CONTINUOUS, |
| 426 |
MENU_CALL_MODE_DISCRETE, |
| 427 |
MENU_CALL_MODE_CAPTURE, |
| 428 |
MENU_INTERPOLATION_NEAREST, |
| 429 |
MENU_INTERPOLATION_LINEAR, |
| 430 |
MENU_INTERPOLATION_CUBIC, |
| 431 |
MENU_INTERPOLATION_LINEAR_ANGLE, |
| 432 |
MENU_INTERPOLATION_CUBIC_ANGLE, |
| 433 |
MENU_LOOP_WRAP, |
| 434 |
MENU_LOOP_CLAMP, |
| 435 |
MENU_KEY_INSERT, |
| 436 |
MENU_KEY_DUPLICATE, |
| 437 |
MENU_KEY_CUT, |
| 438 |
MENU_KEY_COPY, |
| 439 |
MENU_KEY_PASTE, |
| 440 |
MENU_KEY_ADD_RESET, |
| 441 |
MENU_KEY_DELETE, |
| 442 |
MENU_KEY_LOOKUP, |
| 443 |
MENU_USE_BLEND_ENABLED, |
| 444 |
MENU_USE_BLEND_DISABLED, |
| 445 |
}; |
| 446 |
|
| 447 |
AnimationTimelineEdit *timeline = nullptr; |
| 448 |
Popup *path_popup = nullptr; |
| 449 |
LineEdit *path = nullptr; |
| 450 |
Node *root = nullptr; |
| 451 |
Control *play_position = nullptr; |
| 452 |
float play_position_pos = 0.0f; |
| 453 |
NodePath node_path; |
| 454 |
|
| 455 |
Ref<Animation> animation; |
| 456 |
bool read_only = false; |
| 457 |
int track = 0; |
| 458 |
|
| 459 |
Rect2 check_rect; |
| 460 |
Rect2 icon_rect; |
| 461 |
Rect2 path_rect; |
| 462 |
|
| 463 |
Rect2 update_mode_rect; |
| 464 |
Rect2 interp_mode_rect; |
| 465 |
Rect2 loop_wrap_rect; |
| 466 |
Rect2 remove_rect; |
| 467 |
|
| 468 |
Ref<Texture2D> type_icon; |
| 469 |
Ref<Texture2D> selected_icon; |
| 470 |
|
| 471 |
PopupMenu *menu = nullptr; |
| 472 |
|
| 473 |
bool hovered = false; |
| 474 |
bool clicking_on_name = false; |
| 475 |
int hovering_key_idx = -1; |
| 476 |
|
| 477 |
void _zoom_changed(); |
| 478 |
|
| 479 |
Ref<Texture2D> icon_cache; |
| 480 |
String path_cache; |
| 481 |
|
| 482 |
void _menu_selected(int p_index); |
| 483 |
|
| 484 |
void _path_submitted(const String &p_text); |
| 485 |
void _play_position_draw(); |
| 486 |
bool _is_value_key_valid(const Variant &p_key_value, Variant::Type &r_valid_type) const; |
| 487 |
bool _try_select_at_ui_pos(const Point2 &p_pos, bool p_aggregate, bool p_deselectable); |
| 488 |
|
| 489 |
int lookup_key_idx = -1; |
| 490 |
bool _lookup_key(int p_key_idx) const; |
| 491 |
|
| 492 |
Ref<Texture2D> _get_key_type_icon() const; |
| 493 |
|
| 494 |
mutable int dropping_at = 0; |
| 495 |
float insert_at_pos = 0.0f; |
| 496 |
bool moving_selection_attempt = false; |
| 497 |
bool moving_selection_effective = false; |
| 498 |
float moving_selection_pivot = 0.0f; |
| 499 |
float moving_selection_mouse_begin_x = 0.0f; |
| 500 |
int select_single_attempt = -1; |
| 501 |
bool moving_selection = false; |
| 502 |
|
| 503 |
bool command_or_control_pressed = false; |
| 504 |
|
| 505 |
bool in_group = false; |
| 506 |
AnimationTrackEditor *editor = nullptr; |
| 507 |
|
| 508 |
protected: |
| 509 |
static void _bind_methods(); |
| 510 |
void _notification(int p_what); |
| 511 |
|
| 512 |
virtual void gui_input(const Ref<InputEvent> &p_event) override; |
| 513 |
|
| 514 |
public: |
| 515 |
virtual Variant get_drag_data(const Point2 &p_point) override; |
| 516 |
virtual bool can_drop_data(const Point2 &p_point, const Variant &p_data) const override; |
| 517 |
virtual void drop_data(const Point2 &p_point, const Variant &p_data) override; |
| 518 |
|
| 519 |
virtual CursorShape get_cursor_shape(const Point2 &p_pos) const override; |
| 520 |
virtual String get_tooltip(const Point2 &p_pos) const override; |
| 521 |
|
| 522 |
virtual int get_key_height() const; |
| 523 |
virtual Rect2 get_key_rect(int p_index, float p_pixels_sec); |
| 524 |
virtual bool is_key_selectable_by_distance() const; |
| 525 |
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); |
| 526 |
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); |
| 527 |
virtual void draw_bg(int p_clip_left, int p_clip_right); |
| 528 |
virtual void draw_fg(int p_clip_left, int p_clip_right); |
| 529 |
|
| 530 |
|
| 531 |
void draw_texture_region_clipped(const Ref<Texture2D> &p_texture, const Rect2 &p_rect, const Rect2 &p_region); |
| 532 |
void draw_rect_clipped(const Rect2 &p_rect, const Color &p_color, bool p_filled = true); |
| 533 |
|
| 534 |
int get_track() const; |
| 535 |
Ref<Animation> get_animation() const; |
| 536 |
AnimationTimelineEdit *get_timeline() const { return timeline; } |
| 537 |
AnimationTrackEditor *get_editor() const { return editor; } |
| 538 |
NodePath get_path() const; |
| 539 |
void set_animation_and_track(const Ref<Animation> &p_animation, int p_track, bool p_read_only); |
| 540 |
virtual Size2 get_minimum_size() const override; |
| 541 |
|
| 542 |
void set_timeline(AnimationTimelineEdit *p_timeline); |
| 543 |
void set_editor(AnimationTrackEditor *p_editor); |
| 544 |
void set_root(Node *p_root); |
| 545 |
|
| 546 |
void set_play_position(float p_pos); |
| 547 |
void update_play_position(); |
| 548 |
void cancel_drop(); |
| 549 |
|
| 550 |
void set_in_group(bool p_enable); |
| 551 |
void append_to_selection(const Rect2 &p_box, bool p_deselection); |
| 552 |
|
| 553 |
AnimationTrackEdit(); |
| 554 |
}; |
| 555 |
|
| 556 |
class AnimationTrackEditPlugin : public RefCounted { |
| 557 |
GDCLASS(AnimationTrackEditPlugin, RefCounted); |
| 558 |
|
| 559 |
public: |
| 560 |
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); |
| 561 |
virtual AnimationTrackEdit *create_audio_track_edit(); |
| 562 |
virtual AnimationTrackEdit *create_animation_track_edit(Object *p_object); |
| 563 |
}; |
| 564 |
|
| 565 |
class AnimationTrackKeyEdit; |
| 566 |
class AnimationMultiTrackKeyEdit; |
| 567 |
class AnimationBezierTrackEdit; |
| 568 |
|
| 569 |
class AnimationTrackEditGroup : public Control { |
| 570 |
GDCLASS(AnimationTrackEditGroup, Control); |
| 571 |
Ref<Texture2D> icon; |
| 572 |
Vector2 icon_size; |
| 573 |
String node_name; |
| 574 |
NodePath node; |
| 575 |
Node *root = nullptr; |
| 576 |
AnimationTimelineEdit *timeline = nullptr; |
| 577 |
AnimationTrackEditor *editor = nullptr; |
| 578 |
|
| 579 |
bool hovered = false; |
| 580 |
|
| 581 |
void _zoom_changed(); |
| 582 |
|
| 583 |
protected: |
| 584 |
void _notification(int p_what); |
| 585 |
|
| 586 |
virtual void gui_input(const Ref<InputEvent> &p_event) override; |
| 587 |
|
| 588 |
public: |
| 589 |
void set_type_and_name(const Ref<Texture2D> &p_type, const String &p_name, const NodePath &p_node); |
| 590 |
virtual Size2 get_minimum_size() const override; |
| 591 |
void set_timeline(AnimationTimelineEdit *p_timeline); |
| 592 |
void set_root(Node *p_root); |
| 593 |
void set_editor(AnimationTrackEditor *p_editor); |
| 594 |
String get_node_name() const; |
| 595 |
|
| 596 |
AnimationTrackEditGroup(); |
| 597 |
}; |
| 598 |
|
| 599 |
class AnimationTrackEditor : public VBoxContainer { |
| 600 |
GDCLASS(AnimationTrackEditor, VBoxContainer); |
| 601 |
friend class AnimationTimelineEdit; |
| 602 |
friend class AnimationBezierTrackEdit; |
| 603 |
friend class AnimationMarkerKeyEditEditor; |
| 604 |
|
| 605 |
Ref<Animation> animation; |
| 606 |
bool read_only = false; |
| 607 |
Node *root = nullptr; |
| 608 |
|
| 609 |
AcceptDialog *read_only_dialog = nullptr; |
| 610 |
|
| 611 |
MenuButton *edit = nullptr; |
| 612 |
|
| 613 |
PanelContainer *main_panel = nullptr; |
| 614 |
HScrollBar *hscroll = nullptr; |
| 615 |
ScrollContainer *scroll = nullptr; |
| 616 |
VBoxContainer *track_vbox = nullptr; |
| 617 |
AnimationBezierTrackEdit *bezier_edit = nullptr; |
| 618 |
VBoxContainer *timeline_vbox = nullptr; |
| 619 |
|
| 620 |
MarginContainer *timeline_mc = nullptr; |
| 621 |
void _update_timeline_margins(); |
| 622 |
|
| 623 |
VBoxContainer *info_message_vbox = nullptr; |
| 624 |
Label *info_message = nullptr; |
| 625 |
Button *add_animation_player = nullptr; |
| 626 |
void _add_animation_player(); |
| 627 |
|
| 628 |
AnimationTimelineEdit *timeline = nullptr; |
| 629 |
AnimationMarkerEdit *marker_edit = nullptr; |
| 630 |
HSlider *zoom = nullptr; |
| 631 |
EditorSpinSlider *step = nullptr; |
| 632 |
Button *fps_compat = nullptr; |
| 633 |
Label *nearest_fps_label = nullptr; |
| 634 |
TextureRect *zoom_icon = nullptr; |
| 635 |
Button *snap_keys = nullptr; |
| 636 |
Button *insert_at_current_time = nullptr; |
| 637 |
Button *snap_timeline = nullptr; |
| 638 |
Button *bezier_edit_icon = nullptr; |
| 639 |
OptionButton *snap_mode = nullptr; |
| 640 |
Button *auto_fit = nullptr; |
| 641 |
Button *auto_fit_bezier = nullptr; |
| 642 |
OptionButton *bezier_key_mode = nullptr; |
| 643 |
|
| 644 |
Button *imported_anim_warning = nullptr; |
| 645 |
void _show_imported_anim_warning(); |
| 646 |
|
| 647 |
Button *dummy_player_warning = nullptr; |
| 648 |
void _show_dummy_player_warning(); |
| 649 |
|
| 650 |
Button *inactive_player_warning = nullptr; |
| 651 |
void _show_inactive_player_warning(); |
| 652 |
|
| 653 |
void _snap_mode_changed(int p_mode); |
| 654 |
Vector<AnimationTrackEdit *> track_edits; |
| 655 |
Vector<AnimationTrackEditGroup *> groups; |
| 656 |
|
| 657 |
bool animation_changing_awaiting_update = false; |
| 658 |
void _animation_update(); |
| 659 |
int _get_track_selected(); |
| 660 |
void _animation_changed(); |
| 661 |
void _update_tracks(); |
| 662 |
void _redraw_tracks(); |
| 663 |
void _redraw_groups(); |
| 664 |
void _check_bezier_exist(); |
| 665 |
|
| 666 |
void _name_limit_changed(); |
| 667 |
void _timeline_changed(float p_new_pos, bool p_timeline_only); |
| 668 |
void _track_remove_request(int p_track); |
| 669 |
void _animation_track_remove_request(int p_track, Ref<Animation> p_from_animation); |
| 670 |
void _track_grab_focus(int p_track); |
| 671 |
|
| 672 |
void _update_scroll(double); |
| 673 |
void _update_nearest_fps_label(); |
| 674 |
void _update_fps_compat_mode(bool p_enabled); |
| 675 |
void _update_step(double p_new_step); |
| 676 |
void _update_length(double p_new_len); |
| 677 |
void _dropped_track(int p_from_track, int p_to_track); |
| 678 |
|
| 679 |
void _add_track(int p_type); |
| 680 |
void _new_track_node_selected(NodePath p_path); |
| 681 |
void _new_track_property_selected(const String &p_name); |
| 682 |
|
| 683 |
void _update_step_spinbox(); |
| 684 |
void _store_snap_states(); |
| 685 |
|
| 686 |
PropertySelector *prop_selector = nullptr; |
| 687 |
PropertySelector *method_selector = nullptr; |
| 688 |
SceneTreeDialog *pick_track = nullptr; |
| 689 |
int adding_track_type = 0; |
| 690 |
NodePath adding_track_path; |
| 691 |
|
| 692 |
bool keying = false; |
| 693 |
|
| 694 |
struct InsertData { |
| 695 |
Animation::TrackType type; |
| 696 |
NodePath path; |
| 697 |
int track_idx = 0; |
| 698 |
float time = FLT_MAX; |
| 699 |
Variant value; |
| 700 |
String query; |
| 701 |
bool advance = false; |
| 702 |
}; |
| 703 |
|
| 704 |
Label *insert_confirm_text = nullptr; |
| 705 |
CheckBox *insert_confirm_bezier = nullptr; |
| 706 |
CheckBox *insert_confirm_reset = nullptr; |
| 707 |
ConfirmationDialog *insert_confirm = nullptr; |
| 708 |
bool insert_queue = false; |
| 709 |
List<InsertData> insert_data; |
| 710 |
|
| 711 |
void _query_insert(const InsertData &p_id); |
| 712 |
Ref<Animation> _create_and_get_reset_animation(); |
| 713 |
void _confirm_insert_list(); |
| 714 |
struct TrackIndices { |
| 715 |
int normal; |
| 716 |
int reset; |
| 717 |
|
| 718 |
TrackIndices(const Animation *p_anim = nullptr, const Animation *p_reset_anim = nullptr) { |
| 719 |
normal = p_anim ? p_anim->get_track_count() : 0; |
| 720 |
reset = p_reset_anim ? p_reset_anim->get_track_count() : 0; |
| 721 |
} |
| 722 |
}; |
| 723 |
TrackIndices _confirm_insert(InsertData p_id, TrackIndices p_next_tracks, bool p_reset_wanted, Ref<Animation> p_reset_anim, bool p_create_beziers); |
| 724 |
void _insert_track(bool p_reset_wanted, bool p_create_beziers); |
| 725 |
|
| 726 |
void _root_removed(); |
| 727 |
|
| 728 |
PropertyInfo _find_hint_for_track(int p_idx, NodePath &r_base_path, Variant *r_current_val = nullptr); |
| 729 |
|
| 730 |
void _scroll_changed(const Vector2 &p_val); |
| 731 |
void _v_scroll_changed(float p_val); |
| 732 |
void _h_scroll_changed(float p_val); |
| 733 |
|
| 734 |
Ref<ViewPanner> panner; |
| 735 |
void _pan_callback(Vector2 p_scroll_vec, Ref<InputEvent> p_event); |
| 736 |
void _zoom_callback(float p_zoom_factor, Vector2 p_origin, Ref<InputEvent> p_event); |
| 737 |
|
| 738 |
void _timeline_value_changed(double); |
| 739 |
|
| 740 |
float insert_key_from_track_call_ofs = 0.0f; |
| 741 |
int insert_key_from_track_call_track = 0; |
| 742 |
void _insert_key_from_track(float p_ofs, int p_track); |
| 743 |
void _add_method_key(const String &p_method); |
| 744 |
|
| 745 |
void _fetch_value_track_options(const NodePath &p_path, Animation::UpdateMode *r_update_mode, Animation::InterpolationType *r_interpolation_type, bool *r_loop_wrap); |
| 746 |
|
| 747 |
void _clear_selection_for_anim(const Ref<Animation> &p_anim); |
| 748 |
void _select_at_anim(const Ref<Animation> &p_anim, int p_track, float p_pos); |
| 749 |
|
| 750 |
|
| 751 |
|
| 752 |
struct SelectedKey { |
| 753 |
int track = 0; |
| 754 |
int key = 0; |
| 755 |
bool operator<(const SelectedKey &p_key) const { return track == p_key.track ? key < p_key.key : track < p_key.track; } |
| 756 |
}; |
| 757 |
|
| 758 |
struct KeyInfo { |
| 759 |
float pos = 0; |
| 760 |
}; |
| 761 |
|
| 762 |
RBMap<SelectedKey, KeyInfo> selection; |
| 763 |
|
| 764 |
bool moving_selection = false; |
| 765 |
float moving_selection_offset = 0.0f; |
| 766 |
void _move_selection_begin(); |
| 767 |
void _move_selection(float p_offset); |
| 768 |
void _move_selection_commit(); |
| 769 |
void _move_selection_cancel(); |
| 770 |
|
| 771 |
AnimationTrackKeyEdit *key_edit = nullptr; |
| 772 |
AnimationMultiTrackKeyEdit *multi_key_edit = nullptr; |
| 773 |
void _update_key_edit(); |
| 774 |
void _clear_key_edit(); |
| 775 |
|
| 776 |
Control *box_selection_container = nullptr; |
| 777 |
|
| 778 |
Control *box_selection = nullptr; |
| 779 |
void _box_selection_draw(); |
| 780 |
bool box_selecting = false; |
| 781 |
Vector2 box_selecting_from; |
| 782 |
Vector2 box_selecting_to; |
| 783 |
Rect2 box_select_rect; |
| 784 |
Vector2 prev_scroll_position; |
| 785 |
void _scroll_input(const Ref<InputEvent> &p_event); |
| 786 |
|
| 787 |
Vector<Ref<AnimationTrackEditPlugin>> track_edit_plugins; |
| 788 |
|
| 789 |
void _toggle_bezier_edit(); |
| 790 |
void _cancel_bezier_edit(); |
| 791 |
void _bezier_edit(int p_for_track); |
| 792 |
void _bezier_track_set_key_handle_mode(Animation *p_anim, int p_track, int p_index, Animation::HandleMode p_mode, Animation::HandleSetMode p_set_mode = Animation::HANDLE_SET_MODE_NONE); |
| 793 |
void _bezier_track_set_key_handle_mode_at_time(Animation *p_anim, int p_track, float p_time, Animation::HandleMode p_mode, Animation::HandleSetMode p_set_mode = Animation::HANDLE_SET_MODE_NONE); |
| 794 |
|
| 795 |
|
| 796 |
|
| 797 |
ConfirmationDialog *bake_dialog = nullptr; |
| 798 |
CheckBox *bake_trs = nullptr; |
| 799 |
CheckBox *bake_blendshape = nullptr; |
| 800 |
CheckBox *bake_value = nullptr; |
| 801 |
SpinBox *bake_fps = nullptr; |
| 802 |
|
| 803 |
ConfirmationDialog *optimize_dialog = nullptr; |
| 804 |
SpinBox *optimize_velocity_error = nullptr; |
| 805 |
SpinBox *optimize_angular_error = nullptr; |
| 806 |
SpinBox *optimize_precision_error = nullptr; |
| 807 |
|
| 808 |
ConfirmationDialog *cleanup_dialog = nullptr; |
| 809 |
CheckBox *cleanup_keys_with_trimming_head = nullptr; |
| 810 |
CheckBox *cleanup_keys_with_trimming_end = nullptr; |
| 811 |
CheckBox *cleanup_keys = nullptr; |
| 812 |
CheckBox *cleanup_tracks = nullptr; |
| 813 |
CheckBox *cleanup_all = nullptr; |
| 814 |
|
| 815 |
ConfirmationDialog *scale_dialog = nullptr; |
| 816 |
SpinBox *scale = nullptr; |
| 817 |
|
| 818 |
ConfirmationDialog *ease_dialog = nullptr; |
| 819 |
OptionButton *transition_selection = nullptr; |
| 820 |
OptionButton *ease_selection = nullptr; |
| 821 |
SpinBox *ease_fps = nullptr; |
| 822 |
|
| 823 |
void _select_all_tracks_for_copy(); |
| 824 |
|
| 825 |
void _edit_menu_about_to_popup(); |
| 826 |
void _edit_menu_pressed(int p_option); |
| 827 |
bool scale_from_cursor = false; |
| 828 |
|
| 829 |
void _cleanup_animation(Ref<Animation> p_animation); |
| 830 |
|
| 831 |
void _anim_duplicate_keys(float p_ofs, bool p_ofs_valid, int p_track); |
| 832 |
|
| 833 |
void _anim_copy_keys(bool p_cut); |
| 834 |
|
| 835 |
bool _is_track_compatible(int p_target_track_idx, Variant::Type p_source_value_type, Animation::TrackType p_source_track_type); |
| 836 |
|
| 837 |
void _anim_paste_keys(float p_ofs, bool p_ofs_valid, int p_track); |
| 838 |
|
| 839 |
void _toggle_function_names(); |
| 840 |
Button *function_name_toggler = nullptr; |
| 841 |
|
| 842 |
void _view_group_toggle(); |
| 843 |
|
| 844 |
Button *view_group = nullptr; |
| 845 |
Button *selected_filter = nullptr; |
| 846 |
Button *alphabetic_sorting = nullptr; |
| 847 |
|
| 848 |
void _auto_fit(); |
| 849 |
void _auto_fit_bezier(); |
| 850 |
|
| 851 |
void _root_node_changed(Node *p_node, bool p_removed); |
| 852 |
void _scene_changed(); |
| 853 |
void _selection_changed(); |
| 854 |
|
| 855 |
ConfirmationDialog *track_copy_dialog = nullptr; |
| 856 |
Tree *track_copy_select = nullptr; |
| 857 |
|
| 858 |
struct TrackClipboard { |
| 859 |
NodePath full_path; |
| 860 |
NodePath base_path; |
| 861 |
Animation::TrackType track_type = Animation::TYPE_ANIMATION; |
| 862 |
Animation::InterpolationType interp_type = Animation::INTERPOLATION_CUBIC_ANGLE; |
| 863 |
Animation::UpdateMode update_mode = Animation::UPDATE_CAPTURE; |
| 864 |
Animation::LoopMode loop_mode = Animation::LOOP_PINGPONG; |
| 865 |
bool loop_wrap = false; |
| 866 |
bool enabled = false; |
| 867 |
bool use_blend = false; |
| 868 |
|
| 869 |
struct Key { |
| 870 |
float time = 0; |
| 871 |
float transition = 0; |
| 872 |
Variant value; |
| 873 |
}; |
| 874 |
Vector<Key> keys; |
| 875 |
}; |
| 876 |
|
| 877 |
struct KeyClipboard { |
| 878 |
int top_track; |
| 879 |
|
| 880 |
struct Key { |
| 881 |
Animation::TrackType track_type; |
| 882 |
int track; |
| 883 |
float time = 0; |
| 884 |
float transition = 0; |
| 885 |
Variant value; |
| 886 |
}; |
| 887 |
Vector<Key> keys; |
| 888 |
}; |
| 889 |
|
| 890 |
Vector<TrackClipboard> track_clipboard; |
| 891 |
KeyClipboard key_clipboard; |
| 892 |
|
| 893 |
void _set_key_clipboard(int p_top_track, float p_top_time, RBMap<SelectedKey, KeyInfo> &p_keymap); |
| 894 |
void _insert_animation_key(NodePath p_path, const Variant &p_value); |
| 895 |
|
| 896 |
void _pick_track_filter_text_changed(const String &p_newtext); |
| 897 |
void _pick_track_select_recursive(TreeItem *p_item, const String &p_filter, Vector<Node *> &p_select_candidates); |
| 898 |
|
| 899 |
double snap_unit = 0; |
| 900 |
bool fps_compatible = true; |
| 901 |
int nearest_fps = 0; |
| 902 |
void _update_snap_unit(); |
| 903 |
|
| 904 |
protected: |
| 905 |
static void _bind_methods(); |
| 906 |
void _notification(int p_what); |
| 907 |
|
| 908 |
public: |
| 909 |
|
| 910 |
void _clear_selection(bool p_update = false); |
| 911 |
void _key_selected(int p_key, bool p_single, int p_track); |
| 912 |
void _key_deselected(int p_key, int p_track); |
| 913 |
|
| 914 |
enum { |
| 915 |
EDIT_COPY_TRACKS, |
| 916 |
EDIT_COPY_TRACKS_CONFIRM, |
| 917 |
EDIT_PASTE_TRACKS, |
| 918 |
EDIT_CUT_KEYS, |
| 919 |
EDIT_COPY_KEYS, |
| 920 |
EDIT_PASTE_KEYS, |
| 921 |
EDIT_SCALE_SELECTION, |
| 922 |
EDIT_SCALE_FROM_CURSOR, |
| 923 |
EDIT_SCALE_CONFIRM, |
| 924 |
EDIT_SET_START_OFFSET, |
| 925 |
EDIT_SET_END_OFFSET, |
| 926 |
EDIT_EASE_SELECTION, |
| 927 |
EDIT_EASE_CONFIRM, |
| 928 |
EDIT_DUPLICATE_SELECTED_KEYS, |
| 929 |
EDIT_DUPLICATE_SELECTION, |
| 930 |
EDIT_DUPLICATE_TRANSPOSED, |
| 931 |
EDIT_MOVE_FIRST_SELECTED_KEY_TO_CURSOR, |
| 932 |
EDIT_MOVE_LAST_SELECTED_KEY_TO_CURSOR, |
| 933 |
EDIT_ADD_RESET_KEY, |
| 934 |
EDIT_DELETE_SELECTION, |
| 935 |
EDIT_GOTO_NEXT_STEP, |
| 936 |
EDIT_GOTO_NEXT_STEP_TIMELINE_ONLY, |
| 937 |
EDIT_GOTO_PREV_STEP, |
| 938 |
EDIT_APPLY_RESET, |
| 939 |
EDIT_BAKE_ANIMATION, |
| 940 |
EDIT_BAKE_ANIMATION_CONFIRM, |
| 941 |
EDIT_OPTIMIZE_ANIMATION, |
| 942 |
EDIT_OPTIMIZE_ANIMATION_CONFIRM, |
| 943 |
EDIT_CLEAN_UP_ANIMATION, |
| 944 |
EDIT_CLEAN_UP_ANIMATION_CONFIRM, |
| 945 |
EDIT_GOTO_NEXT_KEYFRAME, |
| 946 |
EDIT_GOTO_PREV_KEYFRAME, |
| 947 |
}; |
| 948 |
|
| 949 |
void add_track_edit_plugin(const Ref<AnimationTrackEditPlugin> &p_plugin); |
| 950 |
void remove_track_edit_plugin(const Ref<AnimationTrackEditPlugin> &p_plugin); |
| 951 |
|
| 952 |
void set_animation(const Ref<Animation> &p_anim, bool p_read_only); |
| 953 |
Ref<Animation> get_current_animation() const; |
| 954 |
void set_root(Node *p_root); |
| 955 |
Node *get_root() const; |
| 956 |
void update_keying(); |
| 957 |
bool has_keying() const; |
| 958 |
|
| 959 |
Dictionary get_state() const; |
| 960 |
void set_state(const Dictionary &p_state); |
| 961 |
void clear(); |
| 962 |
|
| 963 |
void cleanup(); |
| 964 |
|
| 965 |
void set_anim_pos(float p_pos); |
| 966 |
void insert_node_value_key(Node *p_node, const String &p_property, bool p_only_if_exists = false, bool p_advance = false); |
| 967 |
void insert_value_key(const String &p_property, bool p_advance); |
| 968 |
void insert_transform_key(Node3D *p_node, const String &p_sub, const Animation::TrackType p_type, const Variant &p_value); |
| 969 |
bool has_track(Node3D *p_node, const String &p_sub, const Animation::TrackType p_type); |
| 970 |
void make_insert_queue(); |
| 971 |
void commit_insert_queue(); |
| 972 |
|
| 973 |
void show_select_node_warning(bool p_show); |
| 974 |
void show_dummy_player_warning(bool p_show); |
| 975 |
void show_inactive_player_warning(bool p_show); |
| 976 |
|
| 977 |
bool is_key_selected(int p_track, int p_key) const; |
| 978 |
bool is_selection_active() const; |
| 979 |
bool is_key_clipboard_active() const; |
| 980 |
bool is_moving_selection() const; |
| 981 |
bool is_snap_timeline_enabled() const; |
| 982 |
bool is_snap_keys_enabled() const; |
| 983 |
bool is_insert_at_current_time_enabled() const; |
| 984 |
void resolve_insertion_offset(float &r_offset) const; |
| 985 |
bool is_bezier_editor_active() const; |
| 986 |
bool can_add_reset_key() const; |
| 987 |
void _on_filter_updated(const String &p_filter); |
| 988 |
float get_moving_selection_offset() const; |
| 989 |
float snap_time(float p_value, bool p_relative = false); |
| 990 |
float get_snap_unit(); |
| 991 |
bool is_grouping_tracks(); |
| 992 |
bool is_sorting_alphabetically(); |
| 993 |
PackedStringArray get_selected_section() const; |
| 994 |
bool is_marker_selected(const StringName &p_marker) const; |
| 995 |
bool is_marker_moving_selection() const; |
| 996 |
float get_marker_moving_selection_offset() const; |
| 997 |
bool is_function_name_pressed(); |
| 998 |
|
| 999 |
|
| 1000 |
void goto_prev_step(bool p_from_mouse_event); |
| 1001 |
|
| 1002 |
|
| 1003 |
void goto_next_step(bool p_from_mouse_event, bool p_timeline_only = false); |
| 1004 |
|
| 1005 |
bool is_read_only() const; |
| 1006 |
bool is_global_library_read_only() const; |
| 1007 |
void popup_read_only_dialog(); |
| 1008 |
|
| 1009 |
MenuButton *get_edit_menu(); |
| 1010 |
AnimationTrackEditor(); |
| 1011 |
~AnimationTrackEditor(); |
| 1012 |
}; |
| 1013 |
|
| 1014 |
|
| 1015 |
|
| 1016 |
class AnimationTrackKeyEditEditor : public EditorProperty { |
| 1017 |
GDCLASS(AnimationTrackKeyEditEditor, EditorProperty); |
| 1018 |
|
| 1019 |
Ref<Animation> animation; |
| 1020 |
int track = -1; |
| 1021 |
real_t key_ofs = 0.0; |
| 1022 |
bool use_fps = false; |
| 1023 |
|
| 1024 |
EditorSpinSlider *spinner = nullptr; |
| 1025 |
|
| 1026 |
struct KeyDataCache { |
| 1027 |
real_t time = 0.0; |
| 1028 |
float transition = 0.0; |
| 1029 |
Variant value; |
| 1030 |
} key_data_cache; |
| 1031 |
|
| 1032 |
void _time_edit_spun(); |
| 1033 |
void _time_edit_entered(); |
| 1034 |
void _time_edit_exited(); |
| 1035 |
|
| 1036 |
public: |
| 1037 |
AnimationTrackKeyEditEditor(Ref<Animation> p_animation, int p_track, real_t p_key_ofs, bool p_use_fps); |
| 1038 |
}; |
| 1039 |
|
| 1040 |
|
| 1041 |
|
| 1042 |
class AnimationMarkerKeyEditEditor : public EditorProperty { |
| 1043 |
GDCLASS(AnimationMarkerKeyEditEditor, EditorProperty); |
| 1044 |
|
| 1045 |
Ref<Animation> animation; |
| 1046 |
StringName marker_name; |
| 1047 |
bool use_fps = false; |
| 1048 |
|
| 1049 |
EditorSpinSlider *spinner = nullptr; |
| 1050 |
|
| 1051 |
void _time_edit_exited(); |
| 1052 |
|
| 1053 |
public: |
| 1054 |
AnimationMarkerKeyEditEditor(Ref<Animation> p_animation, const StringName &p_name, bool p_use_fps); |
| 1055 |
}; |