originalfake
10-25-2007, 06:30 AM
hey,
I have this script:
for obj in $ do
(
randVal = random 0 20
for i in selection do addModifier i (Materialmodifier())
obj.modifiers[#Material].materialID = randvVal
)
The problem I'm encountering is when I select multiple objects
to assign random Material ID's to them it applys more then one
modifier.
I.e. If I select three boxes and run the script it adds 3 modifiers
to each box, if I select one box, only one modifier is added.
I've come to the conclusion that I need to work out a
statement to bypass adding a new modifier if one already exists.
Any help would be greatly appreciated!
Cheers
I have this script:
for obj in $ do
(
randVal = random 0 20
for i in selection do addModifier i (Materialmodifier())
obj.modifiers[#Material].materialID = randvVal
)
The problem I'm encountering is when I select multiple objects
to assign random Material ID's to them it applys more then one
modifier.
I.e. If I select three boxes and run the script it adds 3 modifiers
to each box, if I select one box, only one modifier is added.
I've come to the conclusion that I need to work out a
statement to bypass adding a new modifier if one already exists.
Any help would be greatly appreciated!
Cheers
