mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-29 16:20:11 -04:00
*** empty log message ***
This commit is contained in:
parent
2c413301ae
commit
8ea95d6633
@ -197,8 +197,12 @@ class DirectBoundingBox:
|
|||||||
|
|
||||||
def computeBounds(self):
|
def computeBounds(self):
|
||||||
self.bounds = self.nodePath.getBounds()
|
self.bounds = self.nodePath.getBounds()
|
||||||
self.center = self.bounds.getCenter()
|
if self.bounds.isEmpty():
|
||||||
self.radius = self.bounds.getRadius()
|
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.min = Point3(self.center - Point3(self.radius))
|
||||||
self.max = Point3(self.center + Point3(self.radius))
|
self.max = Point3(self.center + Point3(self.radius))
|
||||||
|
|
||||||
|
@ -37,18 +37,18 @@
|
|||||||
|
|
||||||
def showSiblings(self):
|
def showSiblings(self):
|
||||||
for sib in self.getParent().getChildrenAsList():
|
for sib in self.getParent().getChildrenAsList():
|
||||||
if sib != self:
|
if sib.node() != self.node():
|
||||||
sib.show()
|
sib.show()
|
||||||
|
|
||||||
def hideSiblings(self):
|
def hideSiblings(self):
|
||||||
for sib in self.getParent().getChildrenAsList():
|
for sib in self.getParent().getChildrenAsList():
|
||||||
if sib != aNodePath:
|
if sib.node() != self.node():
|
||||||
sib.hide()
|
sib.hide()
|
||||||
|
|
||||||
def showAllDescendants(self):
|
def showAllDescendants(self):
|
||||||
self.show()
|
self.show()
|
||||||
for child in self.getChildrenAsList():
|
for child in self.getChildrenAsList():
|
||||||
self.showAllDescendants(child)
|
child.showAllDescendants()
|
||||||
|
|
||||||
def isolate(self):
|
def isolate(self):
|
||||||
self.showAllDescendants()
|
self.showAllDescendants()
|
||||||
|
@ -475,6 +475,36 @@ class LevelEditor(NodePath, PandaObject):
|
|||||||
self.accept('handleMouse3',self.levelHandleMouse3)
|
self.accept('handleMouse3',self.levelHandleMouse3)
|
||||||
self.accept('handleMouse3Up',self.levelHandleMouse3Up)
|
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):
|
def useToontownCentralColors(self):
|
||||||
self.attributeDictionary['wallColors'] = (
|
self.attributeDictionary['wallColors'] = (
|
||||||
self.colorPaletteDictionary['toontownCentralWallColors'])
|
self.colorPaletteDictionary['toontownCentralWallColors'])
|
||||||
@ -613,6 +643,10 @@ class LevelEditor(NodePath, PandaObject):
|
|||||||
def setHprSnap(self,flag):
|
def setHprSnap(self,flag):
|
||||||
self.hprSnap = flag
|
self.hprSnap = flag
|
||||||
|
|
||||||
|
def isolateSelectedNodePath(self):
|
||||||
|
if self.direct.selected.last:
|
||||||
|
self.isolateNodePath(self.direct.selected.last)
|
||||||
|
|
||||||
def isolateNodePath(self,aNodePath):
|
def isolateNodePath(self,aNodePath):
|
||||||
# First show everything in level
|
# First show everything in level
|
||||||
self.levelObjects.showAllDescendants()
|
self.levelObjects.showAllDescendants()
|
||||||
@ -1477,7 +1511,8 @@ class LevelEditor(NodePath, PandaObject):
|
|||||||
dictionary = self.createStyleDictionaryFromFile(
|
dictionary = self.createStyleDictionaryFromFile(
|
||||||
'level_editor/minniesMelodyLandStyles.txt')
|
'level_editor/minniesMelodyLandStyles.txt')
|
||||||
# Store this dictionary in the self.attributeDictionary
|
# Store this dictionary in the self.attributeDictionary
|
||||||
self.attributeDictionary['minniesMelodyLandStyleDictionary'] = dictionary
|
self.attributeDictionary['minniesMelodyLandStyleDictionary'] = (
|
||||||
|
dictionary)
|
||||||
|
|
||||||
# Record active style dictionary
|
# Record active style dictionary
|
||||||
self.styleDictionary = (
|
self.styleDictionary = (
|
||||||
@ -2241,7 +2276,8 @@ class LevelEditor(NodePath, PandaObject):
|
|||||||
|
|
||||||
def outputDNA(self,filename):
|
def outputDNA(self,filename):
|
||||||
print 'Saving DNA to: ', 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):
|
def preRemoveNodePath(self, aNodePath):
|
||||||
# Remove nodePath's DNA from its parent
|
# Remove nodePath's DNA from its parent
|
||||||
@ -2951,7 +2987,8 @@ class LevelEditorPanel(Pmw.MegaToplevel):
|
|||||||
command = self.toggleBalloon)
|
command = self.toggleBalloon)
|
||||||
|
|
||||||
self.editMenu = Pmw.ComboBox(
|
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,
|
selectioncommand = self.chooseNeighborhood, history = 0,
|
||||||
scrolledlist_items = ['Toontown Central', 'Donalds Dock',
|
scrolledlist_items = ['Toontown Central', 'Donalds Dock',
|
||||||
'The Burrrgh', 'Minnies Melody Land'])
|
'The Burrrgh', 'Minnies Melody Land'])
|
||||||
@ -3119,18 +3156,49 @@ class LevelEditorPanel(Pmw.MegaToplevel):
|
|||||||
buttonFrame2 = Frame(hull)
|
buttonFrame2 = Frame(hull)
|
||||||
self.groupButton = Button(
|
self.groupButton = Button(
|
||||||
buttonFrame2,
|
buttonFrame2,
|
||||||
text = 'New level group',
|
text = 'New group',
|
||||||
command = self.levelEditor.createNewLevelGroup)
|
command = self.levelEditor.createNewLevelGroup)
|
||||||
self.groupButton.pack(side = 'left', expand = 1, fill = 'x')
|
self.groupButton.pack(side = 'left', expand = 1, fill = 'x')
|
||||||
|
|
||||||
self.saveButton = Button(
|
self.saveButton = Button(
|
||||||
buttonFrame2,
|
buttonFrame2,
|
||||||
text = 'Set Group Parent',
|
text = 'Set Parent',
|
||||||
command = self.levelEditor.setGroupParentToSelected())
|
command = self.levelEditor.setGroupParentToSelected)
|
||||||
self.saveButton.pack(side = 'left', expand = 1, fill = 'x')
|
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')
|
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(
|
self.sceneGraphExplorer = SceneGraphExplorer(
|
||||||
parent = sceneGraphPage,
|
parent = sceneGraphPage,
|
||||||
root = self.levelEditor.getLevelObjects())
|
root = self.levelEditor.getLevelObjects())
|
||||||
|
@ -109,6 +109,9 @@ class SceneGraphExplorerItem(TreeItem):
|
|||||||
sublist.append(item)
|
sublist.append(item)
|
||||||
return sublist
|
return sublist
|
||||||
|
|
||||||
|
def OnSelect(self):
|
||||||
|
messenger.send('SGESelectNodePath', [self.nodePath])
|
||||||
|
|
||||||
def MenuCommand(self, command):
|
def MenuCommand(self, command):
|
||||||
if (command == 'Select Node'):
|
if (command == 'Select Node'):
|
||||||
messenger.send('SGESelectNodePath', [self.nodePath])
|
messenger.send('SGESelectNodePath', [self.nodePath])
|
||||||
|
@ -113,8 +113,7 @@ class TreeNode:
|
|||||||
self.item.OnDoubleClick()
|
self.item.OnDoubleClick()
|
||||||
return "break"
|
return "break"
|
||||||
|
|
||||||
def selectAndPopupMenu(self, event=None):
|
def popupMenu(self, event=None):
|
||||||
self.select()
|
|
||||||
if self._popupMenu:
|
if self._popupMenu:
|
||||||
self._popupMenu.post(event.widget.winfo_pointerx(),
|
self._popupMenu.post(event.widget.winfo_pointerx(),
|
||||||
event.widget.winfo_pointery())
|
event.widget.winfo_pointery())
|
||||||
@ -233,7 +232,7 @@ class TreeNode:
|
|||||||
self.image_id = id
|
self.image_id = id
|
||||||
self.canvas.tag_bind(id, "<1>", self.select)
|
self.canvas.tag_bind(id, "<1>", self.select)
|
||||||
self.canvas.tag_bind(id, "<Double-1>", self.flip)
|
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):
|
def drawtext(self):
|
||||||
textx = self.x+20-1
|
textx = self.x+20-1
|
||||||
@ -244,7 +243,6 @@ class TreeNode:
|
|||||||
text=labeltext)
|
text=labeltext)
|
||||||
self.canvas.tag_bind(id, "<1>", self.select)
|
self.canvas.tag_bind(id, "<1>", self.select)
|
||||||
self.canvas.tag_bind(id, "<Double-1>", self.flip)
|
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)
|
x0, y0, x1, y1 = self.canvas.bbox(id)
|
||||||
textx = max(x1, 200) + 10
|
textx = max(x1, 200) + 10
|
||||||
text = self.item.GetText() or "<no text>"
|
text = self.item.GetText() or "<no text>"
|
||||||
@ -267,6 +265,7 @@ class TreeNode:
|
|||||||
anchor="nw", window=self.label)
|
anchor="nw", window=self.label)
|
||||||
self.label.bind("<1>", self.select_or_edit)
|
self.label.bind("<1>", self.select_or_edit)
|
||||||
self.label.bind("<Double-1>", self.flip)
|
self.label.bind("<Double-1>", self.flip)
|
||||||
|
self.label.bind("<3>", self.popupMenu)
|
||||||
self.text_id = id
|
self.text_id = id
|
||||||
|
|
||||||
def select_or_edit(self, event=None):
|
def select_or_edit(self, event=None):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user