acgraham
02-07-2008, 07:24 AM
wondering if anyone can spot the funny business here.
I'm trying to make a script which automaticly adds modifiers to a bunch of selected shapes.
the reason why is because i dont want them to be instanced, and i dont want the noise modifiers to be consitent across all objects.
the script will eventually create a stacked stone wall.
in my script i want to remove any other modifiers that already exist (defined by me, not just everything), which will then be added again. the script is designed to be applied
to a bunch of shapes
in my script, it runs fine the first time on a plain shape. but when you run it on a shape with all the modifiers on it, it doesn't properly remove the subdivide modifier, and therefor can't create the extrude modifier on top because you can't apply an extrude to a mesh.
for obj in selection do
(
for i = 1 to obj.modifiers.count do
(
--delete modifiers first
if (classof obj.modifiers[i] == Noisemodifier or
classof obj.modifiers[i] == Subdivide or
classof obj.modifiers[i] == Extrude)
do
(
print "del"
deleteModifier obj i
)--end if
)--end i loop
--/*
addModifier obj (extrude())
obj.modifiers[#Extrude].amount= random 25 75
addModifier obj (subdivide ())
obj.modifiers[#Subdivide].size = 15
addModifier obj (Noisemodifier()) -- not instance
obj.modifiers[#Noise].strength= [0,0,5]
obj.modifiers[#Noise].fractal = on
obj.modifiers[#Noise].scale = 50
)
thanks for any help!
I'm trying to make a script which automaticly adds modifiers to a bunch of selected shapes.
the reason why is because i dont want them to be instanced, and i dont want the noise modifiers to be consitent across all objects.
the script will eventually create a stacked stone wall.
in my script i want to remove any other modifiers that already exist (defined by me, not just everything), which will then be added again. the script is designed to be applied
to a bunch of shapes
in my script, it runs fine the first time on a plain shape. but when you run it on a shape with all the modifiers on it, it doesn't properly remove the subdivide modifier, and therefor can't create the extrude modifier on top because you can't apply an extrude to a mesh.
for obj in selection do
(
for i = 1 to obj.modifiers.count do
(
--delete modifiers first
if (classof obj.modifiers[i] == Noisemodifier or
classof obj.modifiers[i] == Subdivide or
classof obj.modifiers[i] == Extrude)
do
(
print "del"
deleteModifier obj i
)--end if
)--end i loop
--/*
addModifier obj (extrude())
obj.modifiers[#Extrude].amount= random 25 75
addModifier obj (subdivide ())
obj.modifiers[#Subdivide].size = 15
addModifier obj (Noisemodifier()) -- not instance
obj.modifiers[#Noise].strength= [0,0,5]
obj.modifiers[#Noise].fractal = on
obj.modifiers[#Noise].scale = 50
)
thanks for any help!
