skeleton_modification_stack_2d.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /**************************************************************************/
  2. /* skeleton_modification_stack_2d.h */
  3. /**************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /**************************************************************************/
  8. /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
  9. /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
  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 SKELETON_MODIFICATION_STACK_2D_H
  31. #define SKELETON_MODIFICATION_STACK_2D_H
  32. #include "scene/2d/skeleton_2d.h"
  33. #include "scene/resources/2d/skeleton/skeleton_modification_2d.h"
  34. ///////////////////////////////////////
  35. // SkeletonModificationStack2D
  36. ///////////////////////////////////////
  37. class Skeleton2D;
  38. class SkeletonModification2D;
  39. class Bone2D;
  40. class SkeletonModificationStack2D : public Resource {
  41. GDCLASS(SkeletonModificationStack2D, Resource);
  42. friend class Skeleton2D;
  43. friend class SkeletonModification2D;
  44. protected:
  45. static void _bind_methods();
  46. void _get_property_list(List<PropertyInfo> *p_list) const;
  47. bool _set(const StringName &p_path, const Variant &p_value);
  48. bool _get(const StringName &p_path, Variant &r_ret) const;
  49. public:
  50. Skeleton2D *skeleton = nullptr;
  51. bool is_setup = false;
  52. bool enabled = false;
  53. float strength = 1.0;
  54. enum EXECUTION_MODE {
  55. execution_mode_process,
  56. execution_mode_physics_process
  57. };
  58. Vector<Ref<SkeletonModification2D>> modifications;
  59. void setup();
  60. void execute(float p_delta, int p_execution_mode);
  61. bool editor_gizmo_dirty = false;
  62. void draw_editor_gizmos();
  63. void set_editor_gizmos_dirty(bool p_dirty);
  64. void enable_all_modifications(bool p_enable);
  65. Ref<SkeletonModification2D> get_modification(int p_mod_idx) const;
  66. void add_modification(Ref<SkeletonModification2D> p_mod);
  67. void delete_modification(int p_mod_idx);
  68. void set_modification(int p_mod_idx, Ref<SkeletonModification2D> p_mod);
  69. void set_modification_count(int p_count);
  70. int get_modification_count() const;
  71. void set_skeleton(Skeleton2D *p_skeleton);
  72. Skeleton2D *get_skeleton() const;
  73. bool get_is_setup() const;
  74. void set_enabled(bool p_enabled);
  75. bool get_enabled() const;
  76. void set_strength(float p_strength);
  77. float get_strength() const;
  78. SkeletonModificationStack2D();
  79. };
  80. #endif // SKELETON_MODIFICATION_STACK_2D_H