mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 02:15:43 -04:00
*** empty log message ***
This commit is contained in:
parent
2c72484f9c
commit
c7566dd995
@ -1,8 +1,8 @@
|
|||||||
from ShowBaseGlobal import *
|
from ShowBaseGlobal import *
|
||||||
from DirectSession import *
|
|
||||||
|
|
||||||
# If specified in the user's Configrc, create the direct session
|
# If specified in the user's Configrc, create the direct session
|
||||||
if base.wantDIRECT:
|
if base.wantDIRECT:
|
||||||
|
from DirectSession import *
|
||||||
direct = base.direct = DirectSession()
|
direct = base.direct = DirectSession()
|
||||||
else:
|
else:
|
||||||
# Otherwise set the values to None
|
# Otherwise set the values to None
|
||||||
|
@ -155,6 +155,11 @@ class LevelEditor(NodePath, PandaObject):
|
|||||||
self.attributeDictionary['windowOrienation'] = '_ur'
|
self.attributeDictionary['windowOrienation'] = '_ur'
|
||||||
self.attributeDictionary['numWindows'] = 0
|
self.attributeDictionary['numWindows'] = 0
|
||||||
|
|
||||||
|
# Streets
|
||||||
|
attributeList = self.getCatalogCodes('street')
|
||||||
|
self.attributeDictionary['streetTypes'] = attributeList
|
||||||
|
self.attributeDictionary['streetType'] = attributeList[1]
|
||||||
|
|
||||||
def getActiveColor(self):
|
def getActiveColor(self):
|
||||||
return self.attributeDictionary['activeColor']
|
return self.attributeDictionary['activeColor']
|
||||||
|
|
||||||
@ -289,6 +294,15 @@ class LevelEditor(NodePath, PandaObject):
|
|||||||
def getPropTypes(self):
|
def getPropTypes(self):
|
||||||
return self.attributeDictionary['propTypes']
|
return self.attributeDictionary['propTypes']
|
||||||
|
|
||||||
|
def getStreetType(self):
|
||||||
|
return self.attributeDictionary['streetType']
|
||||||
|
|
||||||
|
def setStreetType(self,dnaString):
|
||||||
|
self.attributeDictionary['streetType'] = dnaString
|
||||||
|
|
||||||
|
def getStreetTypes(self):
|
||||||
|
return self.attributeDictionary['streetTypes']
|
||||||
|
|
||||||
def getSelectedLevelObject(self):
|
def getSelectedLevelObject(self):
|
||||||
return self.selectedLevelObject
|
return self.selectedLevelObject
|
||||||
|
|
||||||
@ -434,8 +448,8 @@ class LevelEditor(NodePath, PandaObject):
|
|||||||
self.attributeDictionary['toontownCentralStyleDictionary'])
|
self.attributeDictionary['toontownCentralStyleDictionary'])
|
||||||
self.pieMenuDictionary['styleMenu'] = (
|
self.pieMenuDictionary['styleMenu'] = (
|
||||||
self.pieMenuDictionary['toontownCentralStyleMenu'])
|
self.pieMenuDictionary['toontownCentralStyleMenu'])
|
||||||
self.attributeDictionary['streetTexture'] = 'street_street_tex'
|
self.attributeDictionary['streetTexture'] = 'street_street_TT_tex'
|
||||||
self.attributeDictionary['sidewalkTexture'] = 'street_sidewalk_tex'
|
self.attributeDictionary['sidewalkTexture'] = 'street_sidewalk_TT_tex'
|
||||||
self.dnaOutputDir = 'ToontownCentral'
|
self.dnaOutputDir = 'ToontownCentral'
|
||||||
self.dnaOutputFile = 'toontown_central_working.dna'
|
self.dnaOutputFile = 'toontown_central_working.dna'
|
||||||
self.panel.editMenu.selectitem('Toontown Central')
|
self.panel.editMenu.selectitem('Toontown Central')
|
||||||
@ -449,9 +463,9 @@ class LevelEditor(NodePath, PandaObject):
|
|||||||
self.attributeDictionary['donaldsDockStyleDictionary'])
|
self.attributeDictionary['donaldsDockStyleDictionary'])
|
||||||
self.pieMenuDictionary['styleMenu'] = (
|
self.pieMenuDictionary['styleMenu'] = (
|
||||||
self.pieMenuDictionary['donaldsDockStyleMenu'])
|
self.pieMenuDictionary['donaldsDockStyleMenu'])
|
||||||
self.attributeDictionary['streetTexture'] = 'street_street_dock_tex'
|
self.attributeDictionary['streetTexture'] = 'street_street_DD_tex'
|
||||||
self.attributeDictionary['sidewalkTexture'] = (
|
self.attributeDictionary['sidewalkTexture'] = (
|
||||||
'street_sidewalk_dock_tex')
|
'street_sidewalk_DD_tex')
|
||||||
self.dnaOutputDir = 'DonaldsDock'
|
self.dnaOutputDir = 'DonaldsDock'
|
||||||
self.dnaOutputFile = 'donalds_dock_working.dna'
|
self.dnaOutputFile = 'donalds_dock_working.dna'
|
||||||
self.panel.editMenu.selectitem('Donalds Dock')
|
self.panel.editMenu.selectitem('Donalds Dock')
|
||||||
@ -465,9 +479,9 @@ class LevelEditor(NodePath, PandaObject):
|
|||||||
self.attributeDictionary['minniesMelodyLandStyleDictionary'])
|
self.attributeDictionary['minniesMelodyLandStyleDictionary'])
|
||||||
self.pieMenuDictionary['styleMenu'] = (
|
self.pieMenuDictionary['styleMenu'] = (
|
||||||
self.pieMenuDictionary['minniesMelodyLandStyleMenu'])
|
self.pieMenuDictionary['minniesMelodyLandStyleMenu'])
|
||||||
self.attributeDictionary['streetTexture'] = 'street_street_dock_tex'
|
self.attributeDictionary['streetTexture'] = 'street_street_MM_tex'
|
||||||
self.attributeDictionary['sidewalkTexture'] = (
|
self.attributeDictionary['sidewalkTexture'] = (
|
||||||
'street_sidewalk_dock_tex')
|
'street_sidewalk_MM_tex')
|
||||||
self.dnaOutputDir = 'MinniesMelodyLand'
|
self.dnaOutputDir = 'MinniesMelodyLand'
|
||||||
self.dnaOutputFile = 'minnies_melody_land_working.dna'
|
self.dnaOutputFile = 'minnies_melody_land_working.dna'
|
||||||
self.panel.editMenu.selectitem('Minnies Melody Land')
|
self.panel.editMenu.selectitem('Minnies Melody Land')
|
||||||
@ -481,9 +495,9 @@ class LevelEditor(NodePath, PandaObject):
|
|||||||
self.attributeDictionary['theBurrrghStyleDictionary'])
|
self.attributeDictionary['theBurrrghStyleDictionary'])
|
||||||
self.pieMenuDictionary['styleMenu'] = (
|
self.pieMenuDictionary['styleMenu'] = (
|
||||||
self.pieMenuDictionary['theBurrrghStyleMenu'])
|
self.pieMenuDictionary['theBurrrghStyleMenu'])
|
||||||
self.attributeDictionary['streetTexture'] = 'street_street_dock_tex'
|
self.attributeDictionary['streetTexture'] = 'street_street_BR_tex'
|
||||||
self.attributeDictionary['sidewalkTexture'] = (
|
self.attributeDictionary['sidewalkTexture'] = (
|
||||||
'street_sidewalk_dock_tex')
|
'street_sidewalk_BR_tex')
|
||||||
self.dnaOutputDir = 'TheBurrrgh'
|
self.dnaOutputDir = 'TheBurrrgh'
|
||||||
self.dnaOutputFile = 'the_burrrgh_working.dna'
|
self.dnaOutputFile = 'the_burrrgh_working.dna'
|
||||||
self.panel.editMenu.selectitem('The Burrrgh')
|
self.panel.editMenu.selectitem('The Burrrgh')
|
||||||
@ -839,6 +853,9 @@ class LevelEditor(NodePath, PandaObject):
|
|||||||
target = selectedObjectDNA
|
target = selectedObjectDNA
|
||||||
if self.direct.fControl:
|
if self.direct.fControl:
|
||||||
menuType = 'propColor'
|
menuType = 'propColor'
|
||||||
|
elif objClass.eq(DNAStreet.getClassType()):
|
||||||
|
menuType = 'streetType'
|
||||||
|
target = selectedObjectDNA
|
||||||
# Now spawn apropriate menu task
|
# Now spawn apropriate menu task
|
||||||
if ((target != None) | (menuType == 'cornice')):
|
if ((target != None) | (menuType == 'cornice')):
|
||||||
self.spawnMenuTask(menuType, target)
|
self.spawnMenuTask(menuType, target)
|
||||||
@ -962,6 +979,9 @@ class LevelEditor(NodePath, PandaObject):
|
|||||||
elif menu == 'propType':
|
elif menu == 'propType':
|
||||||
self.activeMenu = self.pieMenuDictionary['propTypesMenu']
|
self.activeMenu = self.pieMenuDictionary['propTypesMenu']
|
||||||
state = self.getDNAString(aDNAObject)
|
state = self.getDNAString(aDNAObject)
|
||||||
|
elif menu == 'streetType':
|
||||||
|
self.activeMenu = self.pieMenuDictionary['streetTypesMenu']
|
||||||
|
state = self.getDNAString(aDNAObject)
|
||||||
elif menu == 'style':
|
elif menu == 'style':
|
||||||
self.activeMenu = self.pieMenuDictionary['styleMenu']
|
self.activeMenu = self.pieMenuDictionary['styleMenu']
|
||||||
state = 1
|
state = 1
|
||||||
@ -1319,6 +1339,38 @@ class LevelEditor(NodePath, PandaObject):
|
|||||||
|
|
||||||
return newPropTypeMenu
|
return newPropTypeMenu
|
||||||
|
|
||||||
|
def createStreetTypesMenu(self):
|
||||||
|
numItems = len(self.getStreetTypes())
|
||||||
|
|
||||||
|
streetNodes = []
|
||||||
|
for i in range (numItems):
|
||||||
|
node = OnscreenText(self.getStreetTypes()[i],0,0)
|
||||||
|
streetNodes.append(node)
|
||||||
|
|
||||||
|
newStreetTypeMenu = hidden.attachNewNode(NamedNode('streetTypeMenu'))
|
||||||
|
|
||||||
|
radius = 0.7
|
||||||
|
angle = deg2Rad(360.0/numItems)
|
||||||
|
for i in range (numItems):
|
||||||
|
# Get the node
|
||||||
|
node = streetNodes[i]
|
||||||
|
node.setScale(node.getScale())
|
||||||
|
|
||||||
|
# Reposition it
|
||||||
|
node.setXY(radius * math.cos(i * angle),
|
||||||
|
(radius *
|
||||||
|
(self.direct.chan.width/
|
||||||
|
float(self.direct.chan.height)) *
|
||||||
|
math.sin(i * angle)))
|
||||||
|
|
||||||
|
# Add it to the streetTypeMenu
|
||||||
|
node.reparentTo(newStreetTypeMenu)
|
||||||
|
|
||||||
|
# Scale the whole shebang down by 0.5
|
||||||
|
newStreetTypeMenu.setScale(0.5)
|
||||||
|
|
||||||
|
return newStreetTypeMenu
|
||||||
|
|
||||||
def createStyleSample(self, style, num):
|
def createStyleSample(self, style, num):
|
||||||
# Create a wall
|
# Create a wall
|
||||||
wall = DNAWall('wall')
|
wall = DNAWall('wall')
|
||||||
@ -1584,6 +1636,9 @@ class LevelEditor(NodePath, PandaObject):
|
|||||||
self.pieMenuDictionary['propTypesMenu'] = (
|
self.pieMenuDictionary['propTypesMenu'] = (
|
||||||
PieMenu(self.direct,self.createPropTypesMenu(),
|
PieMenu(self.direct,self.createPropTypesMenu(),
|
||||||
self.updatePropNum))
|
self.updatePropNum))
|
||||||
|
self.pieMenuDictionary['streetTypesMenu'] = (
|
||||||
|
PieMenu(self.direct,self.createStreetTypesMenu(),
|
||||||
|
self.updateStreetNum))
|
||||||
# Create several different style menus
|
# Create several different style menus
|
||||||
self.createStyleMenus()
|
self.createStyleMenus()
|
||||||
# Create several differnt color palette menus
|
# Create several differnt color palette menus
|
||||||
@ -2103,9 +2158,12 @@ class LevelEditor(NodePath, PandaObject):
|
|||||||
|
|
||||||
def initNewDNAGroupWithParent(self, dnaGroup, rootNode):
|
def initNewDNAGroupWithParent(self, dnaGroup, rootNode):
|
||||||
# Reflect currently selected prop type
|
# Reflect currently selected prop type
|
||||||
if dnaGroup.__class__.getClassType().eq(DNAProp.getClassType()):
|
groupClass = dnaGroup.__class__.getClassType()
|
||||||
self.updatePropType(dnaGroup,self.getPropType())
|
if groupClass.eq(DNAProp.getClassType()):
|
||||||
|
self.updatePropDNA(dnaGroup,self.getPropType())
|
||||||
|
elif groupClass.eq(DNAStreet.getClassType()):
|
||||||
|
self.updateStreetDNA(dnaGroup,self.getStreetType())
|
||||||
|
|
||||||
# Create a new copy of dnaGroup's class
|
# Create a new copy of dnaGroup's class
|
||||||
# Extract group's class using __class__
|
# Extract group's class using __class__
|
||||||
# Call that class's constructor passing in dnaGroup to make a copy
|
# Call that class's constructor passing in dnaGroup to make a copy
|
||||||
@ -2124,7 +2182,7 @@ class LevelEditor(NodePath, PandaObject):
|
|||||||
# Create a new dna Group of the same type a dnaGroup
|
# Create a new dna Group of the same type a dnaGroup
|
||||||
newDNAGroup = dnaGroup.__class__(dnaGroup)
|
newDNAGroup = dnaGroup.__class__(dnaGroup)
|
||||||
if dnaGroup.__class__.getClassType().eq(DNAProp.getClassType()):
|
if dnaGroup.__class__.getClassType().eq(DNAProp.getClassType()):
|
||||||
self.updatePropType(newDNAGroup,self.getPropType())
|
self.updatePropDNA(newDNAGroup,self.getPropType())
|
||||||
|
|
||||||
self.initDNAGroupWithParentType(newDNAGroup, self.groupParent, type)
|
self.initDNAGroupWithParentType(newDNAGroup, self.groupParent, type)
|
||||||
|
|
||||||
@ -2567,10 +2625,39 @@ class LevelEditor(NodePath, PandaObject):
|
|||||||
|
|
||||||
def updatePropDNA(self, aDNAProp, dnaString):
|
def updatePropDNA(self, aDNAProp, dnaString):
|
||||||
aDNAProp.setCode(self.dnaStore.findCode(dnaString))
|
aDNAProp.setCode(self.dnaStore.findCode(dnaString))
|
||||||
|
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)
|
||||||
self.setPropType(dnaString)
|
self.setPropType(dnaString)
|
||||||
|
|
||||||
|
def updateStreetNum(self,streetNumber):
|
||||||
|
self.updateStreetType(self.targetDNAObject, streetNumber)
|
||||||
|
|
||||||
|
def updateStreetType(self, aDNAStreet, streetNumber):
|
||||||
|
# Which streetType was picked by the user?
|
||||||
|
if (streetNumber < 0):
|
||||||
|
dnaString = self.activeMenu.getInitialState()
|
||||||
|
else:
|
||||||
|
dnaString = self.getStreetTypes()[streetNumber]
|
||||||
|
|
||||||
|
# Now update the texture on the wall with that texture
|
||||||
|
self.updateStreetDNA(aDNAStreet,dnaString)
|
||||||
|
|
||||||
|
def updateStreetDNA(self, aDNAStreet, dnaString):
|
||||||
|
aDNAStreet.setCode(self.dnaStore.findCode(dnaString))
|
||||||
|
aDNAStreet.setName(dnaString + '_DNARoot')
|
||||||
|
aDNAStreet.setStreetTexture(
|
||||||
|
self.getDNACode(self.attributeDictionary['streetTexture']))
|
||||||
|
if (string.find(dnaString, 'keyboard') >= 0):
|
||||||
|
aDNAStreet.setSidewalkTexture(
|
||||||
|
self.getDNACode('street_sidewalk_MM_keyboard_tex'))
|
||||||
|
else:
|
||||||
|
aDNAStreet.setSidewalkTexture(
|
||||||
|
self.getDNACode(self.attributeDictionary['sidewalkTexture']))
|
||||||
|
# Replace object in levelObjects dictionary and scene graph
|
||||||
|
self.replaceLevelObjectNodePath(self.selectedLevelObject)
|
||||||
|
self.setStreetType(dnaString)
|
||||||
|
|
||||||
def updateRandomNumWindows(self, aDNAFlatBuilding):
|
def updateRandomNumWindows(self, aDNAFlatBuilding):
|
||||||
for i in range(aDNAFlatBuilding.getNumChildren()):
|
for i in range(aDNAFlatBuilding.getNumChildren()):
|
||||||
child = aDNAFlatBuilding.at(i)
|
child = aDNAFlatBuilding.at(i)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user