redwatty
02-18-2009, 04:14 PM
Hi I have wrote a little script for my friend, he has several springs and things in his scene and wants to control their parameters all at once. I have wrote the script but it isn't changing the values, any ideas why?
--variables
cvStrengthValue = 100
cvTauValue = 100
--main function
fn changeValue =
(
if $ == undefined then (MessageBox "Please select at least one object" title:"changeValue")
else
(
for i in selection do
(
if i.modifiers.count == 0 then continue
else
(
for j = 1 to i.modifiers.count do
(
if classof i.modifiers[j] == Prismatic then
(
i.modifiers[j].strength = cvStrength
i.modifiers[j].tau = cvTau
--i.modifiers[j].something = cvSomething
--i.modifiers[j].something else = cvSomethingElse
)
)
)
)
)
)
--UI
rollout cvRollout "changeValues"
(
group "Set Values:"
(
spinner cvStrengthSpinner "Strength: " range:[0,200,cvStrengthValue] fieldWidth:50 type:#integer align:#right
spinner cvTauSpinner "Tau: " range:[0,200,cvTauValue] fieldWidth:50 type:#integer align:#right
)
on cvStrengthSpinner changed val do cvStrengthValue = val
on cvTauSpinner changed val do cvTauValue = val
)
rf = newRolloutFloater "ChangeValueMainRollout" 200 200 -- creates a new rollout floater
addRollout cvRollout rf rolledUp:true--adds viewport rollout to new rollout floater
--variables
cvStrengthValue = 100
cvTauValue = 100
--main function
fn changeValue =
(
if $ == undefined then (MessageBox "Please select at least one object" title:"changeValue")
else
(
for i in selection do
(
if i.modifiers.count == 0 then continue
else
(
for j = 1 to i.modifiers.count do
(
if classof i.modifiers[j] == Prismatic then
(
i.modifiers[j].strength = cvStrength
i.modifiers[j].tau = cvTau
--i.modifiers[j].something = cvSomething
--i.modifiers[j].something else = cvSomethingElse
)
)
)
)
)
)
--UI
rollout cvRollout "changeValues"
(
group "Set Values:"
(
spinner cvStrengthSpinner "Strength: " range:[0,200,cvStrengthValue] fieldWidth:50 type:#integer align:#right
spinner cvTauSpinner "Tau: " range:[0,200,cvTauValue] fieldWidth:50 type:#integer align:#right
)
on cvStrengthSpinner changed val do cvStrengthValue = val
on cvTauSpinner changed val do cvTauValue = val
)
rf = newRolloutFloater "ChangeValueMainRollout" 200 200 -- creates a new rollout floater
addRollout cvRollout rf rolledUp:true--adds viewport rollout to new rollout floater
