blender: exporting vertex material

Recommended Posts

Hey. My python blender export script can export the materialIndex(colour) of a face just fine but i would like to get the materialIndex of the vertices instead. Is this possible? Thnx in Advance

Share on other sites
I'm pretty sure that the material index is stored in the face data structure, so you need to look up the face you care about and use that. Keep in mind that vertices can be shared between faces.

Cheers,

Bob

Share on other sites
Thnx. Ok so the vertex itself cannot have a colour? i mean what if i wanted to create a face that blends between two colours. wouldnt i somehow have to asighn those different colours to the vertices of the face. Or am i just confused.

Share on other sites
Quote:
 Original post by EternityZAThnx. Ok so the vertex itself cannot have a colour? i mean what if i wanted to create a face that blends between two colours. wouldnt i somehow have to asighn those different colours to the vertices of the face. Or am i just confused.

Exactly, you do it to the face vertices, or in other words, the indices contained in the face data structure.

Share on other sites
Sorry im stil a bit lost. How would i do that? the vertices in the face data structure does not seem to contain any material information. unless im missing it.

Share on other sites
Look Here, mat gives you the face material index, so you get the material as follows:

material = mesh.materials[face.mat]

face.verts gives you references to the vertices and uv texturing coordinates for each vertex.

Note that verts are of type MVert a wrapper or reference object around the actual vertex coordinates.

Here is a link to the whole API documentation.

thnx

Create an account

Register a new account

• Forum Statistics

• Total Topics
627744
• Total Posts
2978895

• 10
• 10
• 21
• 14
• 14