formatting

This commit is contained in:
Dave Schuyler 2005-07-01 01:29:36 +00:00
parent 7cbdfe35bb
commit 231d582a86
23 changed files with 83 additions and 91 deletions

View File

@ -5,10 +5,6 @@ from direct.distributed import DistributedNode
import Actor import Actor
class DistributedActor(DistributedNode.DistributedNode, Actor.Actor): class DistributedActor(DistributedNode.DistributedNode, Actor.Actor):
"""Distributed Actor class:"""
# Constructor for DistributedActor
def __init__(self, cr): def __init__(self, cr):
try: try:
self.DistributedActor_initialized self.DistributedActor_initialized
@ -20,16 +16,12 @@ class DistributedActor(DistributedNode.DistributedNode, Actor.Actor):
# rather cache them than delete them if possible. # rather cache them than delete them if possible.
self.setCacheable(1) self.setCacheable(1)
# Disable the DistributedActor
def disable(self): def disable(self):
# remove all anims, on all parts and all lods # remove all anims, on all parts and all lods
if (not self.isEmpty()): if (not self.isEmpty()):
Actor.Actor.unloadAnims(self, None, None, None) Actor.Actor.unloadAnims(self, None, None, None)
DistributedNode.DistributedNode.disable(self) DistributedNode.DistributedNode.disable(self)
# Delete the DistributedActor
def delete(self): def delete(self):
try: try:
self.DistributedActor_deleted self.DistributedActor_deleted
@ -40,4 +32,4 @@ class DistributedActor(DistributedNode.DistributedNode, Actor.Actor):
def loop(self, animName, restart=1, partName=None,fromFrame=None, toFrame=None): def loop(self, animName, restart=1, partName=None,fromFrame=None, toFrame=None):
return Actor.Actor.loop(self,animName,restart,partName,fromFrame,toFrame); return Actor.Actor.loop(self,animName,restart,partName,fromFrame,toFrame)

View File

@ -199,7 +199,7 @@ def qSlerp(startQuat, endQuat, t):
# If the above dot product is negative, it would be better to # If the above dot product is negative, it would be better to
# go between the negative of the initial and the final, so that # go between the negative of the initial and the final, so that
# we take the shorter path. # we take the shorter path.
if ( cosOmega < 0.0 ): if cosOmega < 0.0:
cosOmega *= -1 cosOmega *= -1
startQ.setI(-1 * startQ.getI()) startQ.setI(-1 * startQ.getI())
startQ.setJ(-1 * startQ.getJ()) startQ.setJ(-1 * startQ.getJ())

View File

@ -505,7 +505,7 @@ class ClientRepository(ConnectionRepository):
# This method is only used in conjunction with the CMU LAN # This method is only used in conjunction with the CMU LAN
# server. # server.
assert(self.DOIDnext < self.DOIDlast); assert self.DOIDnext < self.DOIDlast
zone = di.getUint32() zone = di.getUint32()
for obj in self.doId2do.values(): for obj in self.doId2do.values():
if obj.zone == zone: if obj.zone == zone:
@ -672,16 +672,16 @@ class ClientRepository(ConnectionRepository):
""" """
This Will Move The avatar and set an interest to that location .. This Will Move The avatar and set an interest to that location ..
""" """
parentId = parentIdin; parentId = parentIdin
if parentId is None: if parentId is None:
parentId = base.localAvatar.defaultShard; parentId = base.localAvatar.defaultShard
MyAvID = base.localAvatar.doId; MyAvID = base.localAvatar.doId
# move thwe avatar.. # move thwe avatar..
self.sendSetLocation(MyAvID,parentId,zoneId); self.sendSetLocation(MyAvID,parentId,zoneId)
# move the interest.. # move the interest..
InterestZones = zoneId; InterestZones = zoneId
if visibleZoneList is not None: if visibleZoneList is not None:
InterestZones = visibleZoneList InterestZones = visibleZoneList
@ -691,8 +691,8 @@ class ClientRepository(ConnectionRepository):
self.alterInterest(self.old_setzone_interest_handle,parentId, InterestZones, "OldSetZone Imulator", event) self.alterInterest(self.old_setzone_interest_handle,parentId, InterestZones, "OldSetZone Imulator", event)
def sendEmulateSetZoneOff(self): def sendEmulateSetZoneOff(self):
MyAvID = base.localAvatar.doId; MyAvID = base.localAvatar.doId
self.sendSetLocation(MyAvID,0,0); self.sendSetLocation(MyAvID,0,0)
if self.old_setzone_interest_handle is not None: if self.old_setzone_interest_handle is not None:
self.removeInterest(self.old_setzone_interest_handle) self.removeInterest(self.old_setzone_interest_handle)
self.old_setzone_interest_handle = None self.old_setzone_interest_handle = None

View File

@ -231,7 +231,7 @@ class ConnectionRepository(
if hasProxy: if hasProxy:
self.notify.info("Connecting to gameserver via proxy list: %s" % (proxies)) self.notify.info("Connecting to gameserver via proxy list: %s" % (proxies))
else: else:
self.notify.info("Connecting to gameserver directly (no proxy)."); self.notify.info("Connecting to gameserver directly (no proxy).")
if self.connectMethod == 'http': if self.connectMethod == 'http':
self.connectHttp = 1 self.connectHttp = 1

View File

@ -283,7 +283,7 @@ class DistributedObjectAI(DirectObject):
if wantOtpServer: if wantOtpServer:
def GetPuppetConnectionChannel(self, doId): def GetPuppetConnectionChannel(self, doId):
return doId + (1L << 32); return doId + (1L << 32)
def GetAccountIDFromChannelCode(self, channel): def GetAccountIDFromChannelCode(self, channel):
return channel >> 32 return channel >> 32

View File

@ -82,7 +82,7 @@ class DoCollectionManager:
Counts the number of objects of the given type in the Counts the number of objects of the given type in the
repository (for testing purposes) repository (for testing purposes)
""" """
count = 0; count = 0
for dobj in self.doId2do.values(): for dobj in self.doId2do.values():
if isinstance(dobj, classType): if isinstance(dobj, classType):
count += 1 count += 1
@ -293,7 +293,7 @@ class DoCollectionManager:
# NON OTP # NON OTP
def changeDOZoneInTables(self, do, newZoneId, oldZoneId): def changeDOZoneInTables(self, do, newZoneId, oldZoneId):
##print "changeDOZoneInTables:%s, dclass:%s, newZoneId:%s OldZoneId:%s"%(do.doId, do.dclass.getName(), newZoneId,oldZoneId); ##print "changeDOZoneInTables:%s, dclass:%s, newZoneId:%s OldZoneId:%s"%(do.doId, do.dclass.getName(), newZoneId,oldZoneId)
assert self.notify.debugStateCall(self) assert self.notify.debugStateCall(self)
assert oldZoneId in self.zoneId2doIds assert oldZoneId in self.zoneId2doIds

View File

@ -22,8 +22,8 @@ class DoInterestManager(DirectObject.DirectObject):
if __debug__: if __debug__:
notify = DirectNotifyGlobal.directNotify.newCategory("DoInterestManager") notify = DirectNotifyGlobal.directNotify.newCategory("DoInterestManager")
_interestIdAssign = 1; _interestIdAssign = 1
_interestIdScopes = 100; _interestIdScopes = 100
_interests = {} _interests = {}
if __debug__: if __debug__:
_debug_currentInterests = [] _debug_currentInterests = []
@ -85,11 +85,11 @@ class DoInterestManager(DirectObject.DirectObject):
if event is not None: if event is not None:
DoInterestManager._interestIdScopes += 1 DoInterestManager._interestIdScopes += 1
DoInterestManager._interests[contextId][1] = DoInterestManager._interestIdScopes; DoInterestManager._interests[contextId][1] = DoInterestManager._interestIdScopes
else: else:
DoInterestManager._interests[contextId][1] = 0; DoInterestManager._interests[contextId][1] = 0
DoInterestManager._interests[contextId][2] = event; DoInterestManager._interests[contextId][2] = event
self._sendAddInterest(contextId,DoInterestManager._interests[contextId][1], parentId, zoneIdList) self._sendAddInterest(contextId,DoInterestManager._interests[contextId][1], parentId, zoneIdList)
answer = 1 answer = 1
assert self.printInterestsIfDebug() assert self.printInterestsIfDebug()
@ -106,7 +106,7 @@ class DoInterestManager(DirectObject.DirectObject):
assert self.notify.debugCall() assert self.notify.debugCall()
answer = 0 answer = 0
if DoInterestManager._interests.has_key(contextId): if DoInterestManager._interests.has_key(contextId):
answer = DoInterestManager._interests[contextId][1]; answer = DoInterestManager._interests[contextId][1]
else: else:
self.notify.warning("GetInterestScopeID: contextId not found: %s" % (contextId)) self.notify.warning("GetInterestScopeID: contextId not found: %s" % (contextId))
return answer return answer
@ -119,7 +119,7 @@ class DoInterestManager(DirectObject.DirectObject):
assert self.notify.debugCall() assert self.notify.debugCall()
answer = None answer = None
if DoInterestManager._interests.has_key(contextId): if DoInterestManager._interests.has_key(contextId):
answer = DoInterestManager._interests[contextId][2]; answer = DoInterestManager._interests[contextId][2]
else: else:
self.notify.warning("GetInterestScopeEvent: contextId not found: %s" % (contextId)) self.notify.warning("GetInterestScopeEvent: contextId not found: %s" % (contextId))
return answer return answer

View File

@ -773,7 +773,7 @@ class FFIInterrogateDatabase:
pandaSqueezeTool.squeeze(squeezedName, unsqueezedName, pandaSqueezeTool.squeeze(squeezedName, unsqueezedName,
files, outputDir) files, outputDir)
if( deleteSource ): if deleteSource:
# Remove the now-squeezed source files. # Remove the now-squeezed source files.
for file in files: for file in files:
os.remove(file) os.remove(file)

View File

@ -978,7 +978,7 @@ class ClassTypeDescriptor(BaseTypeDescriptor):
#indent(file, nesting, 'returnObject = ') #indent(file, nesting, 'returnObject = ')
#file.write('FFIExternalObject.FFIInstance('+ typeName + ',returnValue,'+str(userManagesMemory)+')\n') #file.write('FFIExternalObject.FFIInstance('+ typeName + ',returnValue,'+str(userManagesMemory)+')\n')
#indent(file,nesting, 'returnObject.this = 0\n'); #indent(file,nesting, 'returnObject.this = 0\n')
#indent(file,nesting, 'returnObject.userManagesMemory = 0\n'); #indent(file,nesting, 'returnObject.userManagesMemory = 0\n');
## ##

View File

@ -14,7 +14,7 @@
# #
############################################################## ##############################################################
import sys,os; import sys,os
############################################################## ##############################################################
# #

View File

@ -169,8 +169,8 @@ class DirectEntry(DirectFrame):
lineHeight = self.onscreenText.textNode.getLineHeight() lineHeight = self.onscreenText.textNode.getLineHeight()
numLines = self['numLines'] numLines = self['numLines']
width = self['width'] width = self['width']
self.ll.set(0.0, 0.0, -0.3 * lineHeight - (lineHeight * (numLines - 1))); self.ll.set(0.0, 0.0, -0.3 * lineHeight - (lineHeight * (numLines - 1)))
self.ur.set(width, 0.0, lineHeight * 1.3); self.ur.set(width, 0.0, lineHeight * 1.3)
# Scale bounds to give a pad around graphics. We also want to # Scale bounds to give a pad around graphics. We also want to
# scale around the border width. # scale around the border width.

View File

@ -397,7 +397,7 @@ def DNASetBaselineString(baseline, text):
# replace each text item and then add or remove at the end. # replace each text item and then add or remove at the end.
# This should allow inlined graphics to stay in place. # This should allow inlined graphics to stay in place.
# end of todo. # end of todo.
DNARemoveAllChildrenOfClass(baseline, DNA_SIGN_TEXT); DNARemoveAllChildrenOfClass(baseline, DNA_SIGN_TEXT)
# We can't just blindly iterate through the text, because it might # We can't just blindly iterate through the text, because it might
# be utf-8 encoded, meaning some characters are represented using # be utf-8 encoded, meaning some characters are represented using
@ -1528,7 +1528,7 @@ class LevelEditor(NodePath, PandaObject):
newDNALandmarkBuilding.setPos(VBase3(0)) newDNALandmarkBuilding.setPos(VBase3(0))
newDNALandmarkBuilding.setHpr(VBase3(0)) newDNALandmarkBuilding.setHpr(VBase3(0))
# Headquarters do not have doors # Headquarters do not have doors
if (specialType not in [ 'hq', 'kartshop' ] ): if specialType not in [ 'hq', 'kartshop' ]:
newDNADoor = self.createDoor('landmark_door') newDNADoor = self.createDoor('landmark_door')
newDNALandmarkBuilding.add(newDNADoor) newDNALandmarkBuilding.add(newDNADoor)
# Now place new landmark building in the world # Now place new landmark building in the world
@ -1601,10 +1601,10 @@ class LevelEditor(NodePath, PandaObject):
baseline = DNASignBaseline('baseline') baseline = DNASignBaseline('baseline')
baseline.setCode("humanist") baseline.setCode("humanist")
baseline.setColor(VBase4(0.0, 0.0, 0.0, 1.0)) baseline.setColor(VBase4(0.0, 0.0, 0.0, 1.0))
#baseline.setKern(1.0); #baseline.setKern(1.0)
#baseline.setWiggle(30.0); #baseline.setWiggle(30.0)
#baseline.setStumble(1.0); #baseline.setStumble(1.0)
#baseline.setStomp(10.0); #baseline.setStomp(10.0)
#baseline.setWidth(16.0) #baseline.setWidth(16.0)
#baseline.setHeight(16.0) #baseline.setHeight(16.0)
baseline.setScale(VBase3(0.7, 1.0, 0.7)) baseline.setScale(VBase3(0.7, 1.0, 0.7))
@ -5568,7 +5568,7 @@ class LevelEditorPanel(Pmw.MegaToplevel):
flags=settings['flags'] flags=settings['flags']
if flags != None: if flags != None:
self.bigFirstLetterIntVar.set('b' in flags) self.bigFirstLetterIntVar.set('b' in flags)
self.setBigFirstLetter(); self.setBigFirstLetter()
self.allCapsIntVar.set('c' in flags) self.allCapsIntVar.set('c' in flags)
self.setAllCaps() self.setAllCaps()
@ -5606,7 +5606,7 @@ class LevelEditorPanel(Pmw.MegaToplevel):
def setBaselineString(self, val): def setBaselineString(self, val):
baseline=self.currentBaselineDNA baseline=self.currentBaselineDNA
if baseline: if baseline:
DNASetBaselineString(baseline, val); DNASetBaselineString(baseline, val)
self.baselineMenu.delete(self.currentBaselineIndex) self.baselineMenu.delete(self.currentBaselineIndex)
self.baselineMenu.insert(self.currentBaselineIndex, val) self.baselineMenu.insert(self.currentBaselineIndex, val)
self.baselineMenu.selectitem(self.currentBaselineIndex) self.baselineMenu.selectitem(self.currentBaselineIndex)

View File

@ -351,7 +351,7 @@ class Particles(ParticleSystem):
segIdList = eval('['+cim.getSegmentIdList().replace(' ',', ')+']') segIdList = eval('['+cim.getSegmentIdList().replace(' ',', ')+']')
for sid in segIdList: for sid in segIdList:
seg = cim.getSegment(sid) seg = cim.getSegment(sid)
if( seg.isEnabled() ): if seg.isEnabled():
t_b = seg.getTimeBegin() t_b = seg.getTimeBegin()
t_e = seg.getTimeEnd() t_e = seg.getTimeEnd()
fun = seg.getFunction() fun = seg.getFunction()
@ -440,7 +440,7 @@ class Particles(ParticleSystem):
segIdList = eval('['+cim.getSegmentIdList().replace(' ',', ')+']') segIdList = eval('['+cim.getSegmentIdList().replace(' ',', ')+']')
for sid in segIdList: for sid in segIdList:
seg = cim.getSegment(sid) seg = cim.getSegment(sid)
if( seg.isEnabled() ): if seg.isEnabled():
t_b = seg.getTimeBegin() t_b = seg.getTimeBegin()
t_e = seg.getTimeEnd() t_e = seg.getTimeEnd()
fun = seg.getFunction() fun = seg.getFunction()

View File

@ -599,7 +599,7 @@ class ShowBase(DirectObject.DirectObject):
# Temporary try..except for old pandas. # Temporary try..except for old pandas.
try: try:
self.render.node().setAttrib(RescaleNormalAttrib.makeDefault()); self.render.node().setAttrib(RescaleNormalAttrib.makeDefault())
except: except:
pass pass
@ -1304,8 +1304,8 @@ class ShowBase(DirectObject.DirectObject):
self.wireframeOn() self.wireframeOn()
def wireframeOn(self): def wireframeOn(self):
self.render.setRenderModeWireframe(100); self.render.setRenderModeWireframe(100)
self.render.setTwoSided(1); self.render.setTwoSided(1)
self.wireframeEnabled = 1 self.wireframeEnabled = 1
def wireframeOff(self): def wireframeOff(self):

View File

@ -327,8 +327,8 @@ class QuadView(DirectObject.DirectObject):
def ToggleWire(self): def ToggleWire(self):
if (self.CurrentQuad==1): # Front View if (self.CurrentQuad==1): # Front View
if(self.FrontWire): # Wireframe is On so turn it off if(self.FrontWire): # Wireframe is On so turn it off
self.FrontScene.setRenderModeWireframe(100); self.FrontScene.setRenderModeWireframe(100)
self.FrontScene.setTwoSided(1); self.FrontScene.setTwoSided(1)
self.FrontScene.setTextureOff(100) self.FrontScene.setTextureOff(100)
self.FrontWire=0 self.FrontWire=0
else: else:
@ -339,8 +339,8 @@ class QuadView(DirectObject.DirectObject):
self.FrontWire=1 self.FrontWire=1
elif (self.CurrentQuad==2): # Front View elif (self.CurrentQuad==2): # Front View
if(self.TopWire): # Wireframe is On so turn it off if(self.TopWire): # Wireframe is On so turn it off
self.TopScene.setRenderModeWireframe(100); self.TopScene.setRenderModeWireframe(100)
self.TopScene.setTwoSided(1); self.TopScene.setTwoSided(1)
self.TopScene.setTextureOff(100) self.TopScene.setTextureOff(100)
self.TopWire=0 self.TopWire=0
else: else:
@ -351,8 +351,8 @@ class QuadView(DirectObject.DirectObject):
self.TopWire=1 self.TopWire=1
elif (self.CurrentQuad==3): # Front View elif (self.CurrentQuad==3): # Front View
if(self.LeftWire): # Wireframe is On so turn it off if(self.LeftWire): # Wireframe is On so turn it off
self.LeftScene.setRenderModeWireframe(100); self.LeftScene.setRenderModeWireframe(100)
self.LeftScene.setTwoSided(1); self.LeftScene.setTwoSided(1)
self.LeftScene.setTextureOff(100) self.LeftScene.setTextureOff(100)
self.LeftWire=0 self.LeftWire=0
else: else:
@ -363,8 +363,8 @@ class QuadView(DirectObject.DirectObject):
self.LeftWire=1 self.LeftWire=1
elif (self.CurrentQuad==4): # Front View elif (self.CurrentQuad==4): # Front View
if(self.PerspectiveWire): # Wireframe is On so turn it off if(self.PerspectiveWire): # Wireframe is On so turn it off
self.PerspectiveScene.setRenderModeWireframe(100); self.PerspectiveScene.setRenderModeWireframe(100)
self.PerspectiveScene.setTwoSided(1); self.PerspectiveScene.setTwoSided(1)
self.PerspectiveScene.setTextureOff(100) self.PerspectiveScene.setTextureOff(100)
self.PerspectiveWire=0 self.PerspectiveWire=0
else: else:
@ -379,28 +379,28 @@ class QuadView(DirectObject.DirectObject):
if (self.CurrentQuad==1): # Front View if (self.CurrentQuad==1): # Front View
if(self.FrontTexture): # Texture is on so turn it off if(self.FrontTexture): # Texture is on so turn it off
self.FrontScene.setTextureOff(100) self.FrontScene.setTextureOff(100)
self.FrontTexture=0; self.FrontTexture=0
else: else:
self.FrontScene.clearTexture() self.FrontScene.clearTexture()
self.FrontTexture=1 self.FrontTexture=1
elif (self.CurrentQuad==2): # Top View elif (self.CurrentQuad==2): # Top View
if(self.TopTexture): # Texture is on so turn it off if(self.TopTexture): # Texture is on so turn it off
self.TopScene.setTextureOff(100) self.TopScene.setTextureOff(100)
self.TopTexture=0; self.TopTexture=0
else: else:
self.TopScene.clearTexture() self.TopScene.clearTexture()
self.TopTexture=1 self.TopTexture=1
elif (self.CurrentQuad==3): # Left View elif (self.CurrentQuad==3): # Left View
if(self.LeftTexture): # Texture is on so turn it off if(self.LeftTexture): # Texture is on so turn it off
self.LeftScene.setTextureOff(100) self.LeftScene.setTextureOff(100)
self.LeftTexture=0; self.LeftTexture=0
else: else:
self.LeftScene.clearTexture() self.LeftScene.clearTexture()
self.LeftTexture=1 self.LeftTexture=1
elif (self.CurrentQuad==4): # Perspective View elif (self.CurrentQuad==4): # Perspective View
if(self.PerspectiveTexture): # Texture is on so turn it off if(self.PerspectiveTexture): # Texture is on so turn it off
self.PerspectiveScene.setTextureOff(100) self.PerspectiveScene.setTextureOff(100)
self.PerspectiveTexture=0; self.PerspectiveTexture=0
else: else:
self.PerspectiveScene.clearTexture() self.PerspectiveScene.clearTexture()
self.PerspectiveTexture=1 self.PerspectiveTexture=1

View File

@ -170,7 +170,7 @@ class FileSaver:
if(not oldFilename.isRegularFile()): if(not oldFilename.isRegularFile()):
if(texfilename.resolveFilename(getTexturePath(),"")): if(texfilename.resolveFilename(getTexturePath(),"")):
oldFilename=texfilename oldFilename=texfilename
oldtexpath=oldFilename.toOsSpecific(); oldtexpath=oldFilename.toOsSpecific()
newtexpath=dirname + "/" + texfilename.getBasename() newtexpath=dirname + "/" + texfilename.getBasename()
newtexpathF=Filename(newtexpath) newtexpathF=Filename(newtexpath)
@ -299,7 +299,7 @@ class FileSaver:
if(not oldFilename.isRegularFile()): if(not oldFilename.isRegularFile()):
if(texfilename.resolveFilename(getTexturePath(),"")): if(texfilename.resolveFilename(getTexturePath(),"")):
oldFilename=texfilename oldFilename=texfilename
oldtexpath=oldFilename.toOsSpecific(); oldtexpath=oldFilename.toOsSpecific()
newtexpath=dirname + "/" + texfilename.getBasename() newtexpath=dirname + "/" + texfilename.getBasename()

View File

@ -641,7 +641,7 @@ if sys.platform == "win32" and DIRECTXSDK is None:
MAYAVERSIONS=[("MAYA5", "SOFTWARE\\Alias|Wavefront\\Maya\\5.0\\Setup\\InstallPath"), MAYAVERSIONS=[("MAYA5", "SOFTWARE\\Alias|Wavefront\\Maya\\5.0\\Setup\\InstallPath"),
("MAYA6", "SOFTWARE\\Alias|Wavefront\\Maya\\6.0\\Setup\\InstallPath"), ("MAYA6", "SOFTWARE\\Alias|Wavefront\\Maya\\6.0\\Setup\\InstallPath"),
("MAYA65", "SOFTWARE\\Alias|Wavefront\\Maya\\6.5\\Setup\\InstallPath") ("MAYA65", "SOFTWARE\\Alias|Wavefront\\Maya\\6.5\\Setup\\InstallPath")
]; ]
for (ver,key) in MAYAVERSIONS: for (ver,key) in MAYAVERSIONS:
if (OMIT.count(ver)==0) and (MAYASDK.has_key(ver)==0): if (OMIT.count(ver)==0) and (MAYASDK.has_key(ver)==0):