diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-09-23 15:02:15 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-23 15:02:15 +0200 |
commit | 159470df08c0283a2330af94d26ccbe3d009d8fd (patch) | |
tree | cea94427a7a53188858fc9d83dca55fc0511880d /scene/resources/skin.h | |
parent | 30e16fff57cfdeb79f8e9ee6a7516e7d7cd6d376 (diff) | |
parent | 36b5795f47c9a706e1d8c12a932de1fe2bb9893f (diff) |
Merge pull request #32275 from godotengine/skin_support
Added skin support and simplified APIs to override bone position + glTF 2.0 import fixes
Diffstat (limited to 'scene/resources/skin.h')
-rw-r--r-- | scene/resources/skin.h | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/scene/resources/skin.h b/scene/resources/skin.h new file mode 100644 index 0000000000..a7e55bfa89 --- /dev/null +++ b/scene/resources/skin.h @@ -0,0 +1,54 @@ +#ifndef SKIN_H +#define SKIN_H + +#include "core/resource.h" + +class Skin : public Resource { + GDCLASS(Skin, Resource) + + struct Bind { + int bone; + Transform pose; + }; + + Vector<Bind> binds; + + Bind *binds_ptr; + int bind_count; + +protected: + bool _set(const StringName &p_name, const Variant &p_value); + bool _get(const StringName &p_name, Variant &r_ret) const; + void _get_property_list(List<PropertyInfo> *p_list) const; + + static void _bind_methods(); + +public: + void set_bind_count(int p_size); + inline int get_bind_count() const { return bind_count; } + + void add_bind(int p_bone, const Transform &p_pose); + + void set_bind_bone(int p_index, int p_bone); + void set_bind_pose(int p_index, const Transform &p_pose); + + inline int get_bind_bone(int p_index) const { +#ifdef DEBUG_ENABLED + ERR_FAIL_INDEX_V(p_index, bind_count, -1); +#endif + return binds_ptr[p_index].bone; + } + + inline Transform get_bind_pose(int p_index) const { +#ifdef DEBUG_ENABLED + ERR_FAIL_INDEX_V(p_index, bind_count, Transform()); +#endif + return binds_ptr[p_index].pose; + } + + void clear_binds(); + + Skin(); +}; + +#endif // SKIN_H |