testing weights, still strange
parent
f10f2f5814
commit
314bb451bb
|
@ -1228,6 +1228,40 @@ void ColladaExporter::WriteSceneLibrary()
|
||||||
for( size_t a = 0; a < mScene->mRootNode->mNumChildren; ++a )
|
for( size_t a = 0; a < mScene->mRootNode->mNumChildren; ++a )
|
||||||
WriteNode( mScene, mScene->mRootNode->mChildren[a]);
|
WriteNode( mScene, mScene->mRootNode->mChildren[a]);
|
||||||
|
|
||||||
|
for( size_t a = 0; a < mScene->mNumMeshes; ++a )
|
||||||
|
{
|
||||||
|
const aiMesh* mesh = mScene->mMeshes[a];
|
||||||
|
const std::string idstr = GetMeshId( a);
|
||||||
|
const std::string idstrEscaped = XMLEscape(idstr);
|
||||||
|
|
||||||
|
if ( mesh->mNumFaces == 0 || mesh->mNumVertices == 0 )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if ( mesh->mNumBones == 0 )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
const std::string mesh_name_escaped = XMLEscape(mesh->mName.C_Str());
|
||||||
|
mOutput << startstr
|
||||||
|
<< "<node id=\"" << mesh_name_escaped << "_armature"
|
||||||
|
<< "\" name=\"" << mesh_name_escaped << "_armature"
|
||||||
|
<< "\" type=\"NODE\">"
|
||||||
|
<< endstr;
|
||||||
|
PushTag();
|
||||||
|
|
||||||
|
mOutput << startstr
|
||||||
|
<< "<instance_controller url=\"#" << idstrEscaped << "-skin\">"
|
||||||
|
<< endstr;
|
||||||
|
PushTag();
|
||||||
|
|
||||||
|
mOutput << startstr << "<skeleton>#skeleton_root</skeleton>" << endstr;
|
||||||
|
|
||||||
|
PopTag();
|
||||||
|
mOutput << startstr << "</instance_controller>" << endstr;
|
||||||
|
|
||||||
|
PopTag();
|
||||||
|
mOutput << startstr << "</node>" << endstr;
|
||||||
|
}
|
||||||
|
|
||||||
PopTag();
|
PopTag();
|
||||||
mOutput << startstr << "</visual_scene>" << endstr;
|
mOutput << startstr << "</visual_scene>" << endstr;
|
||||||
PopTag();
|
PopTag();
|
||||||
|
@ -1264,15 +1298,23 @@ void ColladaExporter::WriteNode( const aiScene* pScene, aiNode* pNode)
|
||||||
// If the node is associated with a bone, it is a joint node (JOINT)
|
// If the node is associated with a bone, it is a joint node (JOINT)
|
||||||
// otherwise it is a normal node (NODE)
|
// otherwise it is a normal node (NODE)
|
||||||
const char * node_type;
|
const char * node_type;
|
||||||
|
bool is_joint, is_skeleton_root = false;
|
||||||
if (NULL == findBone(pScene, pNode->mName.C_Str())) {
|
if (NULL == findBone(pScene, pNode->mName.C_Str())) {
|
||||||
node_type = "NODE";
|
node_type = "NODE";
|
||||||
|
is_joint = false;
|
||||||
} else {
|
} else {
|
||||||
node_type = "JOINT";
|
node_type = "JOINT";
|
||||||
|
is_joint = true;
|
||||||
|
if(!pNode->mParent || NULL == findBone(pScene, pNode->mParent->mName.C_Str()))
|
||||||
|
is_skeleton_root = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string node_name_escaped = XMLEscape(pNode->mName.data);
|
const std::string node_name_escaped = XMLEscape(pNode->mName.data);
|
||||||
mOutput << startstr
|
mOutput << startstr
|
||||||
<< "<node id=\"" << node_name_escaped
|
<< "<node ";
|
||||||
|
if(is_skeleton_root)
|
||||||
|
mOutput << "id=\"" << "#skeleton_root" << "\" "; // For now, only support one skeleton in a scene.
|
||||||
|
mOutput << (is_joint ? "s" : "") << "id=\"" << node_name_escaped
|
||||||
<< "\" name=\"" << node_name_escaped
|
<< "\" name=\"" << node_name_escaped
|
||||||
<< "\" type=\"" << node_type
|
<< "\" type=\"" << node_type
|
||||||
<< "\">" << endstr;
|
<< "\">" << endstr;
|
||||||
|
|
Loading…
Reference in New Issue