When I run this code it creates a key at the proper frame. But when I create a second key it changes the value of the first key....?
(
fn fnAddVisKey Obj Val =
(
VisTrack = obj.visibility.controller
with animate on
(
newKey = addNewKey VisTrack currentTime #select
newKey.value = Val
)
)
rollout rlVisibilityTrack "Visibility Track"
(
button btnVisOff "On" width:70 height:30 pos:[5,5]
button btnVisOn "Off" width:70 height:30 pos:[75,5]
button btnDelVisKey "Delete Visibility Key" width:140 height:30 pos:[5,40]
on btnVisOff pressed do
(
if selection.count >= 1 then
(
undo on
(
for obj in selection do
(
if (obj.visibility != bezier_float()) then --Add Visibility Track
(
obj.visibility = bezier_float()
)
fnAddVisKey obj 0.0
)
)
print ("Keys" + " " + sliderTime as string)
)
)
)
createDialog rlVisibilityTrack 150 75
)
By
Comments (2)
Comment policy
Awe
Thanks Anubis,
I was overlooking that completely.
Thank you for the tips.
I usually try and make sure I do If/Then or If/Do statements as needed.
But thanks again.
JokerMartini
quick catch
that boolean expression is wrong:
-- it always return True and that replace the controller permanently.
Also (at least in my Max) I use If/Do (when not need Else)
'cause If/Then without Else almost never executes (here).
So, this s'd be fine:
...and just a tip: not need
for addNewKey().