skeleton_modifier_3d.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /**************************************************************************/
  2. /* skeleton_modifier_3d.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_MODIFIER_3D_H
  31. #define SKELETON_MODIFIER_3D_H
  32. #include "scene/3d/node_3d.h"
  33. #include "scene/3d/skeleton_3d.h"
  34. #include "scene/animation/animation_mixer.h"
  35. class SkeletonModifier3D : public Node3D {
  36. GDCLASS(SkeletonModifier3D, Node3D);
  37. void rebind();
  38. protected:
  39. bool active = true;
  40. real_t influence = 1.0;
  41. // Cache them for the performance reason since finding node with NodePath is slow.
  42. ObjectID skeleton_id;
  43. void _update_skeleton();
  44. void _update_skeleton_path();
  45. void _force_update_skeleton_skin();
  46. virtual void _skeleton_changed(Skeleton3D *p_old, Skeleton3D *p_new);
  47. void _validate_property(PropertyInfo &p_property) const;
  48. void _notification(int p_what);
  49. static void _bind_methods();
  50. virtual void _set_active(bool p_active);
  51. virtual void _process_modification();
  52. GDVIRTUAL0(_process_modification);
  53. public:
  54. virtual PackedStringArray get_configuration_warnings() const override;
  55. virtual bool has_process() const { return false; } // Return true if modifier needs to modify bone pose without external animation such as physics, jiggle and etc.
  56. void set_active(bool p_active);
  57. bool is_active() const;
  58. void set_influence(real_t p_influence);
  59. real_t get_influence() const;
  60. Skeleton3D *get_skeleton() const;
  61. void process_modification();
  62. SkeletonModifier3D();
  63. };
  64. #endif // SKELETON_MODIFIER_3D_H