Sign in to follow this  
EternityZA

blender: exporting vertex material

Recommended Posts

EternityZA    1226
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 this post


Link to post
Share on other sites
EternityZA    1226
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 this post


Link to post
Share on other sites
Kwizatz    1392
Quote:
Original post by EternityZA
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.


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

Share this post


Link to post
Share on other sites
Kwizatz    1392
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this