mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-28 15:53:55 -04:00
*** empty log message ***
This commit is contained in:
parent
2c413301ae
commit
8ea95d6633
@ -197,8 +197,12 @@ class DirectBoundingBox:
|
||||
|
||||
def computeBounds(self):
|
||||
self.bounds = self.nodePath.getBounds()
|
||||
self.center = self.bounds.getCenter()
|
||||
self.radius = self.bounds.getRadius()
|
||||
if self.bounds.isEmpty():
|
||||
self.center = Point3(0)
|
||||
self.radius = 1.0
|
||||
else:
|
||||
self.center = self.bounds.getCenter()
|
||||
self.radius = self.bounds.getRadius()
|
||||
self.min = Point3(self.center - Point3(self.radius))
|
||||
self.max = Point3(self.center + Point3(self.radius))
|
||||
|
||||
|
@ -37,18 +37,18 @@
|
||||
|
||||
def showSiblings(self):
|
||||
for sib in self.getParent().getChildrenAsList():
|
||||
if sib != self:
|
||||
if sib.node() != self.node():
|
||||
sib.show()
|
||||
|
||||
def hideSiblings(self):
|
||||
for sib in self.getParent().getChildrenAsList():
|
||||
if sib != aNodePath:
|
||||
if sib.node() != self.node():
|
||||
sib.hide()
|
||||
|
||||
def showAllDescendants(self):
|
||||
self.show()
|
||||
for child in self.getChildrenAsList():
|
||||
self.showAllDescendants(child)
|
||||
child.showAllDescendants()
|
||||
|
||||
def isolate(self):
|
||||
self.showAllDescendants()
|
||||
|
@ -475,6 +475,36 @@ class LevelEditor(NodePath, PandaObject):
|
||||
self.accept('handleMouse3',self.levelHandleMouse3)
|
||||
self.accept('handleMouse3Up',self.levelHandleMouse3Up)
|
||||
|
||||
def useDriveMode(self):
|
||||
pos = base.camera.getPos()
|
||||
pos.setZ(4.0)
|
||||
hpr = base.camera.getHpr()
|
||||
hpr.set(hpr[0], 0.0, 0.0)
|
||||
t = base.camera.lerpPosHpr(pos, hpr, 1.0, blendType = 'easeInOut',
|
||||
task = 'manipulateCamera')
|
||||
# Note, if this dies an unatural death, this could screw things up
|
||||
t.uponDeath = self.switchToDriveMode
|
||||
|
||||
def switchToDriveMode(self,state):
|
||||
self.direct.minimumConfiguration()
|
||||
self.disableManipulation()
|
||||
base.useDrive()
|
||||
# Make sure we're where we want to be
|
||||
pos = base.camera.getPos()
|
||||
pos.setZ(4.0)
|
||||
hpr = base.camera.getHpr()
|
||||
hpr.set(hpr[0], 0.0, 0.0)
|
||||
# Fine tune the drive mode
|
||||
base.mouseInterface.getBottomNode().setPos(pos)
|
||||
base.mouseInterface.getBottomNode().setHpr(hpr)
|
||||
base.mouseInterface.getBottomNode().setForwardSpeed(20.0)
|
||||
base.mouseInterface.getBottomNode().setReverseSpeed(20.0)
|
||||
|
||||
def useDirectFly(self):
|
||||
base.disableMouse()
|
||||
self.enableManipulation()
|
||||
self.direct.enable()
|
||||
|
||||
def useToontownCentralColors(self):
|
||||
self.attributeDictionary['wallColors'] = (
|
||||
self.colorPaletteDictionary['toontownCentralWallColors'])
|
||||
@ -613,6 +643,10 @@ class LevelEditor(NodePath, PandaObject):
|
||||
def setHprSnap(self,flag):
|
||||
self.hprSnap = flag
|
||||
|
||||
def isolateSelectedNodePath(self):
|
||||
if self.direct.selected.last:
|
||||
self.isolateNodePath(self.direct.selected.last)
|
||||
|
||||
def isolateNodePath(self,aNodePath):
|
||||
# First show everything in level
|
||||
self.levelObjects.showAllDescendants()
|
||||
@ -1477,7 +1511,8 @@ class LevelEditor(NodePath, PandaObject):
|
||||
dictionary = self.createStyleDictionaryFromFile(
|
||||
'level_editor/minniesMelodyLandStyles.txt')
|
||||
# Store this dictionary in the self.attributeDictionary
|
||||
self.attributeDictionary['minniesMelodyLandStyleDictionary'] = dictionary
|
||||
self.attributeDictionary['minniesMelodyLandStyleDictionary'] = (
|
||||
dictionary)
|
||||
|
||||
# Record active style dictionary
|
||||
self.styleDictionary = (
|
||||
@ -2241,7 +2276,8 @@ class LevelEditor(NodePath, PandaObject):
|
||||
|
||||
def outputDNA(self,filename):
|
||||
print 'Saving DNA to: ', filename
|
||||
self.levelObjectsDNA.writeDna(Filename(filename),Notify.out(),self.dnaStore)
|
||||
self.levelObjectsDNA.writeDna(Filename(filename),
|
||||
Notify.out(),self.dnaStore)
|
||||
|
||||
def preRemoveNodePath(self, aNodePath):
|
||||
# Remove nodePath's DNA from its parent
|
||||
@ -2951,7 +2987,8 @@ class LevelEditorPanel(Pmw.MegaToplevel):
|
||||
command = self.toggleBalloon)
|
||||
|
||||
self.editMenu = Pmw.ComboBox(
|
||||
menuFrame, labelpos = W, label_text = 'Edit:', entry_width = 12,
|
||||
menuFrame, labelpos = W,
|
||||
label_text = 'Edit Mode:', entry_width = 12,
|
||||
selectioncommand = self.chooseNeighborhood, history = 0,
|
||||
scrolledlist_items = ['Toontown Central', 'Donalds Dock',
|
||||
'The Burrrgh', 'Minnies Melody Land'])
|
||||
@ -3119,18 +3156,49 @@ class LevelEditorPanel(Pmw.MegaToplevel):
|
||||
buttonFrame2 = Frame(hull)
|
||||
self.groupButton = Button(
|
||||
buttonFrame2,
|
||||
text = 'New level group',
|
||||
text = 'New group',
|
||||
command = self.levelEditor.createNewLevelGroup)
|
||||
self.groupButton.pack(side = 'left', expand = 1, fill = 'x')
|
||||
|
||||
self.saveButton = Button(
|
||||
buttonFrame2,
|
||||
text = 'Set Group Parent',
|
||||
command = self.levelEditor.setGroupParentToSelected())
|
||||
text = 'Set Parent',
|
||||
command = self.levelEditor.setGroupParentToSelected)
|
||||
self.saveButton.pack(side = 'left', expand = 1, fill = 'x')
|
||||
|
||||
self.isolateButton = Button(
|
||||
buttonFrame2,
|
||||
text = 'Isolate Selected',
|
||||
command = self.levelEditor.isolateSelectedNodePath)
|
||||
self.isolateButton.pack(side = 'left', expand = 1, fill = 'x')
|
||||
|
||||
self.showAllButton = Button(
|
||||
buttonFrame2,
|
||||
text = 'Show All',
|
||||
command = self.levelEditor.showAll)
|
||||
self.showAllButton.pack(side = 'left', expand = 1, fill = 'x')
|
||||
|
||||
buttonFrame2.pack(fill = 'x')
|
||||
|
||||
buttonFrame3 = Frame(hull)
|
||||
self.driveMode = IntVar()
|
||||
self.driveMode.set(1)
|
||||
self.driveModeButton = Radiobutton(
|
||||
buttonFrame3,
|
||||
text = 'Drive Mode',
|
||||
value = 0,
|
||||
variable = self.driveMode,
|
||||
command = self.levelEditor.useDriveMode)
|
||||
self.driveModeButton.pack(side = 'left', expand = 1, fill = 'x')
|
||||
self.directModeButton = Radiobutton(
|
||||
buttonFrame3,
|
||||
text = 'DIRECT Fly',
|
||||
value = 1,
|
||||
variable = self.driveMode,
|
||||
command = self.levelEditor.useDirectFly)
|
||||
self.directModeButton.pack(side = 'left', expand = 1, fill = 'x')
|
||||
buttonFrame3.pack(fill = 'x')
|
||||
|
||||
self.sceneGraphExplorer = SceneGraphExplorer(
|
||||
parent = sceneGraphPage,
|
||||
root = self.levelEditor.getLevelObjects())
|
||||
|
@ -109,6 +109,9 @@ class SceneGraphExplorerItem(TreeItem):
|
||||
sublist.append(item)
|
||||
return sublist
|
||||
|
||||
def OnSelect(self):
|
||||
messenger.send('SGESelectNodePath', [self.nodePath])
|
||||
|
||||
def MenuCommand(self, command):
|
||||
if (command == 'Select Node'):
|
||||
messenger.send('SGESelectNodePath', [self.nodePath])
|
||||
|
@ -113,8 +113,7 @@ class TreeNode:
|
||||
self.item.OnDoubleClick()
|
||||
return "break"
|
||||
|
||||
def selectAndPopupMenu(self, event=None):
|
||||
self.select()
|
||||
def popupMenu(self, event=None):
|
||||
if self._popupMenu:
|
||||
self._popupMenu.post(event.widget.winfo_pointerx(),
|
||||
event.widget.winfo_pointery())
|
||||
@ -233,7 +232,7 @@ class TreeNode:
|
||||
self.image_id = id
|
||||
self.canvas.tag_bind(id, "<1>", self.select)
|
||||
self.canvas.tag_bind(id, "<Double-1>", self.flip)
|
||||
self.canvas.tag_bind(id, "<3>", self.selectAndPopupMenu)
|
||||
self.canvas.tag_bind(id, "<3>", self.popupMenu)
|
||||
|
||||
def drawtext(self):
|
||||
textx = self.x+20-1
|
||||
@ -244,7 +243,6 @@ class TreeNode:
|
||||
text=labeltext)
|
||||
self.canvas.tag_bind(id, "<1>", self.select)
|
||||
self.canvas.tag_bind(id, "<Double-1>", self.flip)
|
||||
self.canvas.tag_bind(id, "<3>", self.selectAndPopupMenu)
|
||||
x0, y0, x1, y1 = self.canvas.bbox(id)
|
||||
textx = max(x1, 200) + 10
|
||||
text = self.item.GetText() or "<no text>"
|
||||
@ -267,6 +265,7 @@ class TreeNode:
|
||||
anchor="nw", window=self.label)
|
||||
self.label.bind("<1>", self.select_or_edit)
|
||||
self.label.bind("<Double-1>", self.flip)
|
||||
self.label.bind("<3>", self.popupMenu)
|
||||
self.text_id = id
|
||||
|
||||
def select_or_edit(self, event=None):
|
||||
|
Loading…
x
Reference in New Issue
Block a user