Пример #1
0
// parent_mat is armature-space
void ArmatureExporter::add_bone_node(Bone *bone, Object *ob_arm)
{
	std::string node_id = get_joint_id(bone, ob_arm);
	std::string node_name = std::string(bone->name);
	std::string node_sid = get_joint_sid(bone, ob_arm);

	COLLADASW::Node node(mSW);

	node.setType(COLLADASW::Node::JOINT);
	node.setNodeId(node_id);
	node.setNodeName(node_name);
	node.setNodeSid(node_sid);

	/*if ( bone->childbase.first == NULL || BLI_countlist(&(bone->childbase))>=2)
		add_blender_leaf_bone( bone, ob_arm , node );
	else{*/
	node.start();

	add_bone_transform(ob_arm, bone, node);

	for (Bone *child = (Bone*)bone->childbase.first; child; child = child->next) {
		add_bone_node(child, ob_arm);
	}
	node.end();
	//}
}
void ControllerExporter::write_bone_URLs(COLLADASW::InstanceController &ins, Object *ob_arm, Bone *bone)
{
	if (bc_is_root_bone(bone, this->export_settings->deform_bones_only))
		ins.addSkeleton(COLLADABU::URI(COLLADABU::Utils::EMPTY_STRING, get_joint_id(bone, ob_arm)));
	else {
		for (Bone *child = (Bone *)bone->childbase.first; child; child = child->next) {
			write_bone_URLs(ins, ob_arm, child);
		}
	}
}
Пример #3
0
void ArmatureExporter::add_instance_controller(Object *ob)
{
	Object *ob_arm = get_assigned_armature(ob);
	bArmature *arm = (bArmature*)ob_arm->data;

	const std::string& controller_id = get_controller_id(ob_arm, ob);

	COLLADASW::InstanceController ins(mSW);
	ins.setUrl(COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, controller_id));

	// write root bone URLs
	Bone *bone;
	for (bone = (Bone*)arm->bonebase.first; bone; bone = bone->next) {
		if (!bone->parent)
			ins.addSkeleton(COLLADABU::URI(COLLADABU::Utils::EMPTY_STRING, get_joint_id(bone, ob_arm)));
	}

	InstanceWriter::add_material_bindings(ins.getBindMaterial(), ob);
		
	ins.add();
}
Пример #4
0
std::string ArmatureExporter::get_joint_sid(Bone *bone, Object *ob_arm)
{
	return get_joint_id(bone, ob_arm);
}
std::string ControllerExporter::get_joint_sid(Bone *bone, Object *ob_arm)
{
	return get_joint_id(bone, ob_arm);
}