Sign in to follow this  
hahaha

Material ID Help

Recommended Posts

hahaha    100
I have this code in MaxScript for reading a faces material ID:
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]

Share this post


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

Share this post


Link to post
Share on other sites
hahaha    100
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

Share this post


Link to post
Share on other sites
S1CA    1418
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


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