[Closed] Snapshot Materials?
Hi all,
I’m just making a simple script that takes a snapshot of a mesh and copies it along at each frame and add a turbosmooth modifier. What I’m trying to do is have a unique material for each one based on the first objects material. Is there a way to ‘snapshot’ the material to keep it unique? Any ideas on how this could be tackled?
Thanks
Like below
for o = 1 to 5 do
(
slidertime = o
newobj = snapshot $Box
move newobj[o*50,0,0]
myt = turbosmooth()
addmodifier newobj myt
newobj.modifiers[#TurboSmooth].iterations = 0
newobj.modifiers[#TurboSmooth].useRenderIterations = on
newobj.modifiers[#TurboSmooth].renderIterations = 1
for o = 1 to 5 do
(
slidertime = o
newobj = snapshot $Box
newobj.material = copy newobj.material
newobj.pos.x += (o*50)
myt = turbosmooth iterations:0 useRenderIterations:on renderIterations:1
addmodifier newobj myt
)
Wow man, thanks!
and thanks for showing me how to shorten the code too,
one question with the line
newobj.pos.x += (o*50)What is that actually doing? I don’t understand the +=
Thanks again!
it calls ‘addition assignment’ operator. and used in most popular programming languages and scripts.
x += y
is the same as
x = x + y
the same scenario works for:
x -= y
x *= y
x /= y
...
i’m puzzled… why was ‘o’ used here? object? order? …
(the using ‘o’ as a variable name gives your completely as a newbie in coding :))
do you think and believe that:
move obj [10,0,0]
is the same as:
obj.pos.x += 10
?
Thanks, unfortunately, yes I am still very new to maxscript. Hacking and slashing as I go!
Theres a difference?