diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-04-17 07:17:24 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-04-17 07:21:24 +0300 |
commit | e12c08e8d170b7ca40f204a5b0423c23a9fbc2c1 (patch) | |
tree | 8cf3453d12edb177a218ef8009357518ec6cab6a /source/blender/collada/SkinInfo.h | |
parent | b3dabc200a4b0399ec6b81f2ff2730d07b44fcaa (diff) |
ClangFormat: apply to source, most of intern
Apply clang format as proposed in T53211.
For details on usage and instructions for migrating branches
without conflicts, see:
https://wiki.blender.org/wiki/Tools/ClangFormat
Diffstat (limited to 'source/blender/collada/SkinInfo.h')
-rw-r--r-- | source/blender/collada/SkinInfo.h | 121 |
1 files changed, 61 insertions, 60 deletions
diff --git a/source/blender/collada/SkinInfo.h b/source/blender/collada/SkinInfo.h index 7695547f9b5..255d6d9b1f3 100644 --- a/source/blender/collada/SkinInfo.h +++ b/source/blender/collada/SkinInfo.h @@ -39,91 +39,92 @@ // This is used to store data passed in write_controller_data. // Arrays from COLLADAFW::SkinControllerData lose ownership, so do this class members // so that arrays don't get freed until we free them explicitly. -class SkinInfo -{ -private: - // to build armature bones from inverse bind matrices - struct JointData { - float inv_bind_mat[4][4]; // joint inverse bind matrix - COLLADAFW::UniqueId joint_uid; // joint node UID - // Object *ob_arm; // armature object - }; +class SkinInfo { + private: + // to build armature bones from inverse bind matrices + struct JointData { + float inv_bind_mat[4][4]; // joint inverse bind matrix + COLLADAFW::UniqueId joint_uid; // joint node UID + // Object *ob_arm; // armature object + }; - float bind_shape_matrix[4][4]; + float bind_shape_matrix[4][4]; - // data from COLLADAFW::SkinControllerData, each array should be freed - COLLADAFW::UIntValuesArray joints_per_vertex; - COLLADAFW::UIntValuesArray weight_indices; - COLLADAFW::IntValuesArray joint_indices; - // COLLADAFW::FloatOrDoubleArray weights; - std::vector<float> weights; + // data from COLLADAFW::SkinControllerData, each array should be freed + COLLADAFW::UIntValuesArray joints_per_vertex; + COLLADAFW::UIntValuesArray weight_indices; + COLLADAFW::IntValuesArray joint_indices; + // COLLADAFW::FloatOrDoubleArray weights; + std::vector<float> weights; - std::vector<JointData> joint_data; // index to this vector is joint index + std::vector<JointData> joint_data; // index to this vector is joint index - UnitConverter *unit_converter; + UnitConverter *unit_converter; - Object *ob_arm; - COLLADAFW::UniqueId controller_uid; - Object *parent; + Object *ob_arm; + COLLADAFW::UniqueId controller_uid; + Object *parent; -public: + public: + SkinInfo(); + SkinInfo(const SkinInfo &skin); + SkinInfo(UnitConverter *conv); - SkinInfo(); - SkinInfo(const SkinInfo& skin); - SkinInfo(UnitConverter *conv); + // nobody owns the data after this, so it should be freed manually with releaseMemory + template<typename T> void transfer_array_data(T &src, T &dest); - // nobody owns the data after this, so it should be freed manually with releaseMemory - template <typename T> - void transfer_array_data(T& src, T& dest); + // when src is const we cannot src.yieldOwnerShip, this is used by copy constructor + void transfer_int_array_data_const(const COLLADAFW::IntValuesArray &src, + COLLADAFW::IntValuesArray &dest); - // when src is const we cannot src.yieldOwnerShip, this is used by copy constructor - void transfer_int_array_data_const(const COLLADAFW::IntValuesArray& src, COLLADAFW::IntValuesArray& dest); + void transfer_uint_array_data_const(const COLLADAFW::UIntValuesArray &src, + COLLADAFW::UIntValuesArray &dest); - void transfer_uint_array_data_const(const COLLADAFW::UIntValuesArray& src, COLLADAFW::UIntValuesArray& dest); + void borrow_skin_controller_data(const COLLADAFW::SkinControllerData *skin); - void borrow_skin_controller_data(const COLLADAFW::SkinControllerData* skin); + void free(); - void free(); + // using inverse bind matrices to construct armature + // it is safe to invert them to get the original matrices + // because if they are inverse matrices, they can be inverted + void add_joint(const COLLADABU::Math::Matrix4 &matrix); - // using inverse bind matrices to construct armature - // it is safe to invert them to get the original matrices - // because if they are inverse matrices, they can be inverted - void add_joint(const COLLADABU::Math::Matrix4& matrix); + void set_controller(const COLLADAFW::SkinController *co); - void set_controller(const COLLADAFW::SkinController* co); + // called from write_controller + Object *create_armature(Main *bmain, Scene *scene, ViewLayer *view_layer); - // called from write_controller - Object *create_armature(Main *bmain, Scene *scene, ViewLayer *view_layer); + Object *set_armature(Object *ob_arm); - Object* set_armature(Object *ob_arm); + bool get_joint_inv_bind_matrix(float inv_bind_mat[4][4], COLLADAFW::Node *node); - bool get_joint_inv_bind_matrix(float inv_bind_mat[4][4], COLLADAFW::Node *node); + Object *BKE_armature_from_object(); - Object *BKE_armature_from_object(); + const COLLADAFW::UniqueId &get_controller_uid(); - const COLLADAFW::UniqueId& get_controller_uid(); + // check if this skin controller references a joint or any descendant of it + // + // some nodes may not be referenced by SkinController, + // in this case to determine if the node belongs to this armature, + // we need to search down the tree + bool uses_joint_or_descendant(COLLADAFW::Node *node); - // check if this skin controller references a joint or any descendant of it - // - // some nodes may not be referenced by SkinController, - // in this case to determine if the node belongs to this armature, - // we need to search down the tree - bool uses_joint_or_descendant(COLLADAFW::Node *node); + void link_armature(bContext *C, + Object *ob, + std::map<COLLADAFW::UniqueId, COLLADAFW::Node *> &joint_by_uid, + TransformReader *tm); - void link_armature(bContext *C, Object *ob, std::map<COLLADAFW::UniqueId, COLLADAFW::Node*>& joint_by_uid, TransformReader *tm); + bPoseChannel *get_pose_channel_from_node(COLLADAFW::Node *node); - bPoseChannel *get_pose_channel_from_node(COLLADAFW::Node *node); + void set_parent(Object *_parent); - void set_parent(Object *_parent); + Object *get_parent(); - Object* get_parent(); - - void find_root_joints(const std::vector<COLLADAFW::Node*> &root_joints, - std::map<COLLADAFW::UniqueId, COLLADAFW::Node*>& joint_by_uid, - std::vector<COLLADAFW::Node*>& result); - - bool find_node_in_tree(COLLADAFW::Node *node, COLLADAFW::Node *tree_root); + void find_root_joints(const std::vector<COLLADAFW::Node *> &root_joints, + std::map<COLLADAFW::UniqueId, COLLADAFW::Node *> &joint_by_uid, + std::vector<COLLADAFW::Node *> &result); + bool find_node_in_tree(COLLADAFW::Node *node, COLLADAFW::Node *tree_root); }; #endif |