I have applied diffrent materials to certain faces of my object’s mesh (by selecting some faces in edit mode and applying a new material to it).
Are there APIs that get me the vertex data (+ uv etc.) of those mesh parts and the material that is connected to each of those mesh parts? The intention is to extract those parts and export it as separate objects in a exporter script.
Now I don’t want to be too tacky here, but maybe there is a simple example around?
Thanks alot !
This question has been asked at least once before, your best off dealing with the separation on export.
Don’t create new separation blender meshes (unless you just want to test quickly). Just loop over the data and write the data thats relevant for each material.
Can you give me a hint to the APIs I need to find out what material is applied to which vertices ?
Material indexes are stored with face data, so face.mat. You can get vertices from faces as well.
Look in the Mesh module for this type of stuff, look in the Material module once your ready to start getting materials from material indexes.
So my only option is to loop through each and every face of my meshes? That will be awfully slow, I guess.
You were going to have to do that anyways, to write the exporter, so just do it all during that loop. Then you only have to loop through the mesh once.