[Closed] wired param not animating
The following creates two boxes and links their rotation:
rollout ewire "Engage/Disengage"
(
button btn_boxes "Make Boxes"
spinner spn_amt "Rotation Ratio: " range:[0,50,1]
button btn_cd "Connect/Disconnect"
local b1, b2, p=paramWire, a=1, v=2
on btn_boxes pressed do
(
b1 = box()
b2 = box pos:[50,0,0]
)
on spn_amt changed value do
(a = spn_amt.value)
on btn_cd pressed do
(
if v==1 then v=2 else v=1
if v==1 then p.connect2way b1.rotation.controller[#Z_Rotation]\
b2.rotation.controller[#Z_Rotation] ("Z_Rotation/"+a as string + "*-1") \
("Z_Rotation*"+ a as string + "*-1") \
else p.disconnect2Way b1.rotation.controller.Z_Rotation.controller \
b2.rotation.controller.Z_Rotation.controller
)
)
createDialog ewire 200 85
Works fine… until I try to animate it. Any animation along the wired properties… the z_rotations… is ignored. If I wire the two together manually rather than with MXS, the wire works as it should.
How can I get the wired params to animate? Many thanks.
OK, here’s an additional bizarre twist… I tried running the above code in Max8, then animating, and it worked just fine. When I try the exact same thing in Max9, it doesn’t work. What the hell? :shrug:
Alright, I just tried the same operation in Max 2008, with no luck. When the params are wired via the code, they are ignored when animated (“All” is checked in the filters,BTW); when wired manually, the wiring does work. Works fine in Max 8. I’m stymied; anybody got any ideas?
Well, the problem seems to be that a scripted paramWire.connect2Way simply doesn’t animate in Max9 and higher; a one-way scripted paramWire.connect animates just fine. A pain in the arse but I can work around it. May I safely assume this qualifies as a bug? :rolleyes:
A little further experimentation: I made two boxes then clacked out the bare-bones 2-way connect code in a new script and ran it, and it was animatable. When the identical code was made into a rollout, it wasn’t animatable.
Just tried every variation I could think of. Didn’t matter if the objects were created manually, in the Listener or in a rollout. Different ways of implementing the 2-way were animatable until the command was placed in a rollout. In the case of using the rollout, when one object is rotated with AutoKey on, both objects do rotate in tandem; keyframes are created; but when the ani is scrubbed or played, nothing happens. Again, this is only when the link command is in a rollout.
As I may have mentioned, the code posted at the top of this thread is animatable in Max8 but not Max9 or Max2008. On a hunch, I just made a working animation in Max8, then reopened it in Max9; the animation worked. While the file was still open in Max9, I ran the above code again and tried to animate the new boxes; that animation didn’t work.Is there something additional I have to add to make it animatable in the higher versions, or is this a bug? Any input would be immensely appreciated. Thanks.
Here’s another piece of the puzzle (see image). When wired manually, in the Listener or by direct eval of a script (or from a rollout in Max8) the float_wire for one of the two wired objects has what I assume is subcontroller(?) for animation:bezier_float. When wired from a rollout (in Max9 or Max2008). Is this something that needs to be incorporated in the rollout script?
Well, I do believe I’ve found the solution to this, though I’m frankly less than happy with it. Here’s a quick vid… solution to rollout connect2Way. Briefly the problem does trace back to what was in the previous post; no “Z_Rotation Animation:Bezier Float”. The original code for the Connect and Disconnect buttons looked like this:
on btn_wire pressed do
(
p.connect2way b1.rotation.controller[#Z_Rotation]\
b2.rotation.controller[#Z_Rotation] \
("Z_Rotation/"+amt as string + "*-1") \
("Z_Rotation*"+ amt as string + "*-1")
)
on btn_dis pressed do
(
p.disconnect2Way b1.rotation.controller.z_rotation.controller\
b2.rotation.controller.z_rotation.controller
)
I found that if the disconnect expression is copied and pasted above the connect expression, then the “Z_Rotation Animation:Bezier Float” is included in the wiring.
on btn_wire pressed do
(
p.disconnect2Way b1.rotation.controller.z_rotation.controller\
b2.rotation.controller.z_rotation.controller
p.connect2way b1.rotation.controller[#Z_Rotation]\
b2.rotation.controller[#Z_Rotation] \
("Z_Rotation/"+amt as string + "*-1") \
("Z_Rotation*"+ amt as string + "*-1")
)
on btn_dis pressed do
(
p.disconnect2Way b1.rotation.controller.z_rotation.controller\
b2.rotation.controller.z_rotation.controller
)
This works, but it sure seems like a counter-intuitive hack to me. Disconnect the wiring before connecting them? It’s like the object needs to be dope-slapped before it’ll code properly.