Changes to support new panda
This commit is contained in:
parent
2f5ba8186a
commit
a9928bad55
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue