diff --git a/code/ColladaExporter.cpp b/code/ColladaExporter.cpp
index 39c9147d4..cf9968795 100644
--- a/code/ColladaExporter.cpp
+++ b/code/ColladaExporter.cpp
@@ -1228,6 +1228,40 @@ void ColladaExporter::WriteSceneLibrary()
for( size_t a = 0; a < mScene->mRootNode->mNumChildren; ++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
+ << ""
+ << endstr;
+ PushTag();
+
+ mOutput << startstr
+ << ""
+ << endstr;
+ PushTag();
+
+ mOutput << startstr << "#skeleton_root" << endstr;
+
+ PopTag();
+ mOutput << startstr << "" << endstr;
+
+ PopTag();
+ mOutput << startstr << "" << endstr;
+ }
+
PopTag();
mOutput << startstr << "" << endstr;
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)
// otherwise it is a normal node (NODE)
const char * node_type;
+ bool is_joint, is_skeleton_root = false;
if (NULL == findBone(pScene, pNode->mName.C_Str())) {
node_type = "NODE";
+ is_joint = false;
} else {
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);
mOutput << startstr
- << "" << endstr;