From 053d606a21ec80941ccd5411a8c4c3631cd2050c Mon Sep 17 00:00:00 2001 From: aramis_acg Date: Wed, 26 May 2010 00:39:04 +0000 Subject: [PATCH] blenderloader now skips over common name prefix, such as OB for objects, MA for materials, ME for meshes, ... git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@739 67173fc5-114c-0410-ac8e-9d2fd5bffc1f --- code/BlenderLoader.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/code/BlenderLoader.cpp b/code/BlenderLoader.cpp index af7e21028..0f0ac390a 100644 --- a/code/BlenderLoader.cpp +++ b/code/BlenderLoader.cpp @@ -637,7 +637,7 @@ void BlenderImporter::BuildMaterials(ConversionData& conv_data) // ok, we need to add a dedicated default material for some poor material-less meshes boost::shared_ptr p(new Material()); - strcpy( p->id.name, "$AssimpDefault" ); + strcpy( p->id.name+2, AI_DEFAULT_MATERIAL_NAME ); p->r = p->g = p->b = 0.6f; p->specr = p->specg = p->specb = 0.6f; @@ -668,7 +668,7 @@ void BlenderImporter::BuildMaterials(ConversionData& conv_data) conv_data.materials->push_back(mout); // set material name - aiString name = aiString(mat->id.name); + aiString name = aiString(mat->id.name+2); // skip over the name prefix 'MA' mout->AddProperty(&name,AI_MATKEY_NAME); @@ -760,7 +760,8 @@ void BlenderImporter::ConvertMesh(const Scene& in, const Object* obj, const Mesh // all submeshes created from this mesh are named equally. this allows // curious users to recover the original adjacency. - out->mName = aiString(mesh->id.name); + out->mName = aiString(mesh->id.name+2); + // skip over the name prefix 'ME' // resolve the material reference and add this material to the set of // output materials. The (temporary) material index is the index @@ -987,7 +988,7 @@ aiNode* BlenderImporter::ConvertNode(const Scene& in, const Object* obj, Convers ++it; } - ScopeGuard node(new aiNode(obj->id.name)); + ScopeGuard node(new aiNode(obj->id.name+2)); // skip over the name prefix 'OB' if (obj->data) { switch (obj->type) {