Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
godotengine
GitHub Repository: godotengine/godot
Path: blob/master/modules/gltf/structures/gltf_skeleton.h
10278 views
1
/**************************************************************************/
2
/* gltf_skeleton.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
31
#pragma once
32
33
#include "../gltf_defines.h"
34
35
#include "core/io/resource.h"
36
#include "scene/3d/bone_attachment_3d.h"
37
#include "scene/3d/skeleton_3d.h"
38
39
class GLTFSkeleton : public Resource {
40
GDCLASS(GLTFSkeleton, Resource);
41
friend class GLTFDocument;
42
friend class SkinTool;
43
friend class FBXDocument;
44
45
private:
46
// The *synthesized* skeletons joints
47
Vector<GLTFNodeIndex> joints;
48
49
// The roots of the skeleton. If there are multiple, each root must have the
50
// same parent (ie roots are siblings)
51
Vector<GLTFNodeIndex> roots;
52
53
// The created Skeleton3D for the scene
54
Skeleton3D *godot_skeleton = nullptr;
55
56
// Set of unique bone names for the skeleton
57
HashSet<String> unique_names;
58
59
HashMap<int32_t, GLTFNodeIndex> godot_bone_node;
60
61
Vector<BoneAttachment3D *> bone_attachments;
62
63
protected:
64
static void _bind_methods();
65
66
public:
67
Vector<GLTFNodeIndex> get_joints();
68
void set_joints(Vector<GLTFNodeIndex> p_joints);
69
70
Vector<GLTFNodeIndex> get_roots();
71
void set_roots(Vector<GLTFNodeIndex> p_roots);
72
73
Skeleton3D *get_godot_skeleton();
74
75
// Skeleton *get_godot_skeleton() {
76
// return godot_skeleton;
77
// }
78
// void set_godot_skeleton(Skeleton p_*godot_skeleton) {
79
// godot_skeleton = p_godot_skeleton;
80
// }
81
82
TypedArray<String> get_unique_names();
83
void set_unique_names(TypedArray<String> p_unique_names);
84
85
//RBMap<int32_t, GLTFNodeIndex> get_godot_bone_node() {
86
// return godot_bone_node;
87
//}
88
//void set_godot_bone_node(const RBMap<int32_t, GLTFNodeIndex> &p_godot_bone_node) {
89
// godot_bone_node = p_godot_bone_node;
90
//}
91
Dictionary get_godot_bone_node();
92
void set_godot_bone_node(Dictionary p_indict);
93
94
//Dictionary get_godot_bone_node() {
95
// return VariantConversion::to_dict(godot_bone_node);
96
//}
97
//void set_godot_bone_node(Dictionary p_indict) {
98
// VariantConversion::set_from_dict(godot_bone_node, p_indict);
99
//}
100
101
BoneAttachment3D *get_bone_attachment(int idx);
102
103
int32_t get_bone_attachment_count();
104
};
105
106