[2.3] Named SubMesh
Posted: Fri Nov 20, 2020 10:44 pm
Any chance Ogre::SubMesh can have getName(), setName()? Or some way to identify a submesh. I can't even seem to find a way to get the index of the submesh.
Then I could call something like ...
Otherwise, the only way to identify a submesh is to store it externally. I can store the submeshes externally, but it would be so much better/cleaner to use the Item(mesh)->subitem(submesh) hierarchy and not have to complicate things with external structures.
I know there's a setMaterialName() and I've made it work with that, but that also requires setting up a material script, throws a warning, and doesn't work with dynamic submesh creation.
Or maybe name isn't the correct way to do it, but someway to iterate and find a submesh. I also can iterate with getNumSubItems(), but again, it seems there is nothing to look for that I can identify each mesh with. I could wipe out dozens of lines of code with something like this.
Or maybe something like what Ogre::Mesh has with getParameters(), setParameters()?
Then I could call something like ...
Code: Select all
for (const auto& submesh : mesh.getSubMeshes()) {
if (submesh.getName().compare("string_identifier") == 0) {
// this is the one i want, do something with it
}
}
I know there's a setMaterialName() and I've made it work with that, but that also requires setting up a material script, throws a warning, and doesn't work with dynamic submesh creation.
Or maybe name isn't the correct way to do it, but someway to iterate and find a submesh. I also can iterate with getNumSubItems(), but again, it seems there is nothing to look for that I can identify each mesh with. I could wipe out dozens of lines of code with something like this.
Or maybe something like what Ogre::Mesh has with getParameters(), setParameters()?