Message 1 of 2
paramwire float_script snafu in animating
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello, all. I could sure use a little guidance on the following (here's a .swf synopsis - Float_script connections).
Here's a simple rollout that makes two boxes and point. The boxes each have a boolean custom attribute ("engage"), and a float_script is attached to the point.
The color of the first box is dictated by the "engage" state of the second box. It works just fine, and works when animated, as well.
OK, here's a second rollout that's identical to the first one, except that the color switch has been replaced by a paramWire tying the z_rotations of the two boxes together...
Now, the on/off feature for the paramWire works fine if you're not animating, but in animation mode it doesn't work. It malfunctions in both Max8 and Max9, so I'm assuming that the float_script is missing something. Any thoughts, please? Many thanks!
Here's a simple rollout that makes two boxes and point. The boxes each have a boolean custom attribute ("engage"), and a float_script is attached to the point.
(
ca = attributes predecessor
(
parameters main rollout:params
(
pred type:#Node
engage type:#boolean ui:btn_engage default:true
)
rollout params "Predecessor Test"
(
button btn_engage "Engage Button"
on btn_engage pressed do
(
engage = not engage
print engage
)
)
)
rollout predtest "FloatScript-ColorSwitch"
(
button btn_init "First Box"
button btn_next "Next Box"
local p, i=50, holder, fs
on btn_init pressed do
(
b = box()
custAttributes.add b ca
p = b
)
on btn_next pressed do
(
b = box pos:
custAttributes.add b ca
b.pred = p
holder = point()
holder.parent = b
fs = float_script()
holder.position.x_position.controller = fs
fs.addNode "cube" b
fs.script = "try (with animate off (if cube.engage
then cube.pred.wirecolor = blue else cube.pred.wirecolor = red \n 0))catch(0) "
i += 50
p = b
)
)
createDialog predtest 200 60
)
The color of the first box is dictated by the "engage" state of the second box. It works just fine, and works when animated, as well.
OK, here's a second rollout that's identical to the first one, except that the color switch has been replaced by a paramWire tying the z_rotations of the two boxes together...
(
ca = attributes predecessor
(
parameters main rollout:params
(
pred type:#Node
engage type:#boolean ui:btn_engage default:false
)
rollout params "Predecessor Test"
(
button btn_engage "Engage Button"
on btn_engage pressed do
(
this.engage = not this.engage
print engage
)
)
)
rollout predtest "FloatScript-ParamWire"
(
button btn_init "First Box"
button btn_next "Next Box"
local p, i=50, holder, fs
on btn_init pressed do
(
b = box()
custAttributes.add b ca
print b.engage
p = b
)
on btn_next pressed do
(
b = box pos:
custAttributes.add b ca
b.pred = p
b.engage = false
-- the next few lines are needed to make the wire animatable in Max9 and higher
paramWire.disconnect2way b.pred.rotation.controller.z_rotation.controller \
b.rotation.controller.z_rotation.controller
b.engage = true
paramWire.connect2way b.rotation.controller \
b.pred.rotation.controller ("Z_rotation") ("Z_rotation")
holder = point()
holder.parent = b
fs = float_script()
holder.position.x_position.controller = fs
fs.addNode "cube" b
fs.script = "try (with animate off (if cube.engage
then
(paramWire.connect2way cube.rotation.controller \
cube.pred.rotation.controller (\"Z_rotation\") (\"Z_rotation\")) else
paramWire.disconnect2way cube.pred.rotation.controller.z_rotation.controller \
cube.rotation.controller.z_rotation.controller\n 0))catch(0)"
i += 50
p = b
)
)
createDialog predtest 200 60
)
Now, the on/off feature for the paramWire works fine if you're not animating, but in animation mode it doesn't work. It malfunctions in both Max8 and Max9, so I'm assuming that the float_script is missing something. Any thoughts, please? Many thanks!