2018-08-29 20:38:13 +00:00
|
|
|
/**************************************************************************/
|
|
|
|
/* animation_track_editor_plugins.h */
|
|
|
|
/**************************************************************************/
|
|
|
|
/* This file is part of: */
|
|
|
|
/* GODOT ENGINE */
|
|
|
|
/* https://godotengine.org */
|
|
|
|
/**************************************************************************/
|
|
|
|
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
|
|
|
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
|
|
|
/* */
|
|
|
|
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
|
|
/* a copy of this software and associated documentation files (the */
|
|
|
|
/* "Software"), to deal in the Software without restriction, including */
|
|
|
|
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
|
|
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
|
|
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
|
|
/* the following conditions: */
|
|
|
|
/* */
|
|
|
|
/* The above copyright notice and this permission notice shall be */
|
|
|
|
/* included in all copies or substantial portions of the Software. */
|
|
|
|
/* */
|
|
|
|
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
|
|
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
|
|
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
|
|
|
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
|
|
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
|
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
|
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
|
|
/**************************************************************************/
|
|
|
|
|
2018-06-07 15:46:14 +00:00
|
|
|
#ifndef ANIMATION_TRACK_EDITOR_PLUGINS_H
|
|
|
|
#define ANIMATION_TRACK_EDITOR_PLUGINS_H
|
|
|
|
|
|
|
|
#include "editor/animation_track_editor.h"
|
|
|
|
|
|
|
|
class AnimationTrackEditBool : public AnimationTrackEdit {
|
2019-03-19 18:35:57 +00:00
|
|
|
GDCLASS(AnimationTrackEditBool, AnimationTrackEdit);
|
2019-06-11 18:43:37 +00:00
|
|
|
Ref<Texture2D> icon_checked;
|
|
|
|
Ref<Texture2D> icon_unchecked;
|
2018-06-07 15:46:14 +00:00
|
|
|
|
|
|
|
public:
|
2020-07-10 10:34:39 +00:00
|
|
|
virtual int get_key_height() const override;
|
|
|
|
virtual Rect2 get_key_rect(int p_index, float p_pixels_sec) override;
|
|
|
|
virtual bool is_key_selectable_by_distance() const override;
|
|
|
|
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;
|
2018-06-07 15:46:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class AnimationTrackEditColor : public AnimationTrackEdit {
|
2019-03-19 18:35:57 +00:00
|
|
|
GDCLASS(AnimationTrackEditColor, AnimationTrackEdit);
|
2018-06-07 15:46:14 +00:00
|
|
|
|
|
|
|
public:
|
2020-07-10 10:34:39 +00:00
|
|
|
virtual int get_key_height() const override;
|
|
|
|
virtual Rect2 get_key_rect(int p_index, float p_pixels_sec) override;
|
|
|
|
virtual bool is_key_selectable_by_distance() const override;
|
|
|
|
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;
|
|
|
|
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;
|
2018-06-07 15:46:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class AnimationTrackEditAudio : public AnimationTrackEdit {
|
2019-03-19 18:35:57 +00:00
|
|
|
GDCLASS(AnimationTrackEditAudio, AnimationTrackEdit);
|
2018-06-07 15:46:14 +00:00
|
|
|
|
|
|
|
ObjectID id;
|
|
|
|
|
|
|
|
void _preview_changed(ObjectID p_which);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
2020-07-10 10:34:39 +00:00
|
|
|
virtual int get_key_height() const override;
|
|
|
|
virtual Rect2 get_key_rect(int p_index, float p_pixels_sec) override;
|
|
|
|
virtual bool is_key_selectable_by_distance() const override;
|
|
|
|
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;
|
2018-06-07 15:46:14 +00:00
|
|
|
|
|
|
|
void set_node(Object *p_object);
|
|
|
|
|
|
|
|
AnimationTrackEditAudio();
|
|
|
|
};
|
|
|
|
|
|
|
|
class AnimationTrackEditSpriteFrame : public AnimationTrackEdit {
|
2019-03-19 18:35:57 +00:00
|
|
|
GDCLASS(AnimationTrackEditSpriteFrame, AnimationTrackEdit);
|
2018-06-07 15:46:14 +00:00
|
|
|
|
|
|
|
ObjectID id;
|
2022-02-15 14:56:58 +00:00
|
|
|
bool is_coords = false;
|
2018-06-07 15:46:14 +00:00
|
|
|
|
|
|
|
public:
|
2020-07-10 10:34:39 +00:00
|
|
|
virtual int get_key_height() const override;
|
|
|
|
virtual Rect2 get_key_rect(int p_index, float p_pixels_sec) override;
|
|
|
|
virtual bool is_key_selectable_by_distance() const override;
|
|
|
|
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;
|
2018-06-07 15:46:14 +00:00
|
|
|
|
|
|
|
void set_node(Object *p_object);
|
2019-10-22 00:46:50 +00:00
|
|
|
void set_as_coords();
|
|
|
|
|
2022-02-15 14:56:58 +00:00
|
|
|
AnimationTrackEditSpriteFrame() {}
|
2018-06-07 15:46:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class AnimationTrackEditSubAnim : public AnimationTrackEdit {
|
2019-03-19 18:35:57 +00:00
|
|
|
GDCLASS(AnimationTrackEditSubAnim, AnimationTrackEdit);
|
2018-06-07 15:46:14 +00:00
|
|
|
|
|
|
|
ObjectID id;
|
|
|
|
|
|
|
|
public:
|
2020-07-10 10:34:39 +00:00
|
|
|
virtual int get_key_height() const override;
|
|
|
|
virtual Rect2 get_key_rect(int p_index, float p_pixels_sec) override;
|
|
|
|
virtual bool is_key_selectable_by_distance() const override;
|
|
|
|
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;
|
2018-06-07 15:46:14 +00:00
|
|
|
|
|
|
|
void set_node(Object *p_object);
|
|
|
|
};
|
|
|
|
|
|
|
|
class AnimationTrackEditTypeAudio : public AnimationTrackEdit {
|
2019-03-19 18:35:57 +00:00
|
|
|
GDCLASS(AnimationTrackEditTypeAudio, AnimationTrackEdit);
|
2018-06-07 15:46:14 +00:00
|
|
|
|
|
|
|
void _preview_changed(ObjectID p_which);
|
|
|
|
|
2022-02-15 14:56:58 +00:00
|
|
|
bool len_resizing = false;
|
2022-05-02 14:28:25 +00:00
|
|
|
bool len_resizing_start = false;
|
|
|
|
int len_resizing_index = 0;
|
|
|
|
float len_resizing_from_px = 0.0f;
|
|
|
|
float len_resizing_rel = 0.0f;
|
2022-03-11 12:14:19 +00:00
|
|
|
bool over_drag_position = false;
|
2018-06-07 15:46:14 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
2021-08-22 15:37:22 +00:00
|
|
|
virtual void gui_input(const Ref<InputEvent> &p_event) override;
|
2018-06-07 15:46:14 +00:00
|
|
|
|
2020-07-10 10:34:39 +00:00
|
|
|
virtual bool can_drop_data(const Point2 &p_point, const Variant &p_data) const override;
|
|
|
|
virtual void drop_data(const Point2 &p_point, const Variant &p_data) override;
|
2018-06-07 15:46:14 +00:00
|
|
|
|
2020-07-10 10:34:39 +00:00
|
|
|
virtual int get_key_height() const override;
|
|
|
|
virtual Rect2 get_key_rect(int p_index, float p_pixels_sec) override;
|
|
|
|
virtual bool is_key_selectable_by_distance() const override;
|
|
|
|
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;
|
2018-06-07 15:46:14 +00:00
|
|
|
|
2022-03-11 12:14:19 +00:00
|
|
|
virtual CursorShape get_cursor_shape(const Point2 &p_pos) const override;
|
|
|
|
|
2018-06-07 15:46:14 +00:00
|
|
|
AnimationTrackEditTypeAudio();
|
|
|
|
};
|
|
|
|
|
|
|
|
class AnimationTrackEditTypeAnimation : public AnimationTrackEdit {
|
2019-03-19 18:35:57 +00:00
|
|
|
GDCLASS(AnimationTrackEditTypeAnimation, AnimationTrackEdit);
|
2018-06-07 15:46:14 +00:00
|
|
|
|
|
|
|
ObjectID id;
|
|
|
|
|
|
|
|
public:
|
2020-07-10 10:34:39 +00:00
|
|
|
virtual int get_key_height() const override;
|
|
|
|
virtual Rect2 get_key_rect(int p_index, float p_pixels_sec) override;
|
|
|
|
virtual bool is_key_selectable_by_distance() const override;
|
|
|
|
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;
|
2018-06-07 15:46:14 +00:00
|
|
|
|
|
|
|
void set_node(Object *p_object);
|
|
|
|
AnimationTrackEditTypeAnimation();
|
|
|
|
};
|
|
|
|
|
|
|
|
class AnimationTrackEditVolumeDB : public AnimationTrackEdit {
|
2019-03-19 18:35:57 +00:00
|
|
|
GDCLASS(AnimationTrackEditVolumeDB, AnimationTrackEdit);
|
2018-06-07 15:46:14 +00:00
|
|
|
|
|
|
|
public:
|
2020-07-10 10:34:39 +00:00
|
|
|
virtual void draw_bg(int p_clip_left, int p_clip_right) override;
|
|
|
|
virtual void draw_fg(int p_clip_left, int p_clip_right) override;
|
|
|
|
virtual int get_key_height() const override;
|
|
|
|
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;
|
2018-06-07 15:46:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class AnimationTrackEditDefaultPlugin : public AnimationTrackEditPlugin {
|
2019-03-19 18:35:57 +00:00
|
|
|
GDCLASS(AnimationTrackEditDefaultPlugin, AnimationTrackEditPlugin);
|
|
|
|
|
2018-06-07 15:46:14 +00:00
|
|
|
public:
|
2020-07-10 10:34:39 +00:00
|
|
|
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;
|
|
|
|
virtual AnimationTrackEdit *create_audio_track_edit() override;
|
|
|
|
virtual AnimationTrackEdit *create_animation_track_edit(Object *p_object) override;
|
2018-06-07 15:46:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // ANIMATION_TRACK_EDITOR_PLUGINS_H
|