gltf_skeleton.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /*************************************************************************/
  2. /* gltf_skeleton.h */
  3. /*************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /*************************************************************************/
  8. /* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
  9. /* Copyright (c) 2014-2021 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 GLTF_SKELETON_H
  31. #define GLTF_SKELETON_H
  32. #include "core/io/resource.h"
  33. #include "gltf_document.h"
  34. class GLTFSkeleton : public Resource {
  35. GDCLASS(GLTFSkeleton, Resource);
  36. friend class GLTFDocument;
  37. private:
  38. // The *synthesized* skeletons joints
  39. Vector<GLTFNodeIndex> joints;
  40. // The roots of the skeleton. If there are multiple, each root must have the
  41. // same parent (ie roots are siblings)
  42. Vector<GLTFNodeIndex> roots;
  43. // The created Skeleton3D for the scene
  44. Skeleton3D *godot_skeleton = nullptr;
  45. // Set of unique bone names for the skeleton
  46. Set<String> unique_names;
  47. Map<int32_t, GLTFNodeIndex> godot_bone_node;
  48. Vector<BoneAttachment3D *> bone_attachments;
  49. protected:
  50. static void _bind_methods();
  51. public:
  52. Vector<GLTFNodeIndex> get_joints();
  53. void set_joints(Vector<GLTFNodeIndex> p_joints);
  54. Vector<GLTFNodeIndex> get_roots();
  55. void set_roots(Vector<GLTFNodeIndex> p_roots);
  56. Skeleton3D *get_godot_skeleton();
  57. // Skeleton *get_godot_skeleton() {
  58. // return this->godot_skeleton;
  59. // }
  60. // void set_godot_skeleton(Skeleton p_*godot_skeleton) {
  61. // this->godot_skeleton = p_godot_skeleton;
  62. // }
  63. Array get_unique_names();
  64. void set_unique_names(Array p_unique_names);
  65. //Map<int32_t, GLTFNodeIndex> get_godot_bone_node() {
  66. // return this->godot_bone_node;
  67. //}
  68. //void set_godot_bone_node(Map<int32_t, GLTFNodeIndex> p_godot_bone_node) {
  69. // this->godot_bone_node = p_godot_bone_node;
  70. //}
  71. Dictionary get_godot_bone_node();
  72. void set_godot_bone_node(Dictionary p_indict);
  73. //Dictionary get_godot_bone_node() {
  74. // return VariantConversion::to_dict(this->godot_bone_node);
  75. //}
  76. //void set_godot_bone_node(Dictionary p_indict) {
  77. // VariantConversion::set_from_dict(this->godot_bone_node, p_indict);
  78. //}
  79. BoneAttachment3D *get_bone_attachment(int idx);
  80. int32_t get_bone_attachment_count();
  81. };
  82. #endif // GLTF_SKELETON_H