Export material names properly

This commit is contained in:
Daniel Hritzkiv
2017-09-11 11:02:13 -04:00
parent a9c4fa84b5
commit 37527849b7
2 changed files with 5 additions and 7 deletions
+5 -3
View File
@@ -125,7 +125,6 @@ bool glTF2Importer::CanRead(const std::string& pFile, IOSystem* pIOHandler, bool
}
//static void CopyValue(const glTF2::vec3& v, aiColor3D& out)
//{
// out.r = v[0]; out.g = v[1]; out.b = v[2];
@@ -228,8 +227,11 @@ void glTF2Importer::ImportMaterials(glTF2::Asset& r)
Material& mat = r.materials[i];
aiString str(mat.id);
aimat->AddProperty(&str, AI_MATKEY_NAME);
if (!mat.name.empty()) {
aiString str(mat.name);
aimat->AddProperty(&str, AI_MATKEY_NAME);
}
SetMaterialColorProperty(r, mat.pbrMetallicRoughness.baseColorFactor, aimat, AI_MATKEY_COLOR_DIFFUSE);
SetMaterialTextureProperty(embeddedTexIdxs, r, mat.pbrMetallicRoughness.baseColorTexture, aimat, aiTextureType_DIFFUSE);