*** empty log message ***
This commit is contained in:
parent
9633192ede
commit
38117ceb11
|
|
@ -1,7 +1,27 @@
|
|||
import pdb
|
||||
|
||||
import getopt
|
||||
import sys
|
||||
|
||||
# If you run this from the command line you can pass in the hood codes
|
||||
# you want to load. For example:
|
||||
# ppython LevelEditor.py DD TT BR
|
||||
#
|
||||
if sys.argv[1:]:
|
||||
try:
|
||||
opts, pargs = getopt.getopt(sys.argv[1:], '')
|
||||
hoods = pargs
|
||||
except Exception, e:
|
||||
print e
|
||||
# If you do not run from the command line, we just load all of them
|
||||
# or you can hack this up for your own purposes.
|
||||
else:
|
||||
hoods = ['TT', 'DD', 'BR', 'DG', 'DL', 'MM']
|
||||
|
||||
print "Loading LevelEditor for hoods: ", hoods
|
||||
|
||||
from DirectSessionGlobal import *
|
||||
from PandaObject import *
|
||||
from PieMenu import *
|
||||
#from OnscreenText import *
|
||||
from GuiGlobals import *
|
||||
from Tkinter import *
|
||||
from DirectGeometry import *
|
||||
|
|
@ -38,22 +58,25 @@ BUILDING_TYPES = ['10_10', '20', '10_20', '20_10', '10_10_10',
|
|||
'4_21', '3_22', '4_13_8', '3_13_9', '10',
|
||||
'12_8', '13_9_8'
|
||||
]
|
||||
|
||||
# The list of neighborhoods to edit
|
||||
NEIGHBORHOODS = [
|
||||
'toontown_central',
|
||||
'donalds_dock',
|
||||
'minnies_melody_land',
|
||||
'the_burrrgh',
|
||||
'daisys_garden',
|
||||
'donalds_dreamland',
|
||||
]
|
||||
NEIGHBORHOOD_CODES = {'toontown_central': 'TT',
|
||||
'donalds_dock': 'DD',
|
||||
'minnies_melody_land': 'MM',
|
||||
'the_burrrgh': 'BR',
|
||||
'daisys_garden': 'DG',
|
||||
'donalds_dreamland': 'DL'
|
||||
}
|
||||
hoodIds = {'TT' : 'toontown_central',
|
||||
'DD' : 'donalds_dock',
|
||||
'MM' : 'minnies_melody_land',
|
||||
'BR' : 'the_burrrgh',
|
||||
'DG' : 'daisys_garden',
|
||||
'DL' : 'donalds_dreamland',
|
||||
}
|
||||
NEIGHBORHOODS = []
|
||||
NEIGHBORHOOD_CODES = {}
|
||||
for hoodId in hoods:
|
||||
if hoodIds.has_key(hoodId):
|
||||
hoodName = hoodIds[hoodId]
|
||||
NEIGHBORHOOD_CODES[hoodName] = hoodId
|
||||
NEIGHBORHOODS.append(hoodName)
|
||||
else:
|
||||
print 'Error: no hood defined for: ', hoodId
|
||||
|
||||
OBJECT_SNAP_POINTS = {
|
||||
'street_5x20': [(Vec3(5.0,0,0), Vec3(0)),
|
||||
(Vec3(0), Vec3(0))],
|
||||
|
|
@ -177,12 +200,18 @@ except NameError:
|
|||
# Load the generic storage file
|
||||
loadDNAFile(DNASTORE, 'phase_4/dna/storage.dna', CSDefault, 1)
|
||||
# Load all the neighborhood specific storage files
|
||||
loadDNAFile(DNASTORE, 'phase_4/dna/storage_TT.dna', CSDefault, 1)
|
||||
loadDNAFile(DNASTORE, 'phase_6/dna/storage_DD.dna', CSDefault, 1)
|
||||
loadDNAFile(DNASTORE, 'phase_6/dna/storage_MM.dna', CSDefault, 1)
|
||||
loadDNAFile(DNASTORE, 'phase_8/dna/storage_BR.dna', CSDefault, 1)
|
||||
loadDNAFile(DNASTORE, 'phase_8/dna/storage_DG.dna', CSDefault, 1)
|
||||
loadDNAFile(DNASTORE, 'phase_8/dna/storage_DL.dna', CSDefault, 1)
|
||||
if 'TT' in hoods:
|
||||
loadDNAFile(DNASTORE, 'phase_4/dna/storage_TT.dna', CSDefault, 1)
|
||||
if 'DD' in hoods:
|
||||
loadDNAFile(DNASTORE, 'phase_6/dna/storage_DD.dna', CSDefault, 1)
|
||||
if 'MM' in hoods:
|
||||
loadDNAFile(DNASTORE, 'phase_6/dna/storage_MM.dna', CSDefault, 1)
|
||||
if 'BR' in hoods:
|
||||
loadDNAFile(DNASTORE, 'phase_8/dna/storage_BR.dna', CSDefault, 1)
|
||||
if 'DG' in hoods:
|
||||
loadDNAFile(DNASTORE, 'phase_8/dna/storage_DG.dna', CSDefault, 1)
|
||||
if 'DL' in hoods:
|
||||
loadDNAFile(DNASTORE, 'phase_8/dna/storage_DL.dna', CSDefault, 1)
|
||||
__builtin__.dnaLoaded = 1
|
||||
|
||||
# Precompute class types for type comparisons
|
||||
|
|
@ -469,8 +498,8 @@ class LevelEditor(NodePath, PandaObject):
|
|||
self.vgpanel = None
|
||||
# Start off enabled
|
||||
self.enable()
|
||||
# Editing toontown_central
|
||||
self.setEditMode('toontown_central')
|
||||
# Editing the first hood id on the list
|
||||
self.setEditMode(NEIGHBORHOODS[0])
|
||||
|
||||
# SUIT POINTS
|
||||
# Create a sphere model to show suit points
|
||||
|
|
@ -1165,7 +1194,7 @@ class LevelEditor(NodePath, PandaObject):
|
|||
self.DNATarget = dnaObject
|
||||
if direct.fControl:
|
||||
menuMode = 'prop_color'
|
||||
if direct.fShift:
|
||||
elif direct.fShift:
|
||||
menuMode = 'sign_texture'
|
||||
self.DNATarget = DNAGetChildOfClass(dnaObject, DNA_SIGN)
|
||||
self.DNATargetParent = dnaObject
|
||||
|
|
@ -3984,12 +4013,11 @@ class LevelEditorPanel(Pmw.MegaToplevel):
|
|||
label_text = 'Prop type:',
|
||||
entry_width = 30,
|
||||
selectioncommand = self.setPropType,
|
||||
scrolledlist_items = map(lambda s: s[5:],
|
||||
self.styleManager.getCatalogCodes('prop'))
|
||||
scrolledlist_items = self.styleManager.getCatalogCodes('prop')
|
||||
)
|
||||
self.propType = self.styleManager.getCatalogCode('prop',0)
|
||||
self.propSelector.selectitem(
|
||||
self.styleManager.getCatalogCode('prop',0)[5:])
|
||||
self.styleManager.getCatalogCode('prop',0))
|
||||
self.propSelector.pack(expand = 1, fill = 'both')
|
||||
|
||||
|
||||
|
|
@ -4518,7 +4546,7 @@ class LevelEditorPanel(Pmw.MegaToplevel):
|
|||
self.levelEditor.addLandmark(self.landmarkType)
|
||||
|
||||
def setPropType(self,name):
|
||||
self.propType = 'prop_' + name
|
||||
self.propType = name
|
||||
self.levelEditor.setCurrent('prop_texture', self.propType)
|
||||
|
||||
def addProp(self):
|
||||
|
|
@ -4773,3 +4801,5 @@ class VisGroupsEditor(Pmw.MegaToplevel):
|
|||
self.balloon.configure(state = 'none')
|
||||
|
||||
|
||||
l = LevelEditor()
|
||||
run()
|
||||
|
|
|
|||
|
|
@ -81,11 +81,12 @@ class Inspector:
|
|||
keys = self.namedParts()
|
||||
keys.sort()
|
||||
for each in keys:
|
||||
if not callable(eval('self.object.' + each)):
|
||||
self._partsList.append(each)
|
||||
self._partsList.append(each)
|
||||
#if not callable(eval('self.object.' + each)):
|
||||
# self._partsList.append(each)
|
||||
|
||||
def initializePartNames(self):
|
||||
self._partNames = ['self'] + map(lambda each: str(each), self._partsList)
|
||||
self._partNames = ['up'] + map(lambda each: str(each), self._partsList)
|
||||
|
||||
def title(self):
|
||||
"Subclasses may override."
|
||||
|
|
@ -95,7 +96,17 @@ class Inspector:
|
|||
return dir(self.object)
|
||||
|
||||
def stringForPartNumber(self, partNumber):
|
||||
return str(self.partNumber(partNumber))
|
||||
object = self.partNumber(partNumber)
|
||||
doc = None
|
||||
if callable(object):
|
||||
try:
|
||||
doc = object.__doc__
|
||||
except:
|
||||
pass
|
||||
if doc:
|
||||
return (str(object) + '\n' + str(doc))
|
||||
else:
|
||||
return str(object)
|
||||
|
||||
def partNumber(self, partNumber):
|
||||
if partNumber == 0:
|
||||
|
|
@ -124,7 +135,7 @@ class ModuleInspector(Inspector):
|
|||
|
||||
class ClassInspector(Inspector):
|
||||
def namedParts(self):
|
||||
return ['__bases__', '__dict__']
|
||||
return ['__bases__'] + self.object.__dict__.keys()
|
||||
|
||||
def title(self):
|
||||
return self.object.__name__ + ' Class'
|
||||
|
|
@ -132,6 +143,8 @@ class ClassInspector(Inspector):
|
|||
class InstanceInspector(Inspector):
|
||||
def title(self):
|
||||
return self.object.__class__.__name__
|
||||
def namedParts(self):
|
||||
return ['__class__'] + dir(self.object)
|
||||
|
||||
###
|
||||
|
||||
|
|
@ -254,9 +267,7 @@ class InspectorWindow:
|
|||
def listSelectionChanged(self, event):
|
||||
partNumber = self.selectedIndex()
|
||||
if partNumber == None:
|
||||
#string = ''
|
||||
partNumber = 0
|
||||
#else:
|
||||
string = self.topInspector().stringForPartNumber(partNumber)
|
||||
self.textWidget.delete('1.0', END)
|
||||
self.textWidget.insert(END, string)
|
||||
|
|
|
|||
Loading…
Reference in New Issue