steev
09-07-2008, 03:38 PM
to illustrate my issue, i've create a sample with boxes (setup script below). i have a scene with 5 boxes. via script i'll add an empty modifier and assign a CA slider named "box spin" to it (with a range of 0 360). i then wire the slider to control the z rotation of all the boxes, so when i scrub the slider they all rotate in unison. i then instance the modifier onto the other boxes, so no matter which box i have selected i can still rotate the boxes via the instanced slider. if i run the below script (excuse the ham-handedness, it's a quickie) to setup this scene, it works perfectly. if i save the max file, open a new scene & then re-open the box test max file, the instanced sliders no longer work.
is there something i'm missing?
clearListener()
--make boxes
for i in 1 to 5 do
(
randomX = random -100 100
randomY = random -100 100
thisBox = box pos:[randomX, randomY,0]
)
--make slider on $box01 mod panel
select $Box01
addModifier $Box01 (EmptyModifier ())
$Box01.modifiers[1].name = "box spin"
box_Controls_Attr = attributes box_Controls
(
parameters main rollout:box_Controls
(
boxCtrl type:#float UI:boxCtrl default:0
)
rollout box_Controls "boxSpin Controls" width:160 height:100
(
slider boxCtrl "" pos:[9,19] width:152 height:25 range:[0,360,0]
label boxCtrl_label "boxSpin" pos:[70,5] width:91 height:16
)
)
custAttributes.add $Box01.modifiers[1] box_Controls_Attr #unique
paramWire.connect $Box01.modifiers[#box_spin].box_Controls[#boxCtrl] $Box01.rotation.controller[#Z_Rotation] "degtorad boxCtrl"
paramWire.connect $Box01.modifiers[#box_spin].box_Controls[#boxCtrl] $Box02.rotation.controller[#Z_Rotation] "degtorad boxCtrl"
paramWire.connect $Box01.modifiers[#box_spin].box_Controls[#boxCtrl] $Box03.rotation.controller[#Z_Rotation] "degtorad boxCtrl"
paramWire.connect $Box01.modifiers[#box_spin].box_Controls[#boxCtrl] $Box04.rotation.controller[#Z_Rotation] "degtorad boxCtrl"
paramWire.connect $Box01.modifiers[#box_spin].box_Controls[#boxCtrl] $Box05.rotation.controller[#Z_Rotation] "degtorad boxCtrl"
mymod = $Box01.modifiers[1]
addModifier $Box02 mymod
addModifier $Box03 mymod
addModifier $Box04 mymod
addModifier $Box05 mymod
is there something i'm missing?
clearListener()
--make boxes
for i in 1 to 5 do
(
randomX = random -100 100
randomY = random -100 100
thisBox = box pos:[randomX, randomY,0]
)
--make slider on $box01 mod panel
select $Box01
addModifier $Box01 (EmptyModifier ())
$Box01.modifiers[1].name = "box spin"
box_Controls_Attr = attributes box_Controls
(
parameters main rollout:box_Controls
(
boxCtrl type:#float UI:boxCtrl default:0
)
rollout box_Controls "boxSpin Controls" width:160 height:100
(
slider boxCtrl "" pos:[9,19] width:152 height:25 range:[0,360,0]
label boxCtrl_label "boxSpin" pos:[70,5] width:91 height:16
)
)
custAttributes.add $Box01.modifiers[1] box_Controls_Attr #unique
paramWire.connect $Box01.modifiers[#box_spin].box_Controls[#boxCtrl] $Box01.rotation.controller[#Z_Rotation] "degtorad boxCtrl"
paramWire.connect $Box01.modifiers[#box_spin].box_Controls[#boxCtrl] $Box02.rotation.controller[#Z_Rotation] "degtorad boxCtrl"
paramWire.connect $Box01.modifiers[#box_spin].box_Controls[#boxCtrl] $Box03.rotation.controller[#Z_Rotation] "degtorad boxCtrl"
paramWire.connect $Box01.modifiers[#box_spin].box_Controls[#boxCtrl] $Box04.rotation.controller[#Z_Rotation] "degtorad boxCtrl"
paramWire.connect $Box01.modifiers[#box_spin].box_Controls[#boxCtrl] $Box05.rotation.controller[#Z_Rotation] "degtorad boxCtrl"
mymod = $Box01.modifiers[1]
addModifier $Box02 mymod
addModifier $Box03 mymod
addModifier $Box04 mymod
addModifier $Box05 mymod
