OGRECave / maya-exporter

Updated Maya-to-Ogre3d exporter (compatible with Maya 2018)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fix found: Materials are not set to submeshes correctly

rpgplayerrobin opened this issue · comments

Materials are not set to the submeshes correctly when exporting them to Ogre.
This is because in newer versions of Ogre you cannot set a material to a submesh if the material does not exist.
Therefore you must make sure the material exists, which I have a working solution for here:

Go into Submesh::createOgreSubmesh.
Right before "pSubmesh->setMaterialName", add this:

std::string tmpMaterialName = m_pMaterial->name().asChar();
if (!Ogre::MaterialManager::getSingleton().getByName(tmpMaterialName))
Ogre::MaterialManager::getSingleton().create(tmpMaterialName, "General");

can you create a pull-request for this? You should be able to do the changes via the web UI with:
https://github.com/OGRECave/maya-exporter/edit/master/src/submesh.cpp

Did I do it correctly? :D I am a complete newbie on github.

jup. fixed by #3