for f = 1 to NumFaces do
(
index = getFaceMatID Mesh f
format "%\n" index to:out_file
)
I only have 1 map applied to the object but when i run the script a get all sorts of values between 1 and 6.
this is the output:
2
2
1
1
5
5
4
4
6
6
3
3
Any ideas why?
[Edited by - hahaha on August 5, 2007 6:14:33 AM]
Material ID Help
I have this code in MaxScript for reading a faces material ID:
Never done any Max Script and it's around 8 years since I last wrote a Max plugin that had to deal with materials.
That said I do have a vague recollection that you had to do something along the lines of "materialID = materialID % numberOfMaterials" if the materialID you got for the face was out of range. That worked for all sorts of fun combinations of multi-sub.
I think the samples in the SDK do that too.
If the modulo operator doesn't fix it, reposting your question on Sparks is probably a good idea.
That said I do have a vague recollection that you had to do something along the lines of "materialID = materialID % numberOfMaterials" if the materialID you got for the face was out of range. That worked for all sorts of fun combinations of multi-sub.
I think the samples in the SDK do that too.
If the modulo operator doesn't fix it, reposting your question on Sparks is probably a good idea.
Thanks i tried using the modulo operator but there is no such operator in MaxScript. I posted the same question at sparks.
Thanks for your help
Thanks for your help
Quote:Original post by hahaha
but there is no such operator in MaxScript.
Google for maxscript+modulo points me at:
http://www.scriptspot.com/bobo/mel2mxs/arithmetic.htm
Quote:In MAXScript, the modulus operation is performed using the mod function, followed by the two arguments. The result of the mod function in MXS is always a Float:
card = mod 7 3 --result is 1.0
bus = mod 0.5 3 --result is 0.5
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement