From a9928bad55d18d3bc474077177e075e1dba07465 Mon Sep 17 00:00:00 2001 From: Mark Mine Date: Sun, 7 Apr 2002 21:34:18 +0000 Subject: [PATCH] Changes to support new panda --- direct/src/directtools/DirectCameraControl.py | 26 +++++++------------ direct/src/directtools/DirectManipulation.py | 4 +-- direct/src/directtools/DirectSelection.py | 12 ++++----- 3 files changed, 17 insertions(+), 25 deletions(-) diff --git a/direct/src/directtools/DirectCameraControl.py b/direct/src/directtools/DirectCameraControl.py index 5b4feb8b82..f4a5292877 100644 --- a/direct/src/directtools/DirectCameraControl.py +++ b/direct/src/directtools/DirectCameraControl.py @@ -32,11 +32,11 @@ class DirectCameraControl(PandaObject): ['c', self.centerCamIn, 0.5], ['f', self.fitOnWidget], ['h', self.homeCam], - ['V', self.toggleMarkerVis], + ['shift-v', self.toggleMarkerVis], ['m', self.moveToFit], ['n', self.pickNextCOA], ['u', self.orbitUprightCam], - ['U', self.uprightCam], + ['shift-u', self.uprightCam], [`1`, self.spawnMoveToView, 1], [`2`, self.spawnMoveToView, 2], [`3`, self.spawnMoveToView, 3], @@ -235,7 +235,8 @@ class DirectCameraControl(PandaObject): self.camManipRef.setPos(self.coaMarkerPos) self.camManipRef.setHpr(direct.camera, ZERO_POINT) else: - wrtMat = direct.camera.getMat( self.camManipRef ) + wrtMat = Mat4() + wrtMat.assign(direct.camera.getMat( self.camManipRef )) self.camManipRef.setHpr(self.camManipRef, (-1 * deltaX * 180.0), (deltaY * 180.0), @@ -252,7 +253,9 @@ class DirectCameraControl(PandaObject): t = Task.Task(self.mouseRollTask) t.coaCenter = getScreenXY(self.coaMarker) t.lastAngle = getCrankAngle(t.coaCenter) - t.wrtMat = direct.camera.getMat( self.camManipRef ) + # Get a copy of the camera/manipRef offset matrix + t.wrtMat = Mat4() + t.wrtMat.assign(direct.camera.getMat( self.camManipRef )) taskMgr.add(t, 'manipulateCamera') def mouseRollTask(self, state): @@ -260,23 +263,11 @@ class DirectCameraControl(PandaObject): angle = getCrankAngle(state.coaCenter) deltaAngle = angle - state.lastAngle state.lastAngle = angle - if deltaAngle != 0.0: - print deltaAngle - print 'cam Manip before' - print self.camManipRef.getMat() if base.config.GetBool('temp-hpr-fix',0): self.camManipRef.setHpr(self.camManipRef, 0, 0, deltaAngle) else: self.camManipRef.setHpr(self.camManipRef, 0, 0, -deltaAngle) - print 'cam Manip after' - print self.camManipRef.getMat() - print 'direct camera before' - print direct.camera.getMat() direct.camera.setMat(self.camManipRef, wrtMat) - print 'direct camera after' - print direct.camera.getMat() - print - print return Task.cont def lockCOA(self): @@ -413,7 +404,8 @@ class DirectCameraControl(PandaObject): # Record undo point direct.pushUndo([direct.camera]) # Transform camera z axis to render space - mCam2Render = direct.camera.getMat(render) + mCam2Render = Mat4() + mCam2Render.assign(direct.camera.getMat(render)) zAxis = Vec3(mCam2Render.xformVec(Z_AXIS)) zAxis.normalize() # Compute rotation angle needed to upright cam diff --git a/direct/src/directtools/DirectManipulation.py b/direct/src/directtools/DirectManipulation.py index f08562f056..2ac9687d1b 100644 --- a/direct/src/directtools/DirectManipulation.py +++ b/direct/src/directtools/DirectManipulation.py @@ -31,7 +31,7 @@ class DirectManipulationControl(PandaObject): ['>', self.objectHandles.multiplyScalingFactorBy, 2.0], [',', self.objectHandles.multiplyScalingFactorBy, 0.5], ['<', self.objectHandles.multiplyScalingFactorBy, 0.5], - ['F', self.objectHandles.growToFit], + ['shift-f', self.objectHandles.growToFit], ['i', self.plantSelectedNodePath], ] @@ -98,7 +98,7 @@ class DirectManipulationControl(PandaObject): self.hitPt.assign(hitPt) self.hitPtDist = hitPtDist # Find the node path from the node found above - nodePath = render.findAllPathsTo(node)[0] + nodePath = render.findPathTo(node) # Select it direct.select(nodePath, direct.fShift) else: diff --git a/direct/src/directtools/DirectSelection.py b/direct/src/directtools/DirectSelection.py index 80b0a8603b..1fb2ddb963 100644 --- a/direct/src/directtools/DirectSelection.py +++ b/direct/src/directtools/DirectSelection.py @@ -408,10 +408,10 @@ class SelectionRay: for i in range(0,self.numEntries): entry = self.cq.getEntry(i) node = entry.getIntoNode() - nodePath = render.findAllPathsTo(node)[0] + nodePath = NodePath(node) # Don't pick hidden nodes - #if node.isHidden(): - #pass + if nodePath.isHidden(): + pass if fIgnoreCamera and (direct.camera in nodePath.getAncestry()): # This avoids things parented to a camera. Good idea? pass @@ -499,10 +499,10 @@ class SelectionRay: for i in range(0,numEntries): entry = self.cq.getEntry(i) node = entry.getIntoNode() + nodePath = NodePath(node) # Don't pick hidden nodes - # MRM: Doesn't work in new panda for GeomNodes - #if node.isHidden(): - #pass + if nodePath.isHidden(): + pass # Can pick unpickable, use the first visible node if fIntersectUnpickable: self.cqIndex = i