Path: blob/master/editor/animation/animation_track_editor_plugins.h
9903 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);36Ref<Texture2D> icon_checked;37Ref<Texture2D> icon_unchecked;3839public:40virtual int get_key_height() const override;41virtual Rect2 get_key_rect(int p_index, float p_pixels_sec) override;42virtual bool is_key_selectable_by_distance() const override;43virtual 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;44};4546class AnimationTrackEditColor : public AnimationTrackEdit {47GDCLASS(AnimationTrackEditColor, AnimationTrackEdit);4849public:50virtual int get_key_height() const override;51virtual Rect2 get_key_rect(int p_index, float p_pixels_sec) override;52virtual bool is_key_selectable_by_distance() const override;53virtual 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;54virtual 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;55};5657class AnimationTrackEditAudio : public AnimationTrackEdit {58GDCLASS(AnimationTrackEditAudio, AnimationTrackEdit);5960ObjectID id;6162void _preview_changed(ObjectID p_which);6364public:65virtual int get_key_height() const override;66virtual Rect2 get_key_rect(int p_index, float p_pixels_sec) override;67virtual bool is_key_selectable_by_distance() const override;68virtual 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;6970void set_node(Object *p_object);7172AnimationTrackEditAudio();73};7475class AnimationTrackEditSpriteFrame : public AnimationTrackEdit {76GDCLASS(AnimationTrackEditSpriteFrame, AnimationTrackEdit);7778ObjectID id;79bool is_coords = false;8081public:82virtual int get_key_height() const override;83virtual Rect2 get_key_rect(int p_index, float p_pixels_sec) override;84virtual bool is_key_selectable_by_distance() const override;85virtual 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;8687void set_node(Object *p_object);88void set_as_coords();89};9091class AnimationTrackEditSubAnim : public AnimationTrackEdit {92GDCLASS(AnimationTrackEditSubAnim, AnimationTrackEdit);9394ObjectID id;9596public:97virtual int get_key_height() const override;98virtual Rect2 get_key_rect(int p_index, float p_pixels_sec) override;99virtual bool is_key_selectable_by_distance() const override;100virtual 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;101102void set_node(Object *p_object);103};104105class AnimationTrackEditTypeAudio : public AnimationTrackEdit {106GDCLASS(AnimationTrackEditTypeAudio, AnimationTrackEdit);107108void _preview_changed(ObjectID p_which);109110bool len_resizing = false;111bool len_resizing_start = false;112int len_resizing_index = 0;113float len_resizing_from_px = 0.0f;114float len_resizing_rel = 0.0f;115bool over_drag_position = false;116117public:118virtual void gui_input(const Ref<InputEvent> &p_event) override;119120virtual bool can_drop_data(const Point2 &p_point, const Variant &p_data) const override;121virtual void drop_data(const Point2 &p_point, const Variant &p_data) override;122123virtual int get_key_height() const override;124virtual Rect2 get_key_rect(int p_index, float p_pixels_sec) override;125virtual bool is_key_selectable_by_distance() const override;126virtual 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;127128virtual CursorShape get_cursor_shape(const Point2 &p_pos) const override;129130AnimationTrackEditTypeAudio();131};132133class AnimationTrackEditTypeAnimation : public AnimationTrackEdit {134GDCLASS(AnimationTrackEditTypeAnimation, AnimationTrackEdit);135136ObjectID id;137138public:139virtual int get_key_height() const override;140virtual Rect2 get_key_rect(int p_index, float p_pixels_sec) override;141virtual bool is_key_selectable_by_distance() const override;142virtual 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;143144void set_node(Object *p_object);145};146147class AnimationTrackEditVolumeDB : public AnimationTrackEdit {148GDCLASS(AnimationTrackEditVolumeDB, AnimationTrackEdit);149150public:151virtual void draw_bg(int p_clip_left, int p_clip_right) override;152virtual void draw_fg(int p_clip_left, int p_clip_right) override;153virtual int get_key_height() const override;154virtual 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;155};156157class AnimationTrackEditDefaultPlugin : public AnimationTrackEditPlugin {158GDCLASS(AnimationTrackEditDefaultPlugin, AnimationTrackEditPlugin);159160public:161virtual 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;162virtual AnimationTrackEdit *create_audio_track_edit() override;163virtual AnimationTrackEdit *create_animation_track_edit(Object *p_object) override;164};165166167