actor: minor style fixes

This commit is contained in:
rdb 2020-01-21 15:00:13 +01:00
parent 4819e2ce3a
commit 2960b67c7a

View File

@ -212,7 +212,7 @@ class Actor(DirectObject, NodePath):
self.__LODCenter = Point3(0, 0, 0) self.__LODCenter = Point3(0, 0, 0)
self.switches = None self.switches = None
if (other == None): if other is None:
# act like a normal constructor # act like a normal constructor
# create base hierarchy # create base hierarchy
@ -352,7 +352,7 @@ class Actor(DirectObject, NodePath):
self.gotName = other.gotName self.gotName = other.gotName
# copy the scene graph elements of other # copy the scene graph elements of other
if (overwrite): if overwrite:
otherCopy = other.copyTo(NodePath()) otherCopy = other.copyTo(NodePath())
otherCopy.detachNode() otherCopy.detachNode()
# assign these elements to ourselve (overwrite) # assign these elements to ourselve (overwrite)
@ -372,7 +372,7 @@ class Actor(DirectObject, NodePath):
self.switches = other.switches self.switches = other.switches
self.__LODNode = self.find('**/+LODNode') self.__LODNode = self.find('**/+LODNode')
self.__hasLOD = 0 self.__hasLOD = 0
if (not self.__LODNode.isEmpty()): if not self.__LODNode.isEmpty():
self.__hasLOD = 1 self.__hasLOD = 1
@ -418,7 +418,7 @@ class Actor(DirectObject, NodePath):
subpartDef = self.__subpartDict.get(partName, Actor.SubpartDef(partName)) subpartDef = self.__subpartDict.get(partName, Actor.SubpartDef(partName))
partDef = partBundleDict.get(subpartDef.truePartName) partDef = partBundleDict.get(subpartDef.truePartName)
if partDef == None: if partDef is None:
Actor.notify.error("no part named: %s" % (partName)) Actor.notify.error("no part named: %s" % (partName))
self.__doListJoints(0, partDef.getBundle(), self.__doListJoints(0, partDef.getBundle(),
@ -491,7 +491,7 @@ class Actor(DirectObject, NodePath):
for animName, file, animControl in animInfo: for animName, file, animControl in animInfo:
print(' Anim: %s' % animName) print(' Anim: %s' % animName)
print(' File: %s' % file) print(' File: %s' % file)
if animControl == None: if animControl is None:
print(' (not loaded)') print(' (not loaded)')
else: else:
print(' NumFrames: %d PlayRate: %0.2f' % print(' NumFrames: %d PlayRate: %0.2f' %
@ -557,14 +557,14 @@ class Actor(DirectObject, NodePath):
bundles = [] bundles = []
for lodName, partBundleDict in self.__partBundleDict.items(): for lodName, partBundleDict in self.__partBundleDict.items():
if partName == None: if partName is None:
for partDef in partBundleDict.values(): for partDef in partBundleDict.values():
bundles.append(partDef.getBundle()) bundles.append(partDef.getBundle())
else: else:
subpartDef = self.__subpartDict.get(partName, Actor.SubpartDef(partName)) subpartDef = self.__subpartDict.get(partName, Actor.SubpartDef(partName))
partDef = partBundleDict.get(subpartDef.truePartName) partDef = partBundleDict.get(subpartDef.truePartName)
if partDef != None: if partDef is not None:
bundles.append(partDef.getBundle()) bundles.append(partDef.getBundle())
else: else:
Actor.notify.warning("Couldn't find part: %s" % (partName)) Actor.notify.warning("Couldn't find part: %s" % (partName))
@ -635,7 +635,7 @@ class Actor(DirectObject, NodePath):
Set the node that switches actor geometry in and out. Set the node that switches actor geometry in and out.
If one is not supplied as an argument, make one If one is not supplied as an argument, make one
""" """
if (node == None): if node is None:
node = LODNode.makeDefaultLod("lod") node = LODNode.makeDefaultLod("lod")
if self.__LODNode: if self.__LODNode:
@ -685,7 +685,7 @@ class Actor(DirectObject, NodePath):
self.switches[lodName] = [inDist, outDist] self.switches[lodName] = [inDist, outDist]
# add the switch distance info # add the switch distance info
self.__LODNode.node().addSwitch(inDist, outDist) self.__LODNode.node().addSwitch(inDist, outDist)
if center != None: if center is not None:
self.setCenter(center) self.setCenter(center)
def setLOD(self, lodName, inDist=0, outDist=0): def setLOD(self, lodName, inDist=0, outDist=0):
@ -724,7 +724,7 @@ class Actor(DirectObject, NodePath):
return self.__hasLOD return self.__hasLOD
def setCenter(self, center): def setCenter(self, center):
if center == None: if center is None:
center = Point3(0, 0, 0) center = Point3(0, 0, 0)
self.__LODCenter = center self.__LODCenter = center
if self.__LODNode: if self.__LODNode:
@ -782,7 +782,7 @@ class Actor(DirectObject, NodePath):
Returns True if any joint has changed as a result of this, Returns True if any joint has changed as a result of this,
False otherwise. """ False otherwise. """
if lodName == None: if lodName is None:
lodNames = self.getLODNames() lodNames = self.getLODNames()
else: else:
lodNames = [lodName] lodNames = [lodName]
@ -790,7 +790,7 @@ class Actor(DirectObject, NodePath):
anyChanged = False anyChanged = False
if lod < len(lodNames): if lod < len(lodNames):
lodName = lodNames[lod] lodName = lodNames[lod]
if partName == None: if partName is None:
partBundleDict = self.__partBundleDict[lodName] partBundleDict = self.__partBundleDict[lodName]
partNames = list(partBundleDict.keys()) partNames = list(partBundleDict.keys())
else: else:
@ -906,11 +906,11 @@ class Actor(DirectObject, NodePath):
return return
lodName, animControlDict = next(iter(self.__animControlDict.items())) lodName, animControlDict = next(iter(self.__animControlDict.items()))
if partName == None: if partName is None:
partName, animDict = next(iter(animControlDict.items())) partName, animDict = next(iter(animControlDict.items()))
else: else:
animDict = animControlDict.get(partName) animDict = animControlDict.get(partName)
if animDict == None: if animDict is None:
# part was not present # part was not present
Actor.notify.warning("couldn't find part: %s" % (partName)) Actor.notify.warning("couldn't find part: %s" % (partName))
return None return None
@ -931,11 +931,11 @@ class Actor(DirectObject, NodePath):
in dictionary. NOTE: only returns info for an arbitrary LOD in dictionary. NOTE: only returns info for an arbitrary LOD
""" """
lodName, animControlDict = next(iter(self.__animControlDict.items())) lodName, animControlDict = next(iter(self.__animControlDict.items()))
if partName == None: if partName is None:
partName, animDict = next(iter(animControlDict.items())) partName, animDict = next(iter(animControlDict.items()))
else: else:
animDict = animControlDict.get(partName) animDict = animControlDict.get(partName)
if animDict == None: if animDict is None:
# part was not present # part was not present
Actor.notify.warning("couldn't find part: %s" % (partName)) Actor.notify.warning("couldn't find part: %s" % (partName))
return None return None
@ -969,7 +969,7 @@ class Actor(DirectObject, NodePath):
return None return None
subpartDef = self.__subpartDict.get(partName, Actor.SubpartDef(partName)) subpartDef = self.__subpartDict.get(partName, Actor.SubpartDef(partName))
partDef = partBundleDict.get(subpartDef.truePartName) partDef = partBundleDict.get(subpartDef.truePartName)
if partDef != None: if partDef is not None:
return partDef.partBundleNP return partDef.partBundleNP
return None return None
@ -984,7 +984,7 @@ class Actor(DirectObject, NodePath):
return None return None
subpartDef = self.__subpartDict.get(partName, Actor.SubpartDef(partName)) subpartDef = self.__subpartDict.get(partName, Actor.SubpartDef(partName))
partDef = partBundleDict.get(subpartDef.truePartName) partDef = partBundleDict.get(subpartDef.truePartName)
if partDef != None: if partDef is not None:
return partDef.getBundle() return partDef.getBundle()
return None return None
@ -1001,9 +1001,9 @@ class Actor(DirectObject, NodePath):
return return
# remove the part # remove the part
if (partName in partBundleDict): if partName in partBundleDict:
partBundleDict[partName].partBundleNP.removeNode() partBundleDict[partName].partBundleNP.removeNode()
del(partBundleDict[partName]) del partBundleDict[partName]
# find the corresponding anim control dict # find the corresponding anim control dict
if self.mergeLODBundles: if self.mergeLODBundles:
@ -1014,8 +1014,8 @@ class Actor(DirectObject, NodePath):
return return
# remove the animations # remove the animations
if (partName in partDict): if partName in partDict:
del(partDict[partName]) del partDict[partName]
def hidePart(self, partName, lodName="lodRoot"): def hidePart(self, partName, lodName="lodRoot"):
""" """
@ -1093,7 +1093,7 @@ class Actor(DirectObject, NodePath):
if node is None: if node is None:
node = partDef.partBundleNP.attachNewNode(jointName) node = partDef.partBundleNP.attachNewNode(jointName)
if (joint): if joint:
if localTransform: if localTransform:
joint.addLocalTransform(node.node()) joint.addLocalTransform(node.node())
else: else:
@ -1125,7 +1125,7 @@ class Actor(DirectObject, NodePath):
# Get a handle to the joint. # Get a handle to the joint.
joint = bundle.findChild(jointName) joint = bundle.findChild(jointName)
if (joint): if joint:
joint.clearNetTransforms() joint.clearNetTransforms()
joint.clearLocalTransforms() joint.clearLocalTransforms()
else: else:
@ -1139,11 +1139,11 @@ class Actor(DirectObject, NodePath):
joints=[] joints=[]
pattern = GlobPattern(jointName) pattern = GlobPattern(jointName)
if lodName == None and self.mergeLODBundles: if lodName is None and self.mergeLODBundles:
# Get the common bundle. # Get the common bundle.
partBundleDicts = [self.__commonBundleHandles] partBundleDicts = [self.__commonBundleHandles]
elif lodName == None: elif lodName is None:
# Get all LOD's. # Get all LOD's.
partBundleDicts = self.__partBundleDict.values() partBundleDicts = self.__partBundleDict.values()
else: else:
@ -1232,7 +1232,7 @@ class Actor(DirectObject, NodePath):
return None return None
joint = bundle.findChild(jointName) joint = bundle.findChild(jointName)
if joint == None: if joint is None:
Actor.notify.warning("no joint named %s!" % (jointName)) Actor.notify.warning("no joint named %s!" % (jointName))
return None return None
return joint.getDefaultValue() return joint.getDefaultValue()
@ -1252,7 +1252,7 @@ class Actor(DirectObject, NodePath):
return None return None
joint = bundle.findChild(jointName) joint = bundle.findChild(jointName)
if joint == None: if joint is None:
Actor.notify.warning("no joint named %s!" % (jointName)) Actor.notify.warning("no joint named %s!" % (jointName))
return None return None
return joint.getTransformState() return joint.getTransformState()
@ -1277,7 +1277,7 @@ class Actor(DirectObject, NodePath):
anyGood = False anyGood = False
for bundleDict in self.__partBundleDict.values(): for bundleDict in self.__partBundleDict.values():
bundle = bundleDict[trueName].getBundle() bundle = bundleDict[trueName].getBundle()
if node == None: if node is None:
node = self.attachNewNode(ModelNode(jointName)) node = self.attachNewNode(ModelNode(jointName))
joint = bundle.findChild(jointName) joint = bundle.findChild(jointName)
if joint and isinstance(joint, MovingPartMatrix): if joint and isinstance(joint, MovingPartMatrix):
@ -1299,7 +1299,7 @@ class Actor(DirectObject, NodePath):
optimal than controlJoint() for cases in which the transform optimal than controlJoint() for cases in which the transform
is not intended to be animated during the lifetime of the is not intended to be animated during the lifetime of the
Actor. """ Actor. """
if transform == None: if transform is None:
transform = TransformState.makePosHprScale(pos, hpr, scale) transform = TransformState.makePosHprScale(pos, hpr, scale)
subpartDef = self.__subpartDict.get(partName, Actor.SubpartDef(partName)) subpartDef = self.__subpartDict.get(partName, Actor.SubpartDef(partName))
@ -1330,7 +1330,7 @@ class Actor(DirectObject, NodePath):
partDef = partBundleDict.get(subpartDef.truePartName) partDef = partBundleDict.get(subpartDef.truePartName)
if partDef: if partDef:
joint = partDef.partBundleNP.find("**/" + jointName) joint = partDef.partBundleNP.find("**/" + jointName)
if (joint.isEmpty()): if joint.isEmpty():
Actor.notify.warning("%s not found!" % (jointName)) Actor.notify.warning("%s not found!" % (jointName))
else: else:
return path.instanceTo(joint) return path.instanceTo(joint)
@ -1350,7 +1350,7 @@ class Actor(DirectObject, NodePath):
anotherPartDef = partBundleDict.get(anotherPartName) anotherPartDef = partBundleDict.get(anotherPartName)
if anotherPartDef: if anotherPartDef:
joint = anotherPartDef.partBundleNP.find("**/" + jointName) joint = anotherPartDef.partBundleNP.find("**/" + jointName)
if (joint.isEmpty()): if joint.isEmpty():
Actor.notify.warning("%s not found!" % (jointName)) Actor.notify.warning("%s not found!" % (jointName))
else: else:
partDef.partBundleNP.reparentTo(joint) partDef.partBundleNP.reparentTo(joint)
@ -1395,10 +1395,10 @@ class Actor(DirectObject, NodePath):
root under the given lod. root under the given lod.
""" """
# check to see if we are working within an lod # check to see if we are working within an lod
if lodName != None: if lodName is not None:
# find the named lod node # find the named lod node
lodRoot = self.__LODNode.find(str(lodName)) lodRoot = self.__LODNode.find(str(lodName))
if root == None: if root is None:
# no need to look further # no need to look further
root = lodRoot root = lodRoot
else: else:
@ -1406,7 +1406,7 @@ class Actor(DirectObject, NodePath):
root = lodRoot.find("**/" + root) root = lodRoot.find("**/" + root)
else: else:
# start search from self if no root and no lod given # start search from self if no root and no lod given
if root == None: if root is None:
root = self root = self
frontParts = root.findAllMatches("**/" + frontPartName) frontParts = root.findAllMatches("**/" + frontPartName)
@ -1426,7 +1426,7 @@ class Actor(DirectObject, NodePath):
# Find the back part. # Find the back part.
backPart = root.find("**/" + backPartName) backPart = root.find("**/" + backPartName)
if (backPart.isEmpty()): if backPart.isEmpty():
Actor.notify.warning("no part named %s!" % (backPartName)) Actor.notify.warning("no part named %s!" % (backPartName))
return return
@ -1442,7 +1442,7 @@ class Actor(DirectObject, NodePath):
def fixBounds(self, partName = None): def fixBounds(self, partName = None):
if(partName == None): if partName is None:
#iterate through everything #iterate through everything
for lodData in self.__partBundleDict.values(): for lodData in self.__partBundleDict.values():
for partData in lodData.values(): for partData in lodData.values():
@ -1473,7 +1473,7 @@ class Actor(DirectObject, NodePath):
in this actor in this actor
""" """
# if no part name specified fix all parts # if no part name specified fix all parts
if (part==None): if part is None:
part = self part = self
# update all characters first # update all characters first
@ -1531,12 +1531,12 @@ class Actor(DirectObject, NodePath):
Play the given animation on the given part of the actor. Play the given animation on the given part of the actor.
If no part is specified, try to play on all parts. NOTE: If no part is specified, try to play on all parts. NOTE:
plays over ALL LODs""" plays over ALL LODs"""
if fromFrame == None: if fromFrame is None:
for control in self.getAnimControls(animName, partName): for control in self.getAnimControls(animName, partName):
control.play() control.play()
else: else:
for control in self.getAnimControls(animName, partName): for control in self.getAnimControls(animName, partName):
if toFrame == None: if toFrame is None:
control.play(fromFrame, control.getNumFrames() - 1) control.play(fromFrame, control.getNumFrames() - 1)
else: else:
control.play(fromFrame, toFrame) control.play(fromFrame, toFrame)
@ -1550,12 +1550,12 @@ class Actor(DirectObject, NodePath):
all LOD's all LOD's
""" """
if fromFrame == None: if fromFrame is None:
for control in self.getAnimControls(animName, partName): for control in self.getAnimControls(animName, partName):
control.loop(restart) control.loop(restart)
else: else:
for control in self.getAnimControls(animName, partName): for control in self.getAnimControls(animName, partName):
if toFrame == None: if toFrame is None:
control.loop(restart, fromFrame, control.getNumFrames() - 1) control.loop(restart, fromFrame, control.getNumFrames() - 1)
else: else:
control.loop(restart, fromFrame, toFrame) control.loop(restart, fromFrame, toFrame)
@ -1567,11 +1567,11 @@ class Actor(DirectObject, NodePath):
restarting at zero frame if requested. If no part name restarting at zero frame if requested. If no part name
is given then try to loop on all parts. NOTE: loops on is given then try to loop on all parts. NOTE: loops on
all LOD's""" all LOD's"""
if fromFrame == None: if fromFrame is None:
fromFrame = 0 fromFrame = 0
for control in self.getAnimControls(animName, partName): for control in self.getAnimControls(animName, partName):
if toFrame == None: if toFrame is None:
control.pingpong(restart, fromFrame, control.getNumFrames() - 1) control.pingpong(restart, fromFrame, control.getNumFrames() - 1)
else: else:
control.pingpong(restart, fromFrame, toFrame) control.pingpong(restart, fromFrame, toFrame)
@ -1623,11 +1623,11 @@ class Actor(DirectObject, NodePath):
Config.prc variable. Config.prc variable.
""" """
for bundle in self.getPartBundles(partName = partName): for bundle in self.getPartBundles(partName = partName):
if blendType != None: if blendType is not None:
bundle.setBlendType(blendType) bundle.setBlendType(blendType)
if animBlend != None: if animBlend is not None:
bundle.setAnimBlendFlag(animBlend) bundle.setAnimBlendFlag(animBlend)
if frameBlend != None: if frameBlend is not None:
bundle.setFrameBlendFlag(frameBlend) bundle.setFrameBlendFlag(frameBlend)
def enableBlend(self, blendType = PartBundle.BTNormalizedLinear, partName = None): def enableBlend(self, blendType = PartBundle.BTNormalizedLinear, partName = None):
@ -1706,15 +1706,15 @@ class Actor(DirectObject, NodePath):
partDict = self.__animControlDict.get(lodName) partDict = self.__animControlDict.get(lodName)
# if this assertion fails, named lod was not present # if this assertion fails, named lod was not present
assert partDict != None assert partDict is not None
animDict = partDict.get(partName) animDict = partDict.get(partName)
if animDict == None: if animDict is None:
# part was not present # part was not present
Actor.notify.warning("couldn't find part: %s" % (partName)) Actor.notify.warning("couldn't find part: %s" % (partName))
else: else:
anim = animDict.get(animName) anim = animDict.get(animName)
if anim == None: if anim is None:
# anim was not present # anim was not present
assert Actor.notify.debug("couldn't find anim: %s" % (animName)) assert Actor.notify.debug("couldn't find anim: %s" % (animName))
pass pass
@ -1750,7 +1750,7 @@ class Actor(DirectObject, NodePath):
If lodName is None or omitted, all LOD's are returned. If lodName is None or omitted, all LOD's are returned.
""" """
if partName == None and self.__subpartsComplete: if partName is None and self.__subpartsComplete:
# If we have the __subpartsComplete flag, and no partName # If we have the __subpartsComplete flag, and no partName
# is specified, it really means to play the animation on # is specified, it really means to play the animation on
# all subparts, not on the overall Actor. # all subparts, not on the overall Actor.
@ -1759,12 +1759,12 @@ class Actor(DirectObject, NodePath):
controls = [] controls = []
# build list of lodNames and corresponding animControlDicts # build list of lodNames and corresponding animControlDicts
# requested. # requested.
if lodName == None or self.mergeLODBundles: if lodName is None or self.mergeLODBundles:
# Get all LOD's # Get all LOD's
animControlDictItems = self.__animControlDict.items() animControlDictItems = self.__animControlDict.items()
else: else:
partDict = self.__animControlDict.get(lodName) partDict = self.__animControlDict.get(lodName)
if partDict == None: if partDict is None:
Actor.notify.warning("couldn't find lod: %s" % (lodName)) Actor.notify.warning("couldn't find lod: %s" % (lodName))
animControlDictItems = [] animControlDictItems = []
else: else:
@ -1773,7 +1773,7 @@ class Actor(DirectObject, NodePath):
for lodName, partDict in animControlDictItems: for lodName, partDict in animControlDictItems:
# Now, build the list of partNames and the corresponding # Now, build the list of partNames and the corresponding
# animDicts. # animDicts.
if partName == None: if partName is None:
# Get all main parts, but not sub-parts. # Get all main parts, but not sub-parts.
animDictItems = [] animDictItems = []
for thisPart, animDict in partDict.items(): for thisPart, animDict in partDict.items():
@ -1791,14 +1791,14 @@ class Actor(DirectObject, NodePath):
for pName in partNameList: for pName in partNameList:
animDict = partDict.get(pName) animDict = partDict.get(pName)
if animDict == None: if animDict is None:
# Maybe it's a subpart that hasn't been bound yet. # Maybe it's a subpart that hasn't been bound yet.
subpartDef = self.__subpartDict.get(pName) subpartDef = self.__subpartDict.get(pName)
if subpartDef: if subpartDef:
animDict = {} animDict = {}
partDict[pName] = animDict partDict[pName] = animDict
if animDict == None: if animDict is None:
# part was not present # part was not present
Actor.notify.warning("couldn't find part: %s" % (pName)) Actor.notify.warning("couldn't find part: %s" % (pName))
else: else:
@ -1824,7 +1824,7 @@ class Actor(DirectObject, NodePath):
names = animDict.keys() names = animDict.keys()
for animName in names: for animName in names:
anim = animDict.get(animName) anim = animDict.get(animName)
if anim == None and partName != None: if anim is None and partName is not None:
for pName in partNameList: for pName in partNameList:
# Maybe it's a subpart that hasn't been bound yet. # Maybe it's a subpart that hasn't been bound yet.
subpartDef = self.__subpartDict.get(pName) subpartDef = self.__subpartDict.get(pName)
@ -1835,14 +1835,14 @@ class Actor(DirectObject, NodePath):
anim = anim.makeCopy() anim = anim.makeCopy()
animDict[animName] = anim animDict[animName] = anim
if anim == None: if anim is None:
# anim was not present # anim was not present
assert Actor.notify.debug("couldn't find anim: %s" % (animName)) assert Actor.notify.debug("couldn't find anim: %s" % (animName))
pass pass
else: else:
# bind the animation first if we need to # bind the animation first if we need to
animControl = anim.animControl animControl = anim.animControl
if animControl == None: if animControl is None:
animControl = self.__bindAnimToPart( animControl = self.__bindAnimToPart(
animName, thisPart, lodName, animName, thisPart, lodName,
allowAsyncBind = allowAsyncBind) allowAsyncBind = allowAsyncBind)
@ -1869,7 +1869,7 @@ class Actor(DirectObject, NodePath):
if isinstance(modelPath, NodePath): if isinstance(modelPath, NodePath):
# If we got a NodePath instead of a string, use *that* as # If we got a NodePath instead of a string, use *that* as
# the model directly. # the model directly.
if (copy): if copy:
model = modelPath.copyTo(NodePath()) model = modelPath.copyTo(NodePath())
else: else:
model = modelPath model = modelPath
@ -1898,15 +1898,15 @@ class Actor(DirectObject, NodePath):
if model is not None: if model is not None:
model = NodePath(model) model = NodePath(model)
if (model == None): if model is None:
raise IOError("Could not load Actor model %s" % (modelPath)) raise IOError("Could not load Actor model %s" % (modelPath))
if (model.node().isOfType(Character.getClassType())): if model.node().isOfType(Character.getClassType()):
bundleNP = model bundleNP = model
else: else:
bundleNP = model.find("**/+Character") bundleNP = model.find("**/+Character")
if (bundleNP.isEmpty()): if bundleNP.isEmpty():
Actor.notify.warning("%s is not a character!" % (modelPath)) Actor.notify.warning("%s is not a character!" % (modelPath))
model.reparentTo(self.__geomNode) model.reparentTo(self.__geomNode)
else: else:
@ -1923,7 +1923,7 @@ class Actor(DirectObject, NodePath):
# Now extract out the Character and integrate it with # Now extract out the Character and integrate it with
# the Actor. # the Actor.
if (lodName!="lodRoot"): if lodName != "lodRoot":
# parent to appropriate node under LOD switch # parent to appropriate node under LOD switch
bundleNP.reparentTo(self.__LODNode.find(str(lodName))) bundleNP.reparentTo(self.__LODNode.find(str(lodName)))
else: else:
@ -1965,7 +1965,7 @@ class Actor(DirectObject, NodePath):
self.gotName = 1 self.gotName = 1
bundleDict = self.__partBundleDict.get(lodName, None) bundleDict = self.__partBundleDict.get(lodName, None)
if bundleDict == None: if bundleDict is None:
# make a dictionary to store these parts in # make a dictionary to store these parts in
bundleDict = {} bundleDict = {}
self.__partBundleDict[lodName] = bundleDict self.__partBundleDict[lodName] = bundleDict
@ -2254,7 +2254,7 @@ class Actor(DirectObject, NodePath):
for lodName in lodNames: for lodName in lodNames:
for partName in partNames: for partName in partNames:
for animDef in self.__animControlDict[lodName][partName].values(): for animDef in self.__animControlDict[lodName][partName].values():
if animDef.animControl != None: if animDef.animControl is not None:
# Try to clear any control effects before we let # Try to clear any control effects before we let
# our handle on them go. This is especially # our handle on them go. This is especially
# important if the anim control was blending # important if the anim control was blending
@ -2266,7 +2266,7 @@ class Actor(DirectObject, NodePath):
for partName in partNames: for partName in partNames:
for anim in anims: for anim in anims:
animDef = self.__animControlDict[lodName][partName].get(anim) animDef = self.__animControlDict[lodName][partName].get(anim)
if animDef and animDef.animControl != None: if animDef and animDef.animControl is not None:
# Try to clear any control effects before we let # Try to clear any control effects before we let
# our handle on them go. This is especially # our handle on them go. This is especially
# important if the anim control was blending # important if the anim control was blending
@ -2329,19 +2329,19 @@ class Actor(DirectObject, NodePath):
partDict = self.__animControlDict[lodName] partDict = self.__animControlDict[lodName]
animDict = partDict.get(partName) animDict = partDict.get(partName)
if animDict == None: if animDict is None:
# It must be a subpart that hasn't been bound yet. # It must be a subpart that hasn't been bound yet.
animDict = {} animDict = {}
partDict[partName] = animDict partDict[partName] = animDict
anim = animDict.get(animName) anim = animDict.get(animName)
if anim == None: if anim is None:
# It must be a subpart that hasn't been bound yet. # It must be a subpart that hasn't been bound yet.
anim = partDict[subpartDef.truePartName].get(animName) anim = partDict[subpartDef.truePartName].get(animName)
anim = anim.makeCopy() anim = anim.makeCopy()
animDict[animName] = anim animDict[animName] = anim
if anim == None: if anim is None:
Actor.notify.error("actor has no animation %s", animName) Actor.notify.error("actor has no animation %s", animName)
# only bind if not already bound! # only bind if not already bound!
@ -2396,7 +2396,7 @@ class Actor(DirectObject, NodePath):
# find the part in our tree # find the part in our tree
bundleNP = partLod.find("**/%s%s"%(Actor.partPrefix,partName)) bundleNP = partLod.find("**/%s%s"%(Actor.partPrefix,partName))
if (bundleNP != None): if bundleNP is not None:
# store the part bundle # store the part bundle
self.__prepareBundle(bundleNP, partDef.partModel, self.__prepareBundle(bundleNP, partDef.partModel,
partName, lodName) partName, lodName)
@ -2468,7 +2468,7 @@ class Actor(DirectObject, NodePath):
else: else:
lodNames = [lodName] lodNames = [lodName]
if partName == None and self.__subpartsComplete: if partName is None and self.__subpartsComplete:
partNames = self.__subpartDict.keys() partNames = self.__subpartDict.keys()
else: else:
partNames = [partName] partNames = [partName]