I have an imported FBX that is a cardboard box with open and close animations.
I am using a render pick to see which of my boxes is being clicked and playing the animation to open the box if it is closed, or vice versa.
When I click the animation plays, but there is a flicker of the box from the alternate state - if it is closed, it shows it fully open for a frame before playing the animation.
Here’s my code that triggers when the render pick trigger is initiated:
def onOffToOn(channel, sampleIndex, val, prev):
clicked_box = op('eval1')[0,0]
box = op('%s' % clicked_box)
anim_open = "BOX|Open"
anim_close = "BOX|Close"
if box.par.animation == anim_close:
box.par.animation = anim_open
box.par.initialize.pulse()
box.par.start.pulse()
elif box.par.animation == anim_open:
box.par.animation = anim_close
box.par.initialize.pulse()
box.par.start.pulse()
return
and here is what it ends up looking like:
Am I not handling the animations correctly?