diff options
Diffstat (limited to 'source/blender/io/collada/collada_utils.cpp')
-rw-r--r-- | source/blender/io/collada/collada_utils.cpp | 68 |
1 files changed, 4 insertions, 64 deletions
diff --git a/source/blender/io/collada/collada_utils.cpp b/source/blender/io/collada/collada_utils.cpp index c1f25ea9a26..d3655c10655 100644 --- a/source/blender/io/collada/collada_utils.cpp +++ b/source/blender/io/collada/collada_utils.cpp @@ -92,9 +92,10 @@ float bc_get_float_value(const COLLADAFW::FloatOrDoubleArray &array, unsigned in return array.getDoubleValues()->getData()[index]; } -/* copied from /editors/object/object_relations.c */ int bc_test_parent_loop(Object *par, Object *ob) { + /* Copied from /editors/object/object_relations.c */ + /* test if 'ob' is a parent somewhere in par's parents */ if (par == nullptr) { @@ -289,9 +290,10 @@ bool bc_has_object_type(LinkNode *export_set, short obtype) return false; } -/* Use bubble sort algorithm for sorting the export set */ void bc_bubble_sort_by_Object_name(LinkNode *export_set) { + /* Use bubble sort algorithm for sorting the export set. */ + bool sorted = false; LinkNode *node; for (node = export_set; node->next && !sorted; node = node->next) { @@ -312,11 +314,6 @@ void bc_bubble_sort_by_Object_name(LinkNode *export_set) } } -/* Check if a bone is the top most exportable bone in the bone hierarchy. - * When deform_bones_only == false, then only bones with NO parent - * can be root bones. Otherwise the top most deform bones in the hierarchy - * are root bones. - */ bool bc_is_root_bone(Bone *aBone, bool deform_bones_only) { if (deform_bones_only) { @@ -360,12 +357,6 @@ std::string bc_replace_string(std::string data, return data; } -/** - * Calculate a rescale factor such that the imported scene's scale - * is preserved. I.e. 1 meter in the import will also be - * 1 meter in the current scene. - */ - void bc_match_scale(Object *ob, UnitConverter &bc_unit, bool scale_to_scene) { if (scale_to_scene) { @@ -386,9 +377,6 @@ void bc_match_scale(std::vector<Object *> *objects_done, } } -/* - * Convenience function to get only the needed components of a matrix - */ void bc_decompose(float mat[4][4], float *loc, float eul[3], float quat[4], float *size) { if (size) { @@ -408,17 +396,6 @@ void bc_decompose(float mat[4][4], float *loc, float eul[3], float quat[4], floa } } -/* - * Create rotation_quaternion from a delta rotation and a reference quat - * - * Input: - * mat_from: The rotation matrix before rotation - * mat_to : The rotation matrix after rotation - * qref : the quat corresponding to mat_from - * - * Output: - * rot : the calculated result (quaternion) - */ void bc_rotate_from_reference_quat(float quat_to[4], float quat_from[4], float mat_to[4][4]) { float qd[4]; @@ -457,9 +434,6 @@ void bc_triangulate_mesh(Mesh *me) BM_mesh_free(bm); } -/* - * A bone is a leaf when it has no children or all children are not connected. - */ bool bc_is_leaf_bone(Bone *bone) { for (Bone *child = (Bone *)bone->childbase.first; child; child = child->next) { @@ -501,11 +475,6 @@ int bc_set_layer(int bitfield, int layer, bool enable) return bitfield; } -/** - * This method creates a new extension map when needed. - * \note The ~BoneExtensionManager destructor takes care - * to delete the created maps when the manager is removed. - */ BoneExtensionMap &BoneExtensionManager::getExtensionMap(bArmature *armature) { std::string key = armature->id.name; @@ -535,7 +504,6 @@ BoneExtensionManager::~BoneExtensionManager() * See ArmatureImporter::fix_leaf_bones() * and ArmatureImporter::connect_bone_chains() */ - BoneExtended::BoneExtended(EditBone *aBone) { this->set_name(aBone->name); @@ -697,9 +665,6 @@ int BoneExtended::get_use_connect() return this->use_connect; } -/** - * Stores a 4*4 matrix as a custom bone property array of size 16 - */ void bc_set_IDPropertyMatrix(EditBone *ebone, const char *key, float mat[4][4]) { IDProperty *idgroup = (IDProperty *)ebone->prop; @@ -745,19 +710,11 @@ static void bc_set_IDProperty(EditBone *ebone, const char *key, float value) } #endif -/** - * Get a custom property when it exists. - * This function is also used to check if a property exists. - */ IDProperty *bc_get_IDProperty(Bone *bone, std::string key) { return (bone->prop == nullptr) ? nullptr : IDP_GetPropertyFromGroup(bone->prop, key.c_str()); } -/** - * Read a custom bone property and convert to float - * Return def if the property does not exist. - */ float bc_get_property(Bone *bone, std::string key, float def) { float result = def; @@ -780,14 +737,6 @@ float bc_get_property(Bone *bone, std::string key, float def) return result; } -/** - * Read a custom bone property and convert to matrix - * Return true if conversion was successful - * - * Return false if: - * - the property does not exist - * - is not an array of size 16 - */ bool bc_get_property_matrix(Bone *bone, std::string key, float mat[4][4]) { IDProperty *property = bc_get_IDProperty(bone, key); @@ -803,9 +752,6 @@ bool bc_get_property_matrix(Bone *bone, std::string key, float mat[4][4]) return false; } -/** - * get a vector that is stored in 3 custom properties (used in Blender <= 2.78) - */ void bc_get_property_vector(Bone *bone, std::string key, float val[3], const float def[3]) { val[0] = bc_get_property(bone, key + "_x", def[0]); @@ -1014,12 +960,6 @@ void bc_apply_global_transform(Vector &to_vec, const BCMatrix &global_transform, mul_v3_m4v3(to_vec, transform, to_vec); } -/** - * Check if custom information about bind matrix exists and modify the from_mat - * accordingly. - * - * NOTE: This is old style for Blender <= 2.78 only kept for compatibility - */ void bc_create_restpose_mat(BCExportSettings &export_settings, Bone *bone, float to_mat[4][4], |