[2.3] Named SubMesh

What it says on the tin: a place to discuss proposed new features.
Post Reply
rrl
Halfling
Posts: 77
Joined: Sun Jun 04, 2017 12:33 am

[2.3] Named SubMesh

Post by rrl »

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 ...

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
    }
}
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()?

Post Reply