From 720bcc2e285b5fb379523363a48e7b37cd7b626e Mon Sep 17 00:00:00 2001 From: Mark Mine Date: Wed, 31 Jan 2001 21:58:39 +0000 Subject: [PATCH] *** empty log message *** --- direct/src/directtools/DirectManipulation.py | 3 +++ direct/src/directtools/DirectSession.py | 2 +- direct/src/leveleditor/LevelEditor.py | 23 ++++++++++++-------- direct/src/tkpanels/ParticlePanel.py | 6 ++++- 4 files changed, 23 insertions(+), 11 deletions(-) diff --git a/direct/src/directtools/DirectManipulation.py b/direct/src/directtools/DirectManipulation.py index bc9be31ada..030b204210 100644 --- a/direct/src/directtools/DirectManipulation.py +++ b/direct/src/directtools/DirectManipulation.py @@ -543,6 +543,9 @@ class ObjectHandles(NodePath,PandaObject): if self.fActive: self.reparentTo(direct.group) + def showWidget(self): + self.reparentTo(direct.group) + def hideWidget(self): self.reparentTo(hidden) diff --git a/direct/src/directtools/DirectSession.py b/direct/src/directtools/DirectSession.py index 9011c293bd..51918d24a5 100644 --- a/direct/src/directtools/DirectSession.py +++ b/direct/src/directtools/DirectSession.py @@ -242,7 +242,7 @@ class DirectSession(PandaObject): self.readout.reparentTo(render2d) self.readout.setText(dnp.name) # Show the manipulation widget - self.widget.showWidgetIfActive() + self.widget.showWidget() # Update camera controls coa to this point # Coa2Camera = Coa2Dnp * Dnp2Camera mCoa2Camera = dnp.mCoa2Dnp * dnp.getMat(self.camera) diff --git a/direct/src/leveleditor/LevelEditor.py b/direct/src/leveleditor/LevelEditor.py index 609eeedd28..4004843575 100644 --- a/direct/src/leveleditor/LevelEditor.py +++ b/direct/src/leveleditor/LevelEditor.py @@ -363,7 +363,7 @@ class LevelEditor(NodePath, PandaObject): if fDeleteToplevel: # First destroy existing scene-graph/DNA hierarchy self.deleteToplevel() - + # Clear DNASTORE DNASTORE.resetDNAGroups() # Reset DNA VIS Groups @@ -394,6 +394,8 @@ class LevelEditor(NodePath, PandaObject): self.lastBuilding = None # Code of last selected object (for autopositionGrid) self.snapList = [] + # Last menu used + self.activeMenu = None def deleteToplevel(self): # Destory old toplevel node path and DNA @@ -708,6 +710,10 @@ class LevelEditor(NodePath, PandaObject): # self.panel.sceneGraphExplorer.update() # Position it + # First kill autoposition task so grid can jump to its final + # destination (part of cleanup + taskMgr.removeTasksNamed('autoPositionGrid') + # Now find where to put node path if (hotKey is not None) & nodeClass.eq(DNA_PROP): # If its a prop and a copy, place it based upon current # mouse position @@ -946,7 +952,7 @@ class LevelEditor(NodePath, PandaObject): def getFlatBuildingMode(self, dnaObject): # Where are we hitting the building? - hitPt = self.getWallIntersectionPoint() + hitPt = self.getWallIntersectionPoint(self.selectedNPRoot) wallNum = self.computeWallNum(dnaObject, hitPt) if wallNum < 0: # Do building related operations @@ -1145,13 +1151,15 @@ class LevelEditor(NodePath, PandaObject): direct.deselect(nodePath) # And select parent direct.select(dnaParent, direct.fShift) - else: + elif dnaNode: # We got a valid node path/DNA object, continue self.selectedNPRoot = nodePath self.selectedDNARoot = dnaNode # Reset last Code (for autoPositionGrid) if DNAClassEqual(dnaNode, DNA_STREET): self.snapList = OBJECT_SNAP_POINTS[dnaNode.getCode()] + else: + pass def deselectedNodePathHook(self, nodePath): # Clear out old root variables @@ -1366,6 +1374,7 @@ class LevelEditor(NodePath, PandaObject): return 1 def autoPositionGrid(self): + taskMgr.removeTasksNamed('autoPositionGrid') # Move grid to prepare for placement of next object selectedNode = direct.selected.last if selectedNode: @@ -1393,7 +1402,6 @@ class LevelEditor(NodePath, PandaObject): # Position grid for placing next object # Eventually we need to setHpr too - taskMgr.removeTasksNamed('autoPositionGrid') t = direct.grid.lerpPosHpr( deltaPos, deltaHpr, 0.25, other = selectedNode, @@ -1430,14 +1438,11 @@ class LevelEditor(NodePath, PandaObject): else: return (ZERO_VEC, ZERO_VEC) - def getWallIntersectionPoint(self): + def getWallIntersectionPoint(self, selectedNode): """ Return point of intersection between building's wall and line from cam - through mouse. Return false, if nothing selected + through mouse. """ - selectedNode = direct.selected.last - if not selectedNode: - return 0 # Find mouse point on near plane mouseX = direct.dr.mouseX mouseY = direct.dr.mouseY diff --git a/direct/src/tkpanels/ParticlePanel.py b/direct/src/tkpanels/ParticlePanel.py index f991a2e586..9a132e1886 100644 --- a/direct/src/tkpanels/ParticlePanel.py +++ b/direct/src/tkpanels/ParticlePanel.py @@ -963,7 +963,11 @@ class ParticlePanel(AppShell): def loadParticleEffectFromFile(self): # Find path to particle directory - path = getParticlePath().getDirectory(0).toOsSpecific() + pPath = getParticlePath() + if pPath.getNumDirectories() > 0: + path = pPath.getDirectory(0).toOsSpecific() + else: + path = '' if not os.path.isdir(path): print 'LevelEditor Warning: Invalid default DNA directory!' print 'Using: C:\\'