Random material to random object script
Hello.
Here's the scenario. I have 30 objects and 4 materials. I want to randomly apply these four materials to my 30 objects. I want to keep my objects separate. Otherwise I know I could attached them all together and use a multi sub-mat with Material by element modifier.Would this possible with a script?
Does any body know of such a script or fancy writing one?
I'm learning the basics of MAXScript, and this is beyond my knowledge for now!
Kind regards
Andy.
Comments
Thanks.Useful Script
Thanks.Useful Script
Let's get me pro
Hmm, if you apply only
Hmm, if you apply only Material modifier then base object affected, so to add different ID's on subobject level you need at least Poly Select modifier and then (on top) Material modifier. The code works fine on my Max 2009 and am not touch Max 2010 yet so cant tell for sure if there is some difference.
my recent MAXScripts RSS (archive here)
Thanks. I searched on here
Thanks. I searched on here before i posted but couldn't find anything.
But with this script do I need to make sure that everything has an editable poly modifier? I thought edit poly/mesh might crop up somewhere as that's the only way to assign different face id for a multi subobject material.
Then I might as well use the Material by ID modifier as well.
I get the following error when I run the code above.
-- Error occurred in anonymous codeblock; filename: ; position: 325; line: 13
-- Syntax error: at ), expected
-- In line: )
All i did to test it was draw a few spheres.
I'm using Max 2010 if that makes a difference.
I appreciate your input though.
Cheers.
Script_Butler
Of course you can. Maybe
Of course you can. Maybe soon I'll post a script for this purpose. Here on Scriptspot also exist similar scripts. But if you looking for an example, there is one:
my recent MAXScripts RSS (archive here)
Thanks Anubis. Simple and
Thanks Anubis.
Simple and effective! Superb!
I didn't realise it would be so simple.
Following on from this, can I apply a different mat ID to my objects through a script? Keeping them separate of course.
Then I could apply a multi-sub object material to all of the separate objects.
Cheers.
Andy.
Cheers.
Script_Butler
If for clear to say your 4
If for clear to say your 4 materials are in the first 4 slots,
then select your objects and type in Listener this code:
for obj in selection do obj.material = meditMaterials[random 1 4]
my recent MAXScripts RSS (archive here)