[Closed] Getting Materials
Working on an exporter here. I’m writing to xml, and the way I want to format the data is for each object to have it’s material list, and for each material to contain it’s face list. The problem is that according to the documetation and every example I’ve seen you do this by getting the object’s material, then marching through the face list and matching the material ID of the face to the material ID of the mesh material. It works fine if you have a single material assigned to the mesh or a single multi material assigned. I’m running into a problem where I have multiple standard materials and multi materials assigned to a single object and it makes the material IDs useless.
Say for example I have a sphere. Half the faces use a standard material and half have a multi material. It has two material IDs, 1 and 2. Material ID 2 points to a multimaterial that has 9 sub materials, I cannot determine which of those 9 materials are assigned to a particular face.
Any help? Is there any way to find the absolute material assigned to a face regardless of how far it may be buried in a multi material tree.
Any faces assigned to a multimaterial will use the material within that multimaterial with the same ID, unless it is out of range then it will use the first material. So if you have faces with ID 3 and they are assigned a multimaterial then they will use the material within that multimaterial assigned to matID 3, unless that ID doesn’t exist, then it will default to the first material in the materialList.
Sorry, I’m having a hard time explaining it, but if you don’t understand from my post I could write a quick script shows how it works instead. Let me know.
Thanks,
Jon
I understand what you are saying. I’ve just run into an odd situation here. Thanks for the help.
OK so it seems a face as far as maxscript is concerned is a triangle… always. Whe I write out the facelist I get an index for every triangle. This is not good. I want an index for every polygon. Is there a an equivalent for mesh.numfaces that actually returns a count in polygons?
answer is to convert the object to editablePoly and use polyop.getFaceMatID.