*** empty log message ***

This commit is contained in:
Joe Shochet 2000-12-05 03:22:58 +00:00
parent d5eca5fa6f
commit 1a4ea70c3d

View File

@ -1382,20 +1382,20 @@ class LevelEditor(NodePath, PandaObject):
def createStyleSample(self, style, num): def createStyleSample(self, style, num):
# Create a wall # Create a wall
wall = DNAWall('wall') wall = DNAWall('wall')
wall.setCode(self.dnaStore.findCode(style['wallTexture'])) wall.setCode(style['wallTexture'])
wall.setColor(style['wallColor']) wall.setColor(style['wallColor'])
wall.setHeight(10.0) wall.setHeight(10.0)
# Add its windows # Add its windows
windows = DNAWindows('windows') windows = DNAWindows('windows')
windows.setWindowCount(2) windows.setWindowCount(2)
windows.setCode(self.dnaStore.findCode(style['windowTexture'])) windows.setCode(style['windowTexture'])
windows.setColor(style['windowColor']) windows.setColor(style['windowColor'])
wall.add(windows) wall.add(windows)
# And a cornice if necessary # And a cornice if necessary
corniceTexture = style['corniceTexture'] corniceTexture = style['corniceTexture']
if corniceTexture: if corniceTexture:
cornice = DNACornice('cornice') cornice = DNACornice('cornice')
cornice.setCode(self.getDNACode(corniceTexture)) cornice.setCode(corniceTexture)
cornice.setColor(style['corniceColor']) cornice.setColor(style['corniceColor'])
wall.add(cornice) wall.add(cornice)
# The final building # The final building
@ -1808,7 +1808,7 @@ class LevelEditor(NodePath, PandaObject):
def addLandmark(self, landmarkType): def addLandmark(self, landmarkType):
newDNALandmarkBuilding = DNALandmarkBuilding(landmarkType + '_DNARoot') newDNALandmarkBuilding = DNALandmarkBuilding(landmarkType + '_DNARoot')
newDNALandmarkBuilding.setCode(self.getDNACode(landmarkType)) newDNALandmarkBuilding.setCode(landmarkType)
newDNALandmarkBuilding.setPos(VBase3(0)) newDNALandmarkBuilding.setPos(VBase3(0))
newDNALandmarkBuilding.setHpr(VBase3(0)) newDNALandmarkBuilding.setHpr(VBase3(0))
newDNADoor = self.createDoor(self.getDoorTexture()) newDNADoor = self.createDoor(self.getDoorTexture())
@ -1826,7 +1826,7 @@ class LevelEditor(NodePath, PandaObject):
def addProp(self, newPropType): def addProp(self, newPropType):
newDNAProp = DNAProp(newPropType + '_DNARoot') newDNAProp = DNAProp(newPropType + '_DNARoot')
newDNAProp.setCode(self.getDNACode(newPropType)) newDNAProp.setCode(newPropType)
newDNAProp.setPos(VBase3(0)) newDNAProp.setPos(VBase3(0))
newDNAProp.setHpr(VBase3(0)) newDNAProp.setHpr(VBase3(0))
# Now place new building in the world # Now place new building in the world
@ -1835,13 +1835,11 @@ class LevelEditor(NodePath, PandaObject):
def addStreetModule(self, streetType): def addStreetModule(self, streetType):
newDNAStreet = DNAStreet(streetType + '_DNARoot') newDNAStreet = DNAStreet(streetType + '_DNARoot')
newDNAStreet.setCode(self.getDNACode(streetType)) newDNAStreet.setCode(streetType)
newDNAStreet.setPos(VBase3(0)) newDNAStreet.setPos(VBase3(0))
newDNAStreet.setHpr(VBase3(0)) newDNAStreet.setHpr(VBase3(0))
newDNAStreet.setStreetTexture( newDNAStreet.setStreetTexture(self.attributeDictionary['streetTexture'])
self.getDNACode(self.attributeDictionary['streetTexture'])) newDNAStreet.setSidewalkTexture(self.attributeDictionary['sidewalkTexture'])
newDNAStreet.setSidewalkTexture(
self.getDNACode(self.attributeDictionary['sidewalkTexture']))
# Now place new building in the world # Now place new building in the world
self.addDNAGroup(newDNAStreet) self.addDNAGroup(newDNAStreet)
@ -1851,7 +1849,7 @@ class LevelEditor(NodePath, PandaObject):
# Pick a default window # Pick a default window
newDNAWindows = DNAWindows() newDNAWindows = DNAWindows()
self.setWindowTexture(self.getRandomWindowTexture()) self.setWindowTexture(self.getRandomWindowTexture())
newDNAWindows.setCode(self.getDNACode(self.getWindowTexture())) newDNAWindows.setCode(self.getWindowTexture())
newDNAWindows.setWindowCount(self.getRandomNumWindows(height)) newDNAWindows.setWindowCount(self.getRandomNumWindows(height))
colors = self.getWallColors() colors = self.getWallColors()
newDNAWindows.setColor(colors[randint(0,len(colors) - 1)]) newDNAWindows.setColor(colors[randint(0,len(colors) - 1)])
@ -1860,14 +1858,14 @@ class LevelEditor(NodePath, PandaObject):
def createCornice(self,dnaString): def createCornice(self,dnaString):
newDNACornice = DNACornice() newDNACornice = DNACornice()
newDNACornice.setCode(self.getDNACode(dnaString)) newDNACornice.setCode(dnaString)
colors = self.getCorniceColors() colors = self.getCorniceColors()
newDNACornice.setColor(colors[randint(0,len(colors) - 1)]) newDNACornice.setColor(colors[randint(0,len(colors) - 1)])
return newDNACornice return newDNACornice
def createDoor(self, dnaString): def createDoor(self, dnaString):
newDNADoor = DNADoor() newDNADoor = DNADoor()
newDNADoor.setCode(self.getDNACode(dnaString)) newDNADoor.setCode(dnaString)
colors = self.getDoorColors() colors = self.getDoorColors()
newDNADoor.setColor(colors[randint(0,len(colors) - 1)]) newDNADoor.setColor(colors[randint(0,len(colors) - 1)])
return newDNADoor return newDNADoor
@ -1914,13 +1912,13 @@ class LevelEditor(NodePath, PandaObject):
# Create a new DNAWall using default attributes # Create a new DNAWall using default attributes
# Create the DNA for this wall # Create the DNA for this wall
newDNAWall = DNAWall() newDNAWall = DNAWall()
newDNAWall.setCode(self.getDNACode(dnaString)) newDNAWall.setCode(dnaString)
newDNAWall.setHeight(height) newDNAWall.setHeight(height)
newDNAWall.setColor(self.getWallColor()) newDNAWall.setColor(self.getWallColor())
# Pick a default window # Pick a default window
newDNAWindows = DNAWindows() newDNAWindows = DNAWindows()
newDNAWindows.setCode(self.getDNACode(self.getWindowTexture())) newDNAWindows.setCode(self.getWindowTexture())
newDNAWindows.setWindowCount(1) newDNAWindows.setWindowCount(1)
newDNAWindows.setColor(self.getWindowColor()) newDNAWindows.setColor(self.getWindowColor())
newDNAWall.add(newDNAWindows) newDNAWall.add(newDNAWindows)
@ -1929,7 +1927,7 @@ class LevelEditor(NodePath, PandaObject):
def createWindows(self, numWindows): def createWindows(self, numWindows):
newDNAWindows = DNAWindows() newDNAWindows = DNAWindows()
newDNAWindows.setCode(self.getDNACode(self.getWindowTexture())) newDNAWindows.setCode(self.getWindowTexture())
newDNAWindows.setWindowCount(numWindows) newDNAWindows.setWindowCount(numWindows)
newDNAWindows.setColor(self.getWindowColor()) newDNAWindows.setColor(self.getWindowColor())
return newDNAWindows return newDNAWindows
@ -1962,12 +1960,6 @@ class LevelEditor(NodePath, PandaObject):
# Not found # Not found
return None return None
def getDNACode(self, dnaString):
dnaCode = self.dnaStore.findCode(dnaString)
if dnaCode == 0:
print 'getDNACode Error!'
return dnaCode
def getDNAGroup(self, aNodePath): def getDNAGroup(self, aNodePath):
dict = self.getLevelObject(aNodePath) dict = self.getLevelObject(aNodePath)
if dict: if dict:
@ -1976,7 +1968,9 @@ class LevelEditor(NodePath, PandaObject):
return None return None
def getDNAString(self, aDNAObject): def getDNAString(self, aDNAObject):
return (self.dnaStore.findStringFromCode(aDNAObject.getCode())) # return (self.dnaStore.findStringFromCode(aDNAObject.getCode()))
# Now the code is the string, there is no lookup anymore
return aDNAObject.getCode()
def getDoor(self, aDNAGroup): def getDoor(self, aDNAGroup):
for i in range(aDNAGroup.getNumChildren()): for i in range(aDNAGroup.getNumChildren()):
@ -2449,8 +2443,7 @@ class LevelEditor(NodePath, PandaObject):
aDNACornice = self.getCornice(aDNAFlatBuilding) aDNACornice = self.getCornice(aDNAFlatBuilding)
if not aDNACornice: if not aDNACornice:
aDNACornice = DNACornice() aDNACornice = DNACornice()
aDNACornice.setCode( aDNACornice.setCode(style['corniceTexture'])
self.dnaStore.findCode(style['corniceTexture']))
aDNACornice.setColor(style['corniceColor']) aDNACornice.setColor(style['corniceColor'])
lastWall = self.getLastWall(aDNAFlatBuilding) lastWall = self.getLastWall(aDNAFlatBuilding)
lastWall.add(aDNACornice) lastWall.add(aDNACornice)
@ -2460,14 +2453,14 @@ class LevelEditor(NodePath, PandaObject):
window.setWindowCount(numWindows) window.setWindowCount(numWindows)
def setWallStyle(self, aDNAWall, style): def setWallStyle(self, aDNAWall, style):
aDNAWall.setCode(self.dnaStore.findCode(style['wallTexture'])) aDNAWall.setCode(style['wallTexture'])
aDNAWall.setColor(style['wallColor']) aDNAWall.setColor(style['wallColor'])
aDNAWindows = self.getWindow(aDNAWall, 0) aDNAWindows = self.getWindow(aDNAWall, 0)
# If the wall has windows: # If the wall has windows:
if aDNAWindows: if aDNAWindows:
aDNAWindows.setWindowCount( aDNAWindows.setWindowCount(
self.getRandomNumWindows(aDNAWall.getHeight())) self.getRandomNumWindows(aDNAWall.getHeight()))
aDNAWindows.setCode(self.dnaStore.findCode(style['windowTexture'])) aDNAWindows.setCode(style['windowTexture'])
aDNAWindows.setColor(style['windowColor']) aDNAWindows.setColor(style['windowColor'])
def setWallStyleNum(self, aDNAWall, styleNum): def setWallStyleNum(self, aDNAWall, styleNum):
@ -2514,7 +2507,7 @@ class LevelEditor(NodePath, PandaObject):
# Change the cornice type # Change the cornice type
if aDNACornice: if aDNACornice:
# Change existing one # Change existing one
aDNACornice.setCode(self.dnaStore.findCode(dnaString)) aDNACornice.setCode(dnaString)
else: else:
lastWall = self.getLastWall(aDNAGroup) lastWall = self.getLastWall(aDNAGroup)
if lastWall: if lastWall:
@ -2553,7 +2546,7 @@ class LevelEditor(NodePath, PandaObject):
self.updateDoorTextureDNA(aDNADoor, dnaString) self.updateDoorTextureDNA(aDNADoor, dnaString)
def updateDoorTextureDNA(self, aDNADoor ,dnaString): def updateDoorTextureDNA(self, aDNADoor ,dnaString):
aDNADoor.setCode(self.dnaStore.findCode(dnaString)) aDNADoor.setCode(dnaString)
# Replace object in levelObjects dictionary and scene graph # Replace object in levelObjects dictionary and scene graph
self.replaceLevelObjectNodePath(self.selectedLevelObject) self.replaceLevelObjectNodePath(self.selectedLevelObject)
self.setDoorTexture(dnaString) self.setDoorTexture(dnaString)
@ -2634,7 +2627,7 @@ class LevelEditor(NodePath, PandaObject):
self.updatePropDNA(aDNAProp,dnaString) self.updatePropDNA(aDNAProp,dnaString)
def updatePropDNA(self, aDNAProp, dnaString): def updatePropDNA(self, aDNAProp, dnaString):
aDNAProp.setCode(self.dnaStore.findCode(dnaString)) aDNAProp.setCode(dnaString)
aDNAProp.setName(dnaString + '_DNARoot') aDNAProp.setName(dnaString + '_DNARoot')
# Replace object in levelObjects dictionary and scene graph # Replace object in levelObjects dictionary and scene graph
self.replaceLevelObjectNodePath(self.selectedLevelObject) self.replaceLevelObjectNodePath(self.selectedLevelObject)
@ -2654,16 +2647,13 @@ class LevelEditor(NodePath, PandaObject):
self.updateStreetDNA(aDNAStreet,dnaString) self.updateStreetDNA(aDNAStreet,dnaString)
def updateStreetDNA(self, aDNAStreet, dnaString): def updateStreetDNA(self, aDNAStreet, dnaString):
aDNAStreet.setCode(self.dnaStore.findCode(dnaString)) aDNAStreet.setCode(dnaString)
aDNAStreet.setName(dnaString + '_DNARoot') aDNAStreet.setName(dnaString + '_DNARoot')
aDNAStreet.setStreetTexture( aDNAStreet.setStreetTexture(self.attributeDictionary['streetTexture'])
self.getDNACode(self.attributeDictionary['streetTexture']))
if (string.find(dnaString, 'keyboard') >= 0): if (string.find(dnaString, 'keyboard') >= 0):
aDNAStreet.setSidewalkTexture( aDNAStreet.setSidewalkTexture('street_sidewalk_MM_keyboard_tex')
self.getDNACode('street_sidewalk_MM_keyboard_tex'))
else: else:
aDNAStreet.setSidewalkTexture( aDNAStreet.setSidewalkTexture(self.attributeDictionary['sidewalkTexture'])
self.getDNACode(self.attributeDictionary['sidewalkTexture']))
# Replace object in levelObjects dictionary and scene graph # Replace object in levelObjects dictionary and scene graph
self.replaceLevelObjectNodePath(self.selectedLevelObject) self.replaceLevelObjectNodePath(self.selectedLevelObject)
self.setStreetType(dnaString) self.setStreetType(dnaString)
@ -2724,7 +2714,7 @@ class LevelEditor(NodePath, PandaObject):
self.updateWallTextureDNA(aDNAWall, dnaString) self.updateWallTextureDNA(aDNAWall, dnaString)
def updateWallTextureDNA(self, aDNAWall, dnaString): def updateWallTextureDNA(self, aDNAWall, dnaString):
aDNAWall.setCode(self.dnaStore.findCode(dnaString)) aDNAWall.setCode(dnaString)
# Replace object in levelObjects dictionary and scene graph # Replace object in levelObjects dictionary and scene graph
self.replaceLevelObjectNodePath(self.selectedLevelObject) self.replaceLevelObjectNodePath(self.selectedLevelObject)
self.setWallTexture(dnaString) self.setWallTexture(dnaString)
@ -2765,7 +2755,7 @@ class LevelEditor(NodePath, PandaObject):
self.updateWindowTextureDNA(aDNAWindow, dnaString) self.updateWindowTextureDNA(aDNAWindow, dnaString)
def updateWindowTextureDNA(self, aDNAWindow, dnaString): def updateWindowTextureDNA(self, aDNAWindow, dnaString):
aDNAWindow.setCode(self.dnaStore.findCode(dnaString)) aDNAWindow.setCode(dnaString)
# Replace object in levelObjects dictionary and scene graph # Replace object in levelObjects dictionary and scene graph
self.replaceLevelObjectNodePath(self.selectedLevelObject) self.replaceLevelObjectNodePath(self.selectedLevelObject)
self.setWindowTexture(dnaString) self.setWindowTexture(dnaString)