mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
fix getCurrentFrame(animName = blah)
This commit is contained in:
parent
fbc38a3e01
commit
9e76c93d1e
@ -869,10 +869,10 @@ class Actor(DirectObject, NodePath):
|
|||||||
|
|
||||||
def getCurrentFrame(self, animName=None, partName=None):
|
def getCurrentFrame(self, animName=None, partName=None):
|
||||||
"""
|
"""
|
||||||
Return the current frame number of the anim current playing on
|
Return the current frame number of the named anim, or if no
|
||||||
the actor. If part not specified return current anim of first
|
anim is specified, then the anim current playing on the
|
||||||
part in dictionary.
|
actor. If part not specified return current anim of first part
|
||||||
NOTE: only returns info for an arbitrary LOD
|
in dictionary. NOTE: only returns info for an arbitrary LOD
|
||||||
"""
|
"""
|
||||||
lodName, animControlDict = self.__animControlDict.items()[0]
|
lodName, animControlDict = self.__animControlDict.items()[0]
|
||||||
if partName == None:
|
if partName == None:
|
||||||
@ -884,10 +884,17 @@ class Actor(DirectObject, NodePath):
|
|||||||
Actor.notify.warning("couldn't find part: %s" % (partName))
|
Actor.notify.warning("couldn't find part: %s" % (partName))
|
||||||
return None
|
return None
|
||||||
|
|
||||||
# loop through all anims for named part and find if any are playing
|
if animName:
|
||||||
for animName, anim in animDict.items():
|
anim = animDict.get(animName)
|
||||||
if anim.animControl and anim.animControl.isPlaying():
|
if not anim:
|
||||||
|
Actor.notify.warning("couldn't find anim: %s" % (animName))
|
||||||
|
elif anim.animControl:
|
||||||
return anim.animControl.getFrame()
|
return anim.animControl.getFrame()
|
||||||
|
else:
|
||||||
|
# loop through all anims for named part and find if any are playing
|
||||||
|
for animName, anim in animDict.items():
|
||||||
|
if anim.animControl and anim.animControl.isPlaying():
|
||||||
|
return anim.animControl.getFrame()
|
||||||
|
|
||||||
# we must have found none, or gotten an error
|
# we must have found none, or gotten an error
|
||||||
return None
|
return None
|
||||||
|
Loading…
x
Reference in New Issue
Block a user