mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
Add buttons to move back and forth an animation on a frame by frame resolution
This commit is contained in:
parent
c6b9b53656
commit
bc9905db90
@ -128,10 +128,18 @@ class AnimPanel(AppShell):
|
||||
'toStart', (), None,
|
||||
Button, (controlFrame,),
|
||||
text = '<<',
|
||||
width = 8,
|
||||
width = 4,
|
||||
command = self.resetAllToZero)
|
||||
self.toStartButton.pack(side = LEFT, expand = 1, fill = X)
|
||||
|
||||
self.toPreviousFrameButton = self.createcomponent(
|
||||
'toPreviousFrame', (), None,
|
||||
Button, (controlFrame,),
|
||||
text = '<',
|
||||
width = 4,
|
||||
command = self.previousFrame)
|
||||
self.toPreviousFrameButton.pack(side = LEFT, expand = 1, fill = X)
|
||||
|
||||
self.playButton = self.createcomponent(
|
||||
'playButton', (), None,
|
||||
Button, (controlFrame,),
|
||||
@ -146,11 +154,19 @@ class AnimPanel(AppShell):
|
||||
command = self.stopActorControls)
|
||||
self.stopButton.pack(side = LEFT, expand = 1, fill = X)
|
||||
|
||||
self.toNextFrameButton = self.createcomponent(
|
||||
'toNextFrame', (), None,
|
||||
Button, (controlFrame,),
|
||||
text = '>',
|
||||
width = 4,
|
||||
command = self.nextFrame)
|
||||
self.toNextFrameButton.pack(side = LEFT, expand = 1, fill = X)
|
||||
|
||||
self.toEndButton = self.createcomponent(
|
||||
'toEnd', (), None,
|
||||
Button, (controlFrame,),
|
||||
text = '>>',
|
||||
width = 8,
|
||||
width = 4,
|
||||
command = self.resetAllToEnd)
|
||||
self.toEndButton.pack(side = LEFT, expand = 1, fill = X)
|
||||
|
||||
@ -336,6 +352,14 @@ class AnimPanel(AppShell):
|
||||
for actorControl in self.actorControlList:
|
||||
actorControl.resetToEnd()
|
||||
|
||||
def nextFrame(self):
|
||||
for actorControl in self.actorControlList:
|
||||
actorControl.nextFrame()
|
||||
|
||||
def previousFrame(self):
|
||||
for actorControl in self.actorControlList:
|
||||
actorControl.previousFrame()
|
||||
|
||||
def setDestroyCallBack(self, callBack):
|
||||
self.destroyCallBack = callBack
|
||||
|
||||
@ -413,6 +437,7 @@ class ActorControl(Pmw.MegaWidget):
|
||||
command = self.resetToZero)
|
||||
labelMenu.add_command(label = 'Jump To End Time',
|
||||
command = self.resetToEnd)
|
||||
|
||||
# Now associate menu with menubutton
|
||||
self._label['menu'] = labelMenu
|
||||
self._label.pack(side = LEFT, fill = X)
|
||||
@ -621,6 +646,21 @@ class ActorControl(Pmw.MegaWidget):
|
||||
self.fOneShot = 1
|
||||
self.goToT(self.duration)
|
||||
|
||||
def nextFrame(self):
|
||||
"""
|
||||
There needed to be a better way to select an exact frame number
|
||||
as the control slider doesn't have the desired resolution
|
||||
"""
|
||||
self.fOneShot = 1
|
||||
self.goToT((self.currT+(1/self.fps))%self.duration)
|
||||
|
||||
def previousFrame(self):
|
||||
"""
|
||||
There needed to be a better way to select an exact frame number
|
||||
as the control slider doesn't have the desired resolution
|
||||
"""
|
||||
self.fOneShot = 1
|
||||
self.goToT((self.currT-(1/self.fps))%self.duration)
|
||||
|
||||
"""
|
||||
# EXAMPLE CODE
|
||||
|
Loading…
x
Reference in New Issue
Block a user