Changeset View
Changeset View
Standalone View
Standalone View
source/blender/collada/ArmatureImporter.cpp
| Show First 20 Lines • Show All 202 Lines • ▼ Show 20 Lines | int ArmatureImporter::create_bone(SkinInfo *skin, COLLADAFW::Node *node, EditBone *parent, int totchild, | ||||
| finished_joints.push_back(node); | finished_joints.push_back(node); | ||||
| be.set_chain_length(chain_length + 1); | be.set_chain_length(chain_length + 1); | ||||
| return chain_length + 1; | return chain_length + 1; | ||||
| } | } | ||||
| /** | /** | ||||
| * Collada only knows Joints, hence bones at the end of a bone chain | * Collada only knows Joints, hence bones at the end of a bone chain | ||||
| * don't have a defined length. This function guesses reasonable | * don't have a defined length. This function guesses reasonable | ||||
| * tail locations for the affected bones (nodes which don't have any connected child) | * tail locations for the affected bones (nodes which don't have any connected child) | ||||
| * Hint: The extended_bones set gets populated in ArmatureImporter::create_bone | * Hint: The extended_bones set gets populated in ArmatureImporter::create_bone | ||||
| **/ | */ | ||||
| void ArmatureImporter::fix_leaf_bone_hierarchy(bArmature *armature, Bone *bone, bool fix_orientation) | void ArmatureImporter::fix_leaf_bone_hierarchy(bArmature *armature, Bone *bone, bool fix_orientation) | ||||
| { | { | ||||
| if (bone == NULL) | if (bone == NULL) | ||||
| return; | return; | ||||
| if (bc_is_leaf_bone(bone)) { | if (bc_is_leaf_bone(bone)) { | ||||
| BoneExtensionMap &extended_bones = bone_extension_manager.getExtensionMap(armature); | BoneExtensionMap &extended_bones = bone_extension_manager.getExtensionMap(armature); | ||||
| BoneExtended *be = extended_bones[bone->name]; | BoneExtended *be = extended_bones[bone->name]; | ||||
| ▲ Show 20 Lines • Show All 445 Lines • ▼ Show 20 Lines | void ArmatureImporter::set_pose(Object *ob_arm, COLLADAFW::Node *root_node, const char *parentname, float parent_mat[4][4]) | ||||
| COLLADAFW::NodePointerArray& children = root_node->getChildNodes(); | COLLADAFW::NodePointerArray& children = root_node->getChildNodes(); | ||||
| for (unsigned int i = 0; i < children.getCount(); i++) { | for (unsigned int i = 0; i < children.getCount(); i++) { | ||||
| set_pose(ob_arm, children[i], bone_name, mat); | set_pose(ob_arm, children[i], bone_name, mat); | ||||
| } | } | ||||
| } | } | ||||
| /** | /** | ||||
| * root - if this joint is the top joint in hierarchy, if a joint | * root - if this joint is the top joint in hierarchy, if a joint | ||||
| * is a child of a node (not joint), root should be true since | * is a child of a node (not joint), root should be true since | ||||
| * this is where we build armature bones from | * this is where we build armature bones from | ||||
| **/ | */ | ||||
| void ArmatureImporter::add_root_joint(COLLADAFW::Node *node, Object *parent) | void ArmatureImporter::add_root_joint(COLLADAFW::Node *node, Object *parent) | ||||
| { | { | ||||
| root_joints.push_back(node); | root_joints.push_back(node); | ||||
| if (parent) { | if (parent) { | ||||
| joint_parent_map[node->getUniqueId()] = parent; | joint_parent_map[node->getUniqueId()] = parent; | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 326 Lines • Show Last 20 Lines | |||||