animation_track_editor_plugins.h 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  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) 2007-2019 Juan Linietsky, Ariel Manzur. */
  9. /* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */
  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. #ifndef ANIMATION_TRACK_EDITOR_PLUGINS_H
  31. #define ANIMATION_TRACK_EDITOR_PLUGINS_H
  32. #include "editor/animation_track_editor.h"
  33. class AnimationTrackEditBool : public AnimationTrackEdit {
  34. GDCLASS(AnimationTrackEditBool, AnimationTrackEdit)
  35. Ref<Texture> icon_checked;
  36. Ref<Texture> icon_unchecked;
  37. public:
  38. virtual int get_key_height() const;
  39. virtual Rect2 get_key_rect(int p_index, float p_pixels_sec);
  40. virtual bool is_key_selectable_by_distance() const;
  41. 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);
  42. };
  43. class AnimationTrackEditColor : public AnimationTrackEdit {
  44. GDCLASS(AnimationTrackEditColor, AnimationTrackEdit)
  45. public:
  46. virtual int get_key_height() const;
  47. virtual Rect2 get_key_rect(int p_index, float p_pixels_sec);
  48. virtual bool is_key_selectable_by_distance() const;
  49. 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);
  50. 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);
  51. };
  52. class AnimationTrackEditAudio : public AnimationTrackEdit {
  53. GDCLASS(AnimationTrackEditAudio, AnimationTrackEdit)
  54. ObjectID id;
  55. void _preview_changed(ObjectID p_which);
  56. protected:
  57. static void _bind_methods();
  58. public:
  59. virtual int get_key_height() const;
  60. virtual Rect2 get_key_rect(int p_index, float p_pixels_sec);
  61. virtual bool is_key_selectable_by_distance() const;
  62. 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);
  63. void set_node(Object *p_object);
  64. AnimationTrackEditAudio();
  65. };
  66. class AnimationTrackEditSpriteFrame : public AnimationTrackEdit {
  67. GDCLASS(AnimationTrackEditSpriteFrame, AnimationTrackEdit)
  68. ObjectID id;
  69. public:
  70. virtual int get_key_height() const;
  71. virtual Rect2 get_key_rect(int p_index, float p_pixels_sec);
  72. virtual bool is_key_selectable_by_distance() const;
  73. 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);
  74. void set_node(Object *p_object);
  75. };
  76. class AnimationTrackEditSubAnim : public AnimationTrackEdit {
  77. GDCLASS(AnimationTrackEditSubAnim, AnimationTrackEdit)
  78. ObjectID id;
  79. public:
  80. virtual int get_key_height() const;
  81. virtual Rect2 get_key_rect(int p_index, float p_pixels_sec);
  82. virtual bool is_key_selectable_by_distance() const;
  83. 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);
  84. void set_node(Object *p_object);
  85. };
  86. class AnimationTrackEditTypeAudio : public AnimationTrackEdit {
  87. GDCLASS(AnimationTrackEditTypeAudio, AnimationTrackEdit)
  88. void _preview_changed(ObjectID p_which);
  89. bool len_resizing;
  90. bool len_resizing_start;
  91. int len_resizing_index;
  92. float len_resizing_from_px;
  93. float len_resizing_rel;
  94. protected:
  95. static void _bind_methods();
  96. public:
  97. virtual void _gui_input(const Ref<InputEvent> &p_event);
  98. virtual bool can_drop_data(const Point2 &p_point, const Variant &p_data) const;
  99. virtual void drop_data(const Point2 &p_point, const Variant &p_data);
  100. virtual int get_key_height() const;
  101. virtual Rect2 get_key_rect(int p_index, float p_pixels_sec);
  102. virtual bool is_key_selectable_by_distance() const;
  103. 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);
  104. AnimationTrackEditTypeAudio();
  105. };
  106. class AnimationTrackEditTypeAnimation : public AnimationTrackEdit {
  107. GDCLASS(AnimationTrackEditTypeAnimation, AnimationTrackEdit)
  108. ObjectID id;
  109. public:
  110. virtual int get_key_height() const;
  111. virtual Rect2 get_key_rect(int p_index, float p_pixels_sec);
  112. virtual bool is_key_selectable_by_distance() const;
  113. 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);
  114. void set_node(Object *p_object);
  115. AnimationTrackEditTypeAnimation();
  116. };
  117. class AnimationTrackEditVolumeDB : public AnimationTrackEdit {
  118. GDCLASS(AnimationTrackEditVolumeDB, AnimationTrackEdit)
  119. public:
  120. virtual void draw_bg(int p_clip_left, int p_clip_right);
  121. virtual void draw_fg(int p_clip_left, int p_clip_right);
  122. virtual int get_key_height() const;
  123. 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);
  124. };
  125. class AnimationTrackEditDefaultPlugin : public AnimationTrackEditPlugin {
  126. GDCLASS(AnimationTrackEditDefaultPlugin, AnimationTrackEditPlugin)
  127. public:
  128. 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);
  129. virtual AnimationTrackEdit *create_audio_track_edit();
  130. virtual AnimationTrackEdit *create_animation_track_edit(Object *p_object);
  131. };
  132. #endif // ANIMATION_TRACK_EDITOR_PLUGINS_H