bone_attachment_3d.h 3.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /**************************************************************************/
  2. /* bone_attachment_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. #pragma once
  31. #include "scene/3d/skeleton_3d.h"
  32. class BoneAttachment3D : public Node3D {
  33. GDCLASS(BoneAttachment3D, Node3D);
  34. bool bound = false;
  35. String bone_name;
  36. int bone_idx = -1;
  37. bool override_pose = false;
  38. bool _override_dirty = false;
  39. bool overriding = false;
  40. bool use_external_skeleton = false;
  41. NodePath external_skeleton_node;
  42. ObjectID external_skeleton_node_cache;
  43. void _check_bind();
  44. void _check_unbind();
  45. bool updating = false;
  46. void _transform_changed();
  47. void _update_external_skeleton_cache();
  48. protected:
  49. void _validate_property(PropertyInfo &p_property) const;
  50. void _notification(int p_what);
  51. static void _bind_methods();
  52. #ifndef DISABLE_DEPRECATED
  53. virtual void _on_bone_pose_update_bind_compat_90575(int p_bone_index);
  54. static void _bind_compatibility_methods();
  55. #endif
  56. public:
  57. #ifdef TOOLS_ENABLED
  58. virtual void notify_skeleton_bones_renamed(Node *p_base_scene, Skeleton3D *p_skeleton, Dictionary p_rename_map);
  59. #endif // TOOLS_ENABLED
  60. virtual PackedStringArray get_configuration_warnings() const override;
  61. Skeleton3D *get_skeleton();
  62. void set_bone_name(const String &p_name);
  63. String get_bone_name() const;
  64. void set_bone_idx(const int &p_idx);
  65. int get_bone_idx() const;
  66. void set_override_pose(bool p_override_pose);
  67. bool get_override_pose() const;
  68. void set_use_external_skeleton(bool p_use_external_skeleton);
  69. bool get_use_external_skeleton() const;
  70. void set_external_skeleton(NodePath p_external_skeleton);
  71. NodePath get_external_skeleton() const;
  72. virtual void on_skeleton_update();
  73. #ifdef TOOLS_ENABLED
  74. virtual void notify_rebind_required();
  75. #endif
  76. BoneAttachment3D();
  77. };