Browse Source

ai-dev -> want-dev, HQ code uses __dev__

Darren Ranalli 22 years ago
parent
commit
adb24ce408

+ 2 - 2
direct/src/level/BasicEntities.py

@@ -21,7 +21,7 @@ class NodePathEntityBase:
         self.getNodePath().setName('%s-%s' %
         self.getNodePath().setName('%s-%s' %
                                    (self.__class__.__name__, self.entId))
                                    (self.__class__.__name__, self.entId))
 
 
-        if __debug__:
+        if __dev__:
             # for the editor
             # for the editor
             self.getNodePath().setTag('entity', '1')
             self.getNodePath().setTag('entity', '1')
 
 
@@ -30,7 +30,7 @@ class NodePathEntityBase:
         self.level.requestReparent(self, self.parentEntId)
         self.level.requestReparent(self, self.parentEntId)
 
 
     def destroy(self):
     def destroy(self):
-        if __debug__:
+        if __dev__:
             # for the editor
             # for the editor
             self.getNodePath().clearTag('entity')
             self.getNodePath().clearTag('entity')
 
 

+ 1 - 1
direct/src/level/DistributedEntityAI.py

@@ -31,7 +31,7 @@ class DistributedEntityAI(DistributedObjectAI.DistributedObjectAI,
     def getEntId(self):
     def getEntId(self):
         return self.entId
         return self.entId
 
 
-    if __debug__:
+    if __dev__:
         def setParentEntId(self, parentEntId):
         def setParentEntId(self, parentEntId):
             self.parentEntId = parentEntId
             self.parentEntId = parentEntId
             # switch to new zone
             # switch to new zone

+ 4 - 4
direct/src/level/DistributedLevel.py

@@ -136,8 +136,8 @@ class DistributedLevel(DistributedObject.DistributedObject,
     def initializeLevel(self, levelSpec):
     def initializeLevel(self, levelSpec):
         """subclass should call this as soon as it's located its level spec.
         """subclass should call this as soon as it's located its level spec.
         Must be called after obj has been generated."""
         Must be called after obj has been generated."""
-        if __debug__:
-            # if we're in debug, give the server the opportunity to send us
+        if __dev__:
+            # if we're in dev, give the server the opportunity to send us
             # a full spec
             # a full spec
             self.candidateSpec = levelSpec
             self.candidateSpec = levelSpec
             self.sendUpdate('requestCurrentLevelSpec',
             self.sendUpdate('requestCurrentLevelSpec',
@@ -146,7 +146,7 @@ class DistributedLevel(DistributedObject.DistributedObject,
         else:
         else:
             self.privGotSpec(levelSpec)
             self.privGotSpec(levelSpec)
 
 
-    if __debug__:
+    if __dev__:
         def setSpecDeny(self, reason):
         def setSpecDeny(self, reason):
             DistributedLevel.notify.error(reason)
             DistributedLevel.notify.error(reason)
             
             
@@ -633,7 +633,7 @@ class DistributedLevel(DistributedObject.DistributedObject,
             self.visChangedThisFrame = 0
             self.visChangedThisFrame = 0
         return Task.cont
         return Task.cont
 
 
-    if __debug__:
+    if __dev__:
         # level editing stuff
         # level editing stuff
         def setAttribChange(self, entId, attribName, valueStr, username):
         def setAttribChange(self, entId, attribName, valueStr, username):
             """every time the spec is edited, we get this message
             """every time the spec is edited, we get this message

+ 4 - 4
direct/src/level/DistributedLevelAI.py

@@ -30,7 +30,7 @@ class DistributedLevelAI(DistributedObjectAI.DistributedObjectAI,
         self.presentAvIds = list(self.avIdList)
         self.presentAvIds = list(self.avIdList)
         self.notify.debug("expecting avatars: %s" % str(self.avIdList))
         self.notify.debug("expecting avatars: %s" % str(self.avIdList))
 
 
-        if __debug__:
+        if __dev__:
             self.modified = 0
             self.modified = 0
 
 
     def generate(self, levelSpec):
     def generate(self, levelSpec):
@@ -57,7 +57,7 @@ class DistributedLevelAI(DistributedObjectAI.DistributedObjectAI,
 
 
     def delete(self):
     def delete(self):
         self.notify.debug('delete')
         self.notify.debug('delete')
-        if __debug__:
+        if __dev__:
             self.removeAutosaveTask()
             self.removeAutosaveTask()
         self.destroyLevel()
         self.destroyLevel()
         self.ignoreAll()
         self.ignoreAll()
@@ -79,7 +79,7 @@ class DistributedLevelAI(DistributedObjectAI.DistributedObjectAI,
 
 
         Level.Level.initializeLevel(self, self.doId, levelSpec, scenarioIndex)
         Level.Level.initializeLevel(self, self.doId, levelSpec, scenarioIndex)
 
 
-        if __debug__:
+        if __dev__:
             # listen for requests to save the spec
             # listen for requests to save the spec
             self.accept(self.editMgrEntity.getSpecSaveEvent(), self.saveSpec)
             self.accept(self.editMgrEntity.getSpecSaveEvent(), self.saveSpec)
 
 
@@ -125,7 +125,7 @@ class DistributedLevelAI(DistributedObjectAI.DistributedObjectAI,
         if av and (penalty > 0):
         if av and (penalty > 0):
             av.takeDamage(penalty)
             av.takeDamage(penalty)
         
         
-    if __debug__:
+    if __dev__:
         # level editors should call this func to tweak attributes of level
         # level editors should call this func to tweak attributes of level
         # entities
         # entities
         def setAttribChange(self, entId, attribName, value, username='SYSTEM'):
         def setAttribChange(self, entId, attribName, value, username='SYSTEM'):

+ 1 - 1
direct/src/level/EditMgrAI.py

@@ -7,7 +7,7 @@ if __debug__:
 
 
 class EditMgrAI(EditMgrBase.EditMgrBase):
 class EditMgrAI(EditMgrBase.EditMgrBase):
     """This class handles AI-side editor-specific functionality"""
     """This class handles AI-side editor-specific functionality"""
-    if __debug__:
+    if __dev__:
         def setRequestNewEntity(self, data):
         def setRequestNewEntity(self, data):
             # pick an unused entId
             # pick an unused entId
             spec = self.level.levelSpec
             spec = self.level.levelSpec

+ 1 - 1
direct/src/level/EditMgrBase.py

@@ -13,7 +13,7 @@ class EditMgrBase(Entity.Entity):
         Entity.Entity.destroy(self)
         Entity.Entity.destroy(self)
         self.ignoreAll()
         self.ignoreAll()
 
 
-    if __debug__:
+    if __dev__:
         def setInsertEntity(self, data):
         def setInsertEntity(self, data):
             # tell the level who created this entity
             # tell the level who created this entity
             self.level.setEntityCreatorUsername(data['entId'], data['username'])
             self.level.setEntityCreatorUsername(data['entId'], data['username'])

+ 6 - 5
direct/src/level/Entity.py

@@ -88,6 +88,12 @@ class Entity(DirectObject):
         self.__dict__[attrib] = value
         self.__dict__[attrib] = value
 
 
     if __debug__:
     if __debug__:
+        def debugPrint(self, message):
+            """for debugging"""
+            return self.notify.debug(
+                    str(self.__dict__.get('entId', '?'))+' '+message)
+
+    if __dev__:
         # support for level editing
         # support for level editing
         def handleAttribChange(self, attrib, value):
         def handleAttribChange(self, attrib, value):
             # call callback function if it exists
             # call callback function if it exists
@@ -110,8 +116,3 @@ class Entity(DirectObject):
             in your derived class
             in your derived class
             """
             """
             pass
             pass
-
-        def debugPrint(self, message):
-            """for debugging"""
-            return self.notify.debug(
-                    str(self.__dict__.get('entId', '?'))+' '+message)

+ 1 - 1
direct/src/level/EntrancePoint.py

@@ -32,7 +32,7 @@ class EntrancePoint(BasicEntities.NodePathEntity):
             if self.level.entranceId2entity.has_key(self.entranceId):
             if self.level.entranceId2entity.has_key(self.entranceId):
                 del self.level.entranceId2entity[self.entranceId]
                 del self.level.entranceId2entity[self.entranceId]
 
 
-    if __debug__:
+    if __dev__:
         def attribChanged(self, *args):
         def attribChanged(self, *args):
             BasicEntities.NodePathEntity.attribChanged(self, *args)
             BasicEntities.NodePathEntity.attribChanged(self, *args)
             self.destroyEntrancePoint()
             self.destroyEntrancePoint()

+ 5 - 6
direct/src/level/Level.py

@@ -44,7 +44,7 @@ class Level:
         self.scenarioIndex = scenarioIndex
         self.scenarioIndex = scenarioIndex
 
 
         self.levelSpec.setScenario(self.scenarioIndex)
         self.levelSpec.setScenario(self.scenarioIndex)
-        if __debug__:
+        if __dev__:
             self.levelSpec.setLevel(self)
             self.levelSpec.setLevel(self)
 
 
         # create some handy tables
         # create some handy tables
@@ -84,11 +84,10 @@ class Level:
         assert self.entType2ids['levelMgr'][0] == LevelConstants.LevelMgrEntId
         assert self.entType2ids['levelMgr'][0] == LevelConstants.LevelMgrEntId
         self.levelMgrEntity = self.getEntity(LevelConstants.LevelMgrEntId)
         self.levelMgrEntity = self.getEntity(LevelConstants.LevelMgrEntId)
 
 
+        # there should be one and only one editMgr
+        assert len(self.entType2ids['editMgr']) == 1
+        assert self.entType2ids['editMgr'][0] == LevelConstants.EditMgrEntId
         if __debug__:
         if __debug__:
-            # there should be one and only one editMgr
-            assert len(self.entType2ids['editMgr']) == 1
-            assert self.entType2ids['editMgr'][0] == \
-                   LevelConstants.EditMgrEntId
             self.editMgrEntity = self.getEntity(LevelConstants.EditMgrEntId)
             self.editMgrEntity = self.getEntity(LevelConstants.EditMgrEntId)
 
 
         # there should be one and only one UberZone
         # there should be one and only one UberZone
@@ -349,7 +348,7 @@ class Level:
         """the zone visibility lists have changed"""
         """the zone visibility lists have changed"""
         pass
         pass
     
     
-    if __debug__:
+    if __dev__:
         # the level generates these events when the spec changes
         # the level generates these events when the spec changes
         def getAttribChangeEventName(self):
         def getAttribChangeEventName(self):
             return 'attribChange-%s' % self.levelId
             return 'attribChange-%s' % self.levelId

+ 6 - 6
direct/src/level/LevelSpec.py

@@ -5,7 +5,7 @@ from PythonUtil import list2dict, uniqueElements
 import string
 import string
 import LevelConstants
 import LevelConstants
 import types
 import types
-if __debug__:
+if __dev__:
     import os
     import os
 
 
 class LevelSpec:
 class LevelSpec:
@@ -19,17 +19,17 @@ class LevelSpec:
         If not passed in, will create a new spec."""
         If not passed in, will create a new spec."""
         newSpec = 0
         newSpec = 0
         if type(spec) is types.ModuleType:
         if type(spec) is types.ModuleType:
-            if __debug__:
+            if __dev__:
                 # reload the spec module to pick up changes
                 # reload the spec module to pick up changes
                 reload(spec)
                 reload(spec)
             self.specDict = spec.levelSpec
             self.specDict = spec.levelSpec
-            if __debug__:
+            if __dev__:
                 self.setFilename(spec.__file__)
                 self.setFilename(spec.__file__)
         elif type(spec) is types.DictType:
         elif type(spec) is types.DictType:
             # we need this for repr/eval-ing LevelSpecs
             # we need this for repr/eval-ing LevelSpecs
             self.specDict = spec
             self.specDict = spec
         elif spec is None:
         elif spec is None:
-            if __debug__:
+            if __dev__:
                 newSpec = 1
                 newSpec = 1
                 self.specDict = {
                 self.specDict = {
                     'globalEntities': {},
                     'globalEntities': {},
@@ -52,7 +52,7 @@ class LevelSpec:
 
 
         self.setScenario(scenario)
         self.setScenario(scenario)
 
 
-        if __debug__:
+        if __dev__:
             if newSpec:
             if newSpec:
                 # add required entities
                 # add required entities
 
 
@@ -139,7 +139,7 @@ class LevelSpec:
     def privGetScenarioEntityDict(self, scenario):
     def privGetScenarioEntityDict(self, scenario):
         return self.specDict['scenarios'][scenario][0]
         return self.specDict['scenarios'][scenario][0]
 
 
-    if __debug__:
+    if __dev__:
         def setLevel(self, level):
         def setLevel(self, level):
             self.level = level
             self.level = level
 
 

+ 1 - 1
direct/src/level/PropSpinner.py

@@ -47,7 +47,7 @@ class PropSpinner(Entity.Entity):
             self.spinTracks.pause()
             self.spinTracks.pause()
             del self.spinTracks
             del self.spinTracks
 
 
-    if __debug__:
+    if __dev__:
         def attribChanged(self, *args):
         def attribChanged(self, *args):
             self.destroyProps()
             self.destroyProps()
             self.initProps()
             self.initProps()

+ 1 - 1
direct/src/level/VisibilityExtender.py

@@ -46,7 +46,7 @@ class VisibilityExtender(Entity.Entity):
         self.destroyVisExt()
         self.destroyVisExt()
         Entity.Entity.destroy(self)
         Entity.Entity.destroy(self)
 
 
-    if __debug__:
+    if __dev__:
         def setNewZones(self, newZones):
         def setNewZones(self, newZones):
             # we need to call destroyVisExt before accepting the new zone set
             # we need to call destroyVisExt before accepting the new zone set
             self.destroyVisExt()
             self.destroyVisExt()

+ 1 - 1
direct/src/level/ZoneEntity.py

@@ -40,7 +40,7 @@ class ZoneEntity(ZoneEntityBase.ZoneEntityBase, BasicEntities.NodePathAttribs):
             if self.visibleZoneNums[zoneNum] == 0:
             if self.visibleZoneNums[zoneNum] == 0:
                 del self.visibleZoneNums[zoneNum]
                 del self.visibleZoneNums[zoneNum]
 
 
-    if __debug__:
+    if __dev__:
         def setVisibility(self, visibility):
         def setVisibility(self, visibility):
             self.decrementRefCounts(self.visibility)
             self.decrementRefCounts(self.visibility)
             self.visibility = visibility
             self.visibility = visibility

+ 1 - 1
direct/src/showbase/ShowBaseGlobal.py

@@ -13,4 +13,4 @@ def inspect(anObject):
     return Inspector.inspect(anObject)
     return Inspector.inspect(anObject)
 
 
 __builtins__["inspect"] = inspect
 __builtins__["inspect"] = inspect
-
+__builtins__["__dev__"] = base.config.GetBool('want-dev', 0)