|
|
@@ -6,7 +6,7 @@ from panda3d.core import *
|
|
|
from panda3d.core import Loader as PandaLoader
|
|
|
from direct.showbase.DirectObject import DirectObject
|
|
|
from direct.directnotify import DirectNotifyGlobal
|
|
|
-import types
|
|
|
+
|
|
|
|
|
|
class Actor(DirectObject, NodePath):
|
|
|
"""
|
|
|
@@ -239,30 +239,30 @@ class Actor(DirectObject, NodePath):
|
|
|
# models{}{}, anims{}{} = multi-part actor w/ LOD
|
|
|
#
|
|
|
# make sure we have models
|
|
|
- if (models):
|
|
|
+ if models:
|
|
|
# do we have a dictionary of models?
|
|
|
- if (type(models)==type({})):
|
|
|
+ if type(models) == dict:
|
|
|
# if this is a dictionary of dictionaries
|
|
|
- if (type(models[models.keys()[0]]) == type({})):
|
|
|
+ if type(models[next(iter(models))]) == dict:
|
|
|
# then it must be a multipart actor w/LOD
|
|
|
self.setLODNode(node = lodNode)
|
|
|
# preserve numerical order for lod's
|
|
|
# this will make it easier to set ranges
|
|
|
- sortedKeys = models.keys()
|
|
|
+ sortedKeys = list(models.keys())
|
|
|
sortedKeys.sort()
|
|
|
for lodName in sortedKeys:
|
|
|
# make a node under the LOD switch
|
|
|
# for each lod (just because!)
|
|
|
self.addLOD(str(lodName))
|
|
|
# iterate over both dicts
|
|
|
- for modelName in models[lodName].keys():
|
|
|
+ for modelName in models[lodName]:
|
|
|
self.loadModel(models[lodName][modelName],
|
|
|
modelName, lodName, copy = copy,
|
|
|
okMissing = okMissing)
|
|
|
# then if there is a dictionary of dictionaries of anims
|
|
|
- elif (type(anims[anims.keys()[0]])==type({})):
|
|
|
+ elif type(anims[next(iter(anims))]) == dict:
|
|
|
# then this is a multipart actor w/o LOD
|
|
|
- for partName in models.keys():
|
|
|
+ for partName in models:
|
|
|
# pass in each part
|
|
|
self.loadModel(models[partName], partName,
|
|
|
copy = copy, okMissing = okMissing)
|
|
|
@@ -270,7 +270,7 @@ class Actor(DirectObject, NodePath):
|
|
|
# it is a single part actor w/LOD
|
|
|
self.setLODNode(node = lodNode)
|
|
|
# preserve order of LOD's
|
|
|
- sortedKeys = models.keys()
|
|
|
+ sortedKeys = list(models.keys())
|
|
|
sortedKeys.sort()
|
|
|
for lodName in sortedKeys:
|
|
|
self.addLOD(str(lodName))
|
|
|
@@ -283,28 +283,28 @@ class Actor(DirectObject, NodePath):
|
|
|
|
|
|
# load anims
|
|
|
# make sure the actor has animations
|
|
|
- if (anims):
|
|
|
- if (len(anims) >= 1):
|
|
|
+ if anims:
|
|
|
+ if len(anims) >= 1:
|
|
|
# if so, does it have a dictionary of dictionaries?
|
|
|
- if (type(anims[anims.keys()[0]])==type({})):
|
|
|
+ if type(anims[next(iter(anims))]) == dict:
|
|
|
# are the models a dict of dicts too?
|
|
|
- if (type(models)==type({})):
|
|
|
- if (type(models[models.keys()[0]]) == type({})):
|
|
|
+ if type(models) == dict:
|
|
|
+ if type(models[next(iter(models))]) == dict:
|
|
|
# then we have a multi-part w/ LOD
|
|
|
- sortedKeys = models.keys()
|
|
|
+ sortedKeys = list(models.keys())
|
|
|
sortedKeys.sort()
|
|
|
for lodName in sortedKeys:
|
|
|
# iterate over both dicts
|
|
|
- for partName in anims.keys():
|
|
|
+ for partName in anims:
|
|
|
self.loadAnims(
|
|
|
anims[partName], partName, lodName)
|
|
|
else:
|
|
|
# then it must be multi-part w/o LOD
|
|
|
- for partName in anims.keys():
|
|
|
+ for partName in anims:
|
|
|
self.loadAnims(anims[partName], partName)
|
|
|
- elif (type(models)==type({})):
|
|
|
+ elif type(models) == dict:
|
|
|
# then we have single-part w/ LOD
|
|
|
- sortedKeys = models.keys()
|
|
|
+ sortedKeys = list(models.keys())
|
|
|
sortedKeys.sort()
|
|
|
for lodName in sortedKeys:
|
|
|
self.loadAnims(anims, lodName=lodName)
|
|
|
@@ -431,11 +431,10 @@ class Actor(DirectObject, NodePath):
|
|
|
part.outputValue(lineStream)
|
|
|
value = lineStream.getLine()
|
|
|
|
|
|
- print ' ' * indentLevel, part.getName(), value
|
|
|
+ print(' '.join((' ' * indentLevel, part.getName(), value)))
|
|
|
|
|
|
- for i in range(part.getNumChildren()):
|
|
|
- self.__doListJoints(indentLevel + 2, part.getChild(i),
|
|
|
- isIncluded, subset)
|
|
|
+ for child in part.getChildren():
|
|
|
+ self.__doListJoints(indentLevel + 2, child, isIncluded, subset)
|
|
|
|
|
|
|
|
|
def getActorInfo(self):
|
|
|
@@ -449,14 +448,14 @@ class Actor(DirectObject, NodePath):
|
|
|
lodName = self.__sortedLODNames[0]
|
|
|
|
|
|
partInfo = []
|
|
|
- for partName in partDict.keys():
|
|
|
+ for partName in partDict:
|
|
|
subpartDef = self.__subpartDict.get(partName, Actor.SubpartDef(partName))
|
|
|
partBundleDict = self.__partBundleDict.get(lodName)
|
|
|
partDef = partBundleDict.get(subpartDef.truePartName)
|
|
|
partBundle = partDef.getBundle()
|
|
|
animDict = partDict[partName]
|
|
|
animInfo = []
|
|
|
- for animName in animDict.keys():
|
|
|
+ for animName in animDict:
|
|
|
file = animDict[animName].filename
|
|
|
animControl = animDict[animName].animControl
|
|
|
animInfo.append([animName, file, animControl])
|
|
|
@@ -478,17 +477,17 @@ class Actor(DirectObject, NodePath):
|
|
|
Pretty print actor's details
|
|
|
"""
|
|
|
for lodName, lodInfo in self.getActorInfo():
|
|
|
- print 'LOD:', lodName
|
|
|
+ print('LOD: %s' % lodName)
|
|
|
for partName, bundle, animInfo in lodInfo:
|
|
|
- print ' Part:', partName
|
|
|
- print ' Bundle:', repr(bundle)
|
|
|
+ print(' Part: %s' % partName)
|
|
|
+ print(' Bundle: %r' % bundle)
|
|
|
for animName, file, animControl in animInfo:
|
|
|
- print ' Anim:', animName
|
|
|
- print ' File:', file
|
|
|
+ print(' Anim: %s' % animName)
|
|
|
+ print(' File: %s' % file)
|
|
|
if animControl == None:
|
|
|
- print ' (not loaded)'
|
|
|
+ print(' (not loaded)')
|
|
|
else:
|
|
|
- print (' NumFrames: %d PlayRate: %0.2f' %
|
|
|
+ print(' NumFrames: %d PlayRate: %0.2f' %
|
|
|
(animControl.getNumFrames(),
|
|
|
animControl.getPlayRate()))
|
|
|
|
|
|
@@ -568,7 +567,7 @@ class Actor(DirectObject, NodePath):
|
|
|
def __updateSortedLODNames(self):
|
|
|
# Cache the sorted LOD names so we don't have to grab them
|
|
|
# and sort them every time somebody asks for the list
|
|
|
- self.__sortedLODNames = self.__partBundleDict.keys()
|
|
|
+ self.__sortedLODNames = list(self.__partBundleDict.keys())
|
|
|
# Reverse sort the doing a string->int
|
|
|
def sortKey(x):
|
|
|
if not str(x).isdigit():
|
|
|
@@ -604,8 +603,8 @@ class Actor(DirectObject, NodePath):
|
|
|
"""
|
|
|
partNames = []
|
|
|
if self.__partBundleDict:
|
|
|
- partNames = self.__partBundleDict.values()[0].keys()
|
|
|
- return partNames + self.__subpartDict.keys()
|
|
|
+ partNames = list(next(iter(self.__partBundleDict.values())).keys())
|
|
|
+ return partNames + list(self.__subpartDict.keys())
|
|
|
|
|
|
def getGeomNode(self):
|
|
|
"""
|
|
|
@@ -646,33 +645,33 @@ class Actor(DirectObject, NodePath):
|
|
|
"""
|
|
|
# make sure we don't call this twice in a row
|
|
|
# and pollute the the switches dictionary
|
|
|
-## sortedKeys = self.switches.keys()
|
|
|
+## sortedKeys = list(self.switches.keys())
|
|
|
## sortedKeys.sort()
|
|
|
child = self.__LODNode.find(str(lodName))
|
|
|
index = self.__LODNode.node().findChild(child.node())
|
|
|
self.__LODNode.node().forceSwitch(index)
|
|
|
|
|
|
def printLOD(self):
|
|
|
-## sortedKeys = self.switches.keys()
|
|
|
+## sortedKeys = list(self.switches.keys())
|
|
|
## sortedKeys.sort()
|
|
|
sortedKeys = self.__sortedLODNames
|
|
|
for eachLod in sortedKeys:
|
|
|
- print "python switches for %s: in: %d, out %d" % (eachLod,
|
|
|
+ print("python switches for %s: in: %d, out %d" % (eachLod,
|
|
|
self.switches[eachLod][0],
|
|
|
- self.switches[eachLod][1])
|
|
|
+ self.switches[eachLod][1]))
|
|
|
|
|
|
switchNum = self.__LODNode.node().getNumSwitches()
|
|
|
for eachSwitch in range(0, switchNum):
|
|
|
- print "c++ switches for %d: in: %d, out: %d" % (eachSwitch,
|
|
|
+ print("c++ switches for %d: in: %d, out: %d" % (eachSwitch,
|
|
|
self.__LODNode.node().getIn(eachSwitch),
|
|
|
- self.__LODNode.node().getOut(eachSwitch))
|
|
|
+ self.__LODNode.node().getOut(eachSwitch)))
|
|
|
|
|
|
|
|
|
def resetLOD(self):
|
|
|
"""
|
|
|
Restore all switch distance info (usually after a useLOD call)"""
|
|
|
self.__LODNode.node().clearForceSwitch()
|
|
|
-## sortedKeys = self.switches.keys()
|
|
|
+## sortedKeys = list(self.switches.keys())
|
|
|
## sortedKeys.sort()
|
|
|
## for eachLod in sortedKeys:
|
|
|
## index = sortedKeys.index(eachLod)
|
|
|
@@ -699,7 +698,7 @@ class Actor(DirectObject, NodePath):
|
|
|
# save the switch distance info
|
|
|
self.switches[lodName] = [inDist, outDist]
|
|
|
# add the switch distance info
|
|
|
-## sortedKeys = self.switches.keys()
|
|
|
+## sortedKeys = list(self.switches.keys())
|
|
|
## sortedKeys.sort()
|
|
|
self.__LODNode.node().setSwitch(self.getLODIndex(lodName), inDist, outDist)
|
|
|
|
|
|
@@ -798,7 +797,7 @@ class Actor(DirectObject, NodePath):
|
|
|
lodName = lodNames[lod]
|
|
|
if partName == None:
|
|
|
partBundleDict = self.__partBundleDict[lodName]
|
|
|
- partNames = partBundleDict.keys()
|
|
|
+ partNames = list(partBundleDict.keys())
|
|
|
else:
|
|
|
partNames = [partName]
|
|
|
|
|
|
@@ -822,7 +821,7 @@ class Actor(DirectObject, NodePath):
|
|
|
If no part specified, return anim durations of first part.
|
|
|
NOTE: returns info only for an arbitrary LOD
|
|
|
"""
|
|
|
- lodName = self.__animControlDict.keys()[0]
|
|
|
+ lodName = next(iter(self.__animControlDict))
|
|
|
controls = self.getAnimControls(animName, partName)
|
|
|
if len(controls) == 0:
|
|
|
return None
|
|
|
@@ -834,7 +833,7 @@ class Actor(DirectObject, NodePath):
|
|
|
Return frame rate of given anim name and given part, unmodified
|
|
|
by any play rate in effect.
|
|
|
"""
|
|
|
- lodName = self.__animControlDict.keys()[0]
|
|
|
+ lodName = next(iter(self.__animControlDict))
|
|
|
controls = self.getAnimControls(animName, partName)
|
|
|
if len(controls) == 0:
|
|
|
return None
|
|
|
@@ -850,7 +849,7 @@ class Actor(DirectObject, NodePath):
|
|
|
"""
|
|
|
if self.__animControlDict:
|
|
|
# use the first lod
|
|
|
- lodName = self.__animControlDict.keys()[0]
|
|
|
+ lodName = next(iter(self.__animControlDict))
|
|
|
controls = self.getAnimControls(animName, partName)
|
|
|
if controls:
|
|
|
return controls[0].getPlayRate()
|
|
|
@@ -877,7 +876,7 @@ class Actor(DirectObject, NodePath):
|
|
|
If no part specified, return anim duration of first part.
|
|
|
NOTE: returns info for arbitrary LOD
|
|
|
"""
|
|
|
- lodName = self.__animControlDict.keys()[0]
|
|
|
+ lodName = next(iter(self.__animControlDict))
|
|
|
controls = self.getAnimControls(animName, partName)
|
|
|
if len(controls) == 0:
|
|
|
return None
|
|
|
@@ -890,7 +889,7 @@ class Actor(DirectObject, NodePath):
|
|
|
return ((toFrame+1)-fromFrame) / animControl.getFrameRate()
|
|
|
|
|
|
def getNumFrames(self, animName=None, partName=None):
|
|
|
- lodName = self.__animControlDict.keys()[0]
|
|
|
+ lodName = next(iter(self.__animControlDict))
|
|
|
controls = self.getAnimControls(animName, partName)
|
|
|
if len(controls) == 0:
|
|
|
return None
|
|
|
@@ -908,12 +907,12 @@ class Actor(DirectObject, NodePath):
|
|
|
specified return current anim of an arbitrary part in dictionary.
|
|
|
NOTE: only returns info for an arbitrary LOD
|
|
|
"""
|
|
|
- if len(self.__animControlDict.items()) == 0:
|
|
|
+ if len(self.__animControlDict) == 0:
|
|
|
return
|
|
|
|
|
|
- lodName, animControlDict = self.__animControlDict.items()[0]
|
|
|
+ lodName, animControlDict = next(iter(self.__animControlDict.items()))
|
|
|
if partName == None:
|
|
|
- partName, animDict = animControlDict.items()[0]
|
|
|
+ partName, animDict = next(iter(animControlDict.items()))
|
|
|
else:
|
|
|
animDict = animControlDict.get(partName)
|
|
|
if animDict == None:
|
|
|
@@ -936,9 +935,9 @@ class Actor(DirectObject, NodePath):
|
|
|
actor. If part not specified return current anim of first part
|
|
|
in dictionary. NOTE: only returns info for an arbitrary LOD
|
|
|
"""
|
|
|
- lodName, animControlDict = self.__animControlDict.items()[0]
|
|
|
+ lodName, animControlDict = next(iter(self.__animControlDict.items()))
|
|
|
if partName == None:
|
|
|
- partName, animDict = animControlDict.items()[0]
|
|
|
+ partName, animDict = next(iter(animControlDict.items()))
|
|
|
else:
|
|
|
animDict = animControlDict.get(partName)
|
|
|
if animDict == None:
|
|
|
@@ -1420,17 +1419,15 @@ class Actor(DirectObject, NodePath):
|
|
|
if mode > 0:
|
|
|
# Use the 'fixed' bin instead of reordering the scene
|
|
|
# graph.
|
|
|
- numFrontParts = frontParts.getNumPaths()
|
|
|
- for partNum in range(0, numFrontParts):
|
|
|
- frontParts[partNum].setBin('fixed', mode)
|
|
|
+ for part in frontParts:
|
|
|
+ part.setBin('fixed', mode)
|
|
|
return
|
|
|
|
|
|
if mode == -2:
|
|
|
# Turn off depth test/write on the frontParts.
|
|
|
- numFrontParts = frontParts.getNumPaths()
|
|
|
- for partNum in range(0, numFrontParts):
|
|
|
- frontParts[partNum].setDepthWrite(0)
|
|
|
- frontParts[partNum].setDepthTest(0)
|
|
|
+ for part in frontParts:
|
|
|
+ part.setDepthWrite(0)
|
|
|
+ part.setDepthTest(0)
|
|
|
|
|
|
# Find the back part.
|
|
|
backPart = root.find("**/" + backPartName)
|
|
|
@@ -1457,12 +1454,8 @@ class Actor(DirectObject, NodePath):
|
|
|
char = partData.partBundleNP
|
|
|
char.node().update()
|
|
|
geomNodes = char.findAllMatches("**/+GeomNode")
|
|
|
- numGeomNodes = geomNodes.getNumPaths()
|
|
|
- for nodeNum in xrange(numGeomNodes):
|
|
|
- thisGeomNode = geomNodes.getPath(nodeNum)
|
|
|
- numGeoms = thisGeomNode.node().getNumGeoms()
|
|
|
- for geomNum in xrange(numGeoms):
|
|
|
- thisGeom = thisGeomNode.node().getGeom(geomNum)
|
|
|
+ for thisGeomNode in geomNodes:
|
|
|
+ for thisGeom in thisGeomNode.node().getGeoms():
|
|
|
thisGeom.markBoundsStale()
|
|
|
thisGeomNode.node().markInternalBoundsStale()
|
|
|
else:
|
|
|
@@ -1473,12 +1466,8 @@ class Actor(DirectObject, NodePath):
|
|
|
char = partData.partBundleNP
|
|
|
char.node().update()
|
|
|
geomNodes = char.findAllMatches("**/+GeomNode")
|
|
|
- numGeomNodes = geomNodes.getNumPaths()
|
|
|
- for nodeNum in xrange(numGeomNodes):
|
|
|
- thisGeomNode = geomNodes.getPath(nodeNum)
|
|
|
- numGeoms = thisGeomNode.node().getNumGeoms()
|
|
|
- for geomNum in xrange(numGeoms):
|
|
|
- thisGeom = thisGeomNode.node().getGeom(geomNum)
|
|
|
+ for thisGeomNode in geomNodes:
|
|
|
+ for thisGeom in thisGeomNode.node().getGeoms():
|
|
|
thisGeom.markBoundsStale()
|
|
|
thisGeomNode.node().markInternalBoundsStale()
|
|
|
|
|
|
@@ -1494,19 +1483,14 @@ class Actor(DirectObject, NodePath):
|
|
|
|
|
|
# update all characters first
|
|
|
charNodes = part.findAllMatches("**/+Character")
|
|
|
- numCharNodes = charNodes.getNumPaths()
|
|
|
- for charNum in range(0, numCharNodes):
|
|
|
- (charNodes.getPath(charNum)).node().update()
|
|
|
+ for charNode in charNodes:
|
|
|
+ charNode.node().update()
|
|
|
|
|
|
# for each geomNode, iterate through all geoms and force update
|
|
|
# of bounding spheres by marking current bounds as stale
|
|
|
geomNodes = part.findAllMatches("**/+GeomNode")
|
|
|
- numGeomNodes = geomNodes.getNumPaths()
|
|
|
- for nodeNum in range(0, numGeomNodes):
|
|
|
- thisGeomNode = geomNodes.getPath(nodeNum)
|
|
|
- numGeoms = thisGeomNode.node().getNumGeoms()
|
|
|
- for geomNum in range(0, numGeoms):
|
|
|
- thisGeom = thisGeomNode.node().getGeom(geomNum)
|
|
|
+ for nodeNum, thisGeomNode in enumerate(geomNodes):
|
|
|
+ for geomNum, thisGeom in enumerate(thisGeomNode.node().getGeoms()):
|
|
|
thisGeom.markBoundsStale()
|
|
|
assert Actor.notify.debug("fixing bounds for node %s, geom %s" % \
|
|
|
(nodeNum, geomNum))
|
|
|
@@ -1517,20 +1501,18 @@ class Actor(DirectObject, NodePath):
|
|
|
Show the bounds of all actor geoms
|
|
|
"""
|
|
|
geomNodes = self.__geomNode.findAllMatches("**/+GeomNode")
|
|
|
- numGeomNodes = geomNodes.getNumPaths()
|
|
|
|
|
|
- for nodeNum in range(0, numGeomNodes):
|
|
|
- geomNodes.getPath(nodeNum).showBounds()
|
|
|
+ for node in geomNodes:
|
|
|
+ node.showBounds()
|
|
|
|
|
|
def hideAllBounds(self):
|
|
|
"""
|
|
|
Hide the bounds of all actor geoms
|
|
|
"""
|
|
|
geomNodes = self.__geomNode.findAllMatches("**/+GeomNode")
|
|
|
- numGeomNodes = geomNodes.getNumPaths()
|
|
|
|
|
|
- for nodeNum in range(0, numGeomNodes):
|
|
|
- geomNodes.getPath(nodeNum).hideBounds()
|
|
|
+ for node in geomNodes:
|
|
|
+ node.hideBounds()
|
|
|
|
|
|
|
|
|
# actions
|
|
|
@@ -1698,7 +1680,7 @@ class Actor(DirectObject, NodePath):
|
|
|
if self.mergeLODBundles:
|
|
|
lodName = 'common'
|
|
|
elif self.switches:
|
|
|
- lodName = str(self.switches.keys()[0])
|
|
|
+ lodName = str(next(iter(self.switches)))
|
|
|
else:
|
|
|
lodName = 'lodRoot'
|
|
|
|
|
|
@@ -1723,7 +1705,7 @@ class Actor(DirectObject, NodePath):
|
|
|
lodName = 'common'
|
|
|
elif not lodName:
|
|
|
if self.switches:
|
|
|
- lodName = str(self.switches.keys()[0])
|
|
|
+ lodName = str(next(iter(self.switches)))
|
|
|
else:
|
|
|
lodName = 'lodRoot'
|
|
|
|
|
|
@@ -1777,7 +1759,7 @@ class Actor(DirectObject, NodePath):
|
|
|
# If we have the __subpartsComplete flag, and no partName
|
|
|
# is specified, it really means to play the animation on
|
|
|
# all subparts, not on the overall Actor.
|
|
|
- partName = self.__subpartDict.keys()
|
|
|
+ partName = list(self.__subpartDict.keys())
|
|
|
|
|
|
controls = []
|
|
|
# build list of lodNames and corresponding animControlDicts
|
|
|
@@ -1805,7 +1787,7 @@ class Actor(DirectObject, NodePath):
|
|
|
|
|
|
else:
|
|
|
# Get exactly the named part or parts.
|
|
|
- if isinstance(partName, types.StringTypes):
|
|
|
+ if isinstance(partName, str):
|
|
|
partNameList = [partName]
|
|
|
else:
|
|
|
partNameList = partName
|
|
|
@@ -1835,7 +1817,7 @@ class Actor(DirectObject, NodePath):
|
|
|
controls.append(anim.animControl)
|
|
|
else:
|
|
|
# get the named animation(s) only.
|
|
|
- if isinstance(animName, types.StringTypes):
|
|
|
+ if isinstance(animName, str):
|
|
|
# A single animName
|
|
|
animNameList = [animName]
|
|
|
else:
|
|
|
@@ -2107,7 +2089,7 @@ class Actor(DirectObject, NodePath):
|
|
|
if lodName:
|
|
|
partNames = self.__partBundleDict[lodName].keys()
|
|
|
else:
|
|
|
- partNames = self.__partBundleDict.values()[0].keys()
|
|
|
+ partNames = next(iter(self.__partBundleDict.values())).keys()
|
|
|
|
|
|
for partName in partNames:
|
|
|
subJoints = set()
|
|
|
@@ -2133,9 +2115,9 @@ class Actor(DirectObject, NodePath):
|
|
|
lodNames = ['common']
|
|
|
elif lodName == 'all':
|
|
|
reload = False
|
|
|
- lodNames = self.switches.keys()
|
|
|
+ lodNames = list(self.switches.keys())
|
|
|
lodNames.sort()
|
|
|
- for i in range(0,len(lodNames)):
|
|
|
+ for i in range(0, len(lodNames)):
|
|
|
lodNames[i] = str(lodNames[i])
|
|
|
else:
|
|
|
lodNames = [lodName]
|
|
|
@@ -2256,20 +2238,20 @@ class Actor(DirectObject, NodePath):
|
|
|
assert Actor.notify.debug("in unloadAnims: %s, part: %s, lod: %s" %
|
|
|
(anims, partName, lodName))
|
|
|
|
|
|
- if lodName == None or self.mergeLODBundles:
|
|
|
+ if lodName is None or self.mergeLODBundles:
|
|
|
lodNames = self.__animControlDict.keys()
|
|
|
else:
|
|
|
lodNames = [lodName]
|
|
|
|
|
|
- if (partName == None):
|
|
|
+ if partName is None:
|
|
|
if len(lodNames) > 0:
|
|
|
- partNames = self.__animControlDict[lodNames[0]].keys()
|
|
|
+ partNames = self.__animControlDict[next(iter(lodNames))].keys()
|
|
|
else:
|
|
|
partNames = []
|
|
|
else:
|
|
|
partNames = [partName]
|
|
|
|
|
|
- if (anims==None):
|
|
|
+ if anims is None:
|
|
|
for lodName in lodNames:
|
|
|
for partName in partNames:
|
|
|
for animDef in self.__animControlDict[lodName][partName].values():
|
|
|
@@ -2400,7 +2382,7 @@ class Actor(DirectObject, NodePath):
|
|
|
Copy the part bundle dictionary from another actor as this
|
|
|
instance's own. NOTE: this method does not actually copy geometry
|
|
|
"""
|
|
|
- for lodName in other.__partBundleDict.keys():
|
|
|
+ for lodName in other.__partBundleDict:
|
|
|
# find the lod Asad
|
|
|
if lodName == 'lodRoot':
|
|
|
partLod = self
|
|
|
@@ -2445,11 +2427,11 @@ class Actor(DirectObject, NodePath):
|
|
|
|
|
|
assert(other.mergeLODBundles == self.mergeLODBundles)
|
|
|
|
|
|
- for lodName in other.__animControlDict.keys():
|
|
|
+ for lodName in other.__animControlDict:
|
|
|
self.__animControlDict[lodName] = {}
|
|
|
- for partName in other.__animControlDict[lodName].keys():
|
|
|
+ for partName in other.__animControlDict[lodName]:
|
|
|
self.__animControlDict[lodName][partName] = {}
|
|
|
- for animName in other.__animControlDict[lodName][partName].keys():
|
|
|
+ for animName in other.__animControlDict[lodName][partName]:
|
|
|
anim = other.__animControlDict[lodName][partName][animName]
|
|
|
anim = anim.makeCopy()
|
|
|
self.__animControlDict[lodName][partName][animName] = anim
|
|
|
@@ -2512,13 +2494,13 @@ class Actor(DirectObject, NodePath):
|
|
|
|
|
|
def printAnimBlends(self, animName=None, partName=None, lodName=None):
|
|
|
for lodName, animList in self.getAnimBlends(animName, partName, lodName):
|
|
|
- print 'LOD %s:' % (lodName)
|
|
|
+ print('LOD %s:' % (lodName))
|
|
|
for animName, blendList in animList:
|
|
|
|
|
|
list = []
|
|
|
for partName, effect in blendList:
|
|
|
list.append('%s:%.3f' % (partName, effect))
|
|
|
- print ' %s: %s' % (animName, ', '.join(list))
|
|
|
+ print(' %s: %s' % (animName, ', '.join(list)))
|
|
|
|
|
|
def osdAnimBlends(self, animName=None, partName=None, lodName=None):
|
|
|
if not onScreenDebug.enabled:
|
|
|
@@ -2565,5 +2547,5 @@ class Actor(DirectObject, NodePath):
|
|
|
def renamePartBundles(self, partName, newBundleName):
|
|
|
subpartDef = self.__subpartDict.get(partName, Actor.SubpartDef(partName))
|
|
|
for partBundleDict in self.__partBundleDict.values():
|
|
|
- partDef=partBundleDict.get(subpartDef.truePartName)
|
|
|
+ partDef = partBundleDict.get(subpartDef.truePartName)
|
|
|
partDef.getBundle().setName(newBundleName)
|