Path: blob/master/editor/animation/animation_track_editor_plugins.h
21382 views
/**************************************************************************/1/* animation_track_editor_plugins.h */2/**************************************************************************/3/* This file is part of: */4/* GODOT ENGINE */5/* https://godotengine.org */6/**************************************************************************/7/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */8/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */9/* */10/* Permission is hereby granted, free of charge, to any person obtaining */11/* a copy of this software and associated documentation files (the */12/* "Software"), to deal in the Software without restriction, including */13/* without limitation the rights to use, copy, modify, merge, publish, */14/* distribute, sublicense, and/or sell copies of the Software, and to */15/* permit persons to whom the Software is furnished to do so, subject to */16/* the following conditions: */17/* */18/* The above copyright notice and this permission notice shall be */19/* included in all copies or substantial portions of the Software. */20/* */21/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */22/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */23/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */24/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */25/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */26/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */27/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */28/**************************************************************************/2930#pragma once3132#include "editor/animation/animation_track_editor.h"3334class AnimationTrackEditBool : public AnimationTrackEdit {35GDCLASS(AnimationTrackEditBool, AnimationTrackEdit);3637public:38virtual int get_key_height() const override;39virtual Rect2 get_key_rect(int p_index, float p_pixels_sec) override;40virtual bool is_key_selectable_by_distance() const override;41virtual 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;42};4344class AnimationTrackEditColor : public AnimationTrackEdit {45GDCLASS(AnimationTrackEditColor, AnimationTrackEdit);4647public:48virtual int get_key_height() const override;49virtual Rect2 get_key_rect(int p_index, float p_pixels_sec) override;50virtual bool is_key_selectable_by_distance() const override;51virtual 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;52virtual 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;53};5455class AnimationTrackEditAudio : public AnimationTrackEdit {56GDCLASS(AnimationTrackEditAudio, AnimationTrackEdit);5758ObjectID id;5960void _preview_changed(ObjectID p_which);6162public:63virtual int get_key_height() const override;64virtual Rect2 get_key_rect(int p_index, float p_pixels_sec) override;65virtual bool is_key_selectable_by_distance() const override;66virtual 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;6768void set_node(Object *p_object);6970AnimationTrackEditAudio();71};7273class AnimationTrackEditSpriteFrame : public AnimationTrackEdit {74GDCLASS(AnimationTrackEditSpriteFrame, AnimationTrackEdit);7576ObjectID id;77bool is_coords = false;7879public:80virtual int get_key_height() const override;81virtual Rect2 get_key_rect(int p_index, float p_pixels_sec) override;82virtual bool is_key_selectable_by_distance() const override;83virtual 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;8485void set_node(Object *p_object);86void set_as_coords();87};8889class AnimationTrackEditSubAnim : public AnimationTrackEdit {90GDCLASS(AnimationTrackEditSubAnim, AnimationTrackEdit);9192ObjectID id;9394public:95virtual int get_key_height() const override;96virtual Rect2 get_key_rect(int p_index, float p_pixels_sec) override;97virtual bool is_key_selectable_by_distance() const override;98virtual 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;99100void set_node(Object *p_object);101};102103class AnimationTrackEditTypeAudio : public AnimationTrackEdit {104GDCLASS(AnimationTrackEditTypeAudio, AnimationTrackEdit);105106void _preview_changed(ObjectID p_which);107108bool len_resizing = false;109bool len_resizing_start = false;110int len_resizing_index = 0;111float len_resizing_from_px = 0.0f;112float len_resizing_rel = 0.0f;113bool over_drag_position = false;114115public:116virtual void gui_input(const Ref<InputEvent> &p_event) override;117118virtual bool can_drop_data(const Point2 &p_point, const Variant &p_data) const override;119virtual void drop_data(const Point2 &p_point, const Variant &p_data) override;120121virtual int get_key_height() const override;122virtual Rect2 get_key_rect(int p_index, float p_pixels_sec) override;123virtual bool is_key_selectable_by_distance() const override;124virtual 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;125126virtual CursorShape get_cursor_shape(const Point2 &p_pos) const override;127128AnimationTrackEditTypeAudio();129};130131class AnimationTrackEditTypeAnimation : public AnimationTrackEdit {132GDCLASS(AnimationTrackEditTypeAnimation, AnimationTrackEdit);133134ObjectID id;135136public:137virtual int get_key_height() const override;138virtual Rect2 get_key_rect(int p_index, float p_pixels_sec) override;139virtual bool is_key_selectable_by_distance() const override;140virtual 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;141142void set_node(Object *p_object);143};144145class AnimationTrackEditVolumeDB : public AnimationTrackEdit {146GDCLASS(AnimationTrackEditVolumeDB, AnimationTrackEdit);147148public:149virtual void draw_bg(int p_clip_left, int p_clip_right) override;150virtual void draw_fg(int p_clip_left, int p_clip_right) override;151virtual int get_key_height() const override;152virtual 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;153};154155class AnimationTrackEditDefaultPlugin : public AnimationTrackEditPlugin {156GDCLASS(AnimationTrackEditDefaultPlugin, AnimationTrackEditPlugin);157158public:159virtual 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;160virtual AnimationTrackEdit *create_audio_track_edit() override;161virtual AnimationTrackEdit *create_animation_track_edit(Object *p_object) override;162};163164165