skeleton_modification_stack_3d.h 3.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /*************************************************************************/
  2. /* skeleton_modification_stack_3d.h */
  3. /*************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /*************************************************************************/
  8. /* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
  9. /* Copyright (c) 2014-2022 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 SKELETON_MODIFICATION_STACK_3D_H
  31. #define SKELETON_MODIFICATION_STACK_3D_H
  32. #include "core/templates/local_vector.h"
  33. #include "scene/3d/skeleton_3d.h"
  34. class Skeleton3D;
  35. class SkeletonModification3D;
  36. class SkeletonModificationStack3D : public Resource {
  37. GDCLASS(SkeletonModificationStack3D, Resource);
  38. friend class Skeleton3D;
  39. friend class SkeletonModification3D;
  40. protected:
  41. static void _bind_methods();
  42. virtual void _get_property_list(List<PropertyInfo> *p_list) const;
  43. virtual bool _set(const StringName &p_path, const Variant &p_value);
  44. virtual bool _get(const StringName &p_path, Variant &r_ret) const;
  45. public:
  46. Skeleton3D *skeleton = nullptr;
  47. bool is_setup = false;
  48. bool enabled = false;
  49. real_t strength = 1.0;
  50. enum EXECUTION_MODE {
  51. execution_mode_process,
  52. execution_mode_physics_process,
  53. };
  54. LocalVector<Ref<SkeletonModification3D>> modifications = LocalVector<Ref<SkeletonModification3D>>();
  55. int modifications_count = 0;
  56. virtual void setup();
  57. virtual void execute(real_t p_delta, int p_execution_mode);
  58. void enable_all_modifications(bool p_enable);
  59. Ref<SkeletonModification3D> get_modification(int p_mod_idx) const;
  60. void add_modification(Ref<SkeletonModification3D> p_mod);
  61. void delete_modification(int p_mod_idx);
  62. void set_modification(int p_mod_idx, Ref<SkeletonModification3D> p_mod);
  63. void set_modification_count(int p_count);
  64. int get_modification_count() const;
  65. void set_skeleton(Skeleton3D *p_skeleton);
  66. Skeleton3D *get_skeleton() const;
  67. bool get_is_setup() const;
  68. void set_enabled(bool p_enabled);
  69. bool get_enabled() const;
  70. void set_strength(real_t p_strength);
  71. real_t get_strength() const;
  72. SkeletonModificationStack3D();
  73. };
  74. #endif // SKELETON_MODIFICATION_STACK_3D_H