|
@@ -84,7 +84,7 @@ class DirectCameraControl(PandaObject):
|
|
|
self.spawnMouseRotateTask()
|
|
self.spawnMouseRotateTask()
|
|
|
|
|
|
|
|
def mouseFlyStop(self):
|
|
def mouseFlyStop(self):
|
|
|
- taskMgr.removeTasksNamed('manipulateCamera')
|
|
|
|
|
|
|
+ taskMgr.remove('manipulateCamera')
|
|
|
stopT = globalClock.getFrameTime()
|
|
stopT = globalClock.getFrameTime()
|
|
|
deltaT = stopT - self.startT
|
|
deltaT = stopT - self.startT
|
|
|
stopF = globalClock.getFrameCount()
|
|
stopF = globalClock.getFrameCount()
|
|
@@ -111,39 +111,39 @@ class DirectCameraControl(PandaObject):
|
|
|
|
|
|
|
|
def spawnXZTranslateOrHPanYZoom(self):
|
|
def spawnXZTranslateOrHPanYZoom(self):
|
|
|
# Kill any existing tasks
|
|
# Kill any existing tasks
|
|
|
- taskMgr.removeTasksNamed('manipulateCamera')
|
|
|
|
|
|
|
+ taskMgr.remove('manipulateCamera')
|
|
|
# Spawn the new task
|
|
# Spawn the new task
|
|
|
t = Task.Task(self.XZTranslateOrHPanYZoomTask)
|
|
t = Task.Task(self.XZTranslateOrHPanYZoomTask)
|
|
|
# For HPanYZoom
|
|
# For HPanYZoom
|
|
|
t.zoomSF = Vec3(self.coaMarker.getPos(direct.camera)).length()
|
|
t.zoomSF = Vec3(self.coaMarker.getPos(direct.camera)).length()
|
|
|
- taskMgr.spawnTaskNamed(t, 'manipulateCamera')
|
|
|
|
|
|
|
+ taskMgr.add(t, 'manipulateCamera')
|
|
|
|
|
|
|
|
def spawnXZTranslateOrHPPan(self):
|
|
def spawnXZTranslateOrHPPan(self):
|
|
|
# Kill any existing tasks
|
|
# Kill any existing tasks
|
|
|
- taskMgr.removeTasksNamed('manipulateCamera')
|
|
|
|
|
|
|
+ taskMgr.remove('manipulateCamera')
|
|
|
# Spawn new task
|
|
# Spawn new task
|
|
|
- taskMgr.spawnMethodNamed(self.XZTranslateOrHPPanTask,
|
|
|
|
|
- 'manipulateCamera')
|
|
|
|
|
|
|
+ taskMgr.add(self.XZTranslateOrHPPanTask,
|
|
|
|
|
+ 'manipulateCamera')
|
|
|
|
|
|
|
|
def spawnXZTranslate(self):
|
|
def spawnXZTranslate(self):
|
|
|
# Kill any existing tasks
|
|
# Kill any existing tasks
|
|
|
- taskMgr.removeTasksNamed('manipulateCamera')
|
|
|
|
|
|
|
+ taskMgr.remove('manipulateCamera')
|
|
|
# Spawn new task
|
|
# Spawn new task
|
|
|
- taskMgr.spawnMethodNamed(self.XZTranslateTask, 'manipulateCamera')
|
|
|
|
|
|
|
+ taskMgr.add(self.XZTranslateTask, 'manipulateCamera')
|
|
|
|
|
|
|
|
def spawnHPanYZoom(self):
|
|
def spawnHPanYZoom(self):
|
|
|
# Kill any existing tasks
|
|
# Kill any existing tasks
|
|
|
- taskMgr.removeTasksNamed('manipulateCamera')
|
|
|
|
|
|
|
+ taskMgr.remove('manipulateCamera')
|
|
|
# Spawn new task
|
|
# Spawn new task
|
|
|
t = Task.Task(self.HPanYZoomTask)
|
|
t = Task.Task(self.HPanYZoomTask)
|
|
|
t.zoomSF = Vec3(self.coaMarker.getPos(direct.camera)).length()
|
|
t.zoomSF = Vec3(self.coaMarker.getPos(direct.camera)).length()
|
|
|
- taskMgr.spawnTaskNamed(t, 'manipulateCamera')
|
|
|
|
|
|
|
+ taskMgr.add(t, 'manipulateCamera')
|
|
|
|
|
|
|
|
def spawnHPPan(self):
|
|
def spawnHPPan(self):
|
|
|
# Kill any existing tasks
|
|
# Kill any existing tasks
|
|
|
- taskMgr.removeTasksNamed('manipulateCamera')
|
|
|
|
|
|
|
+ taskMgr.remove('manipulateCamera')
|
|
|
# Spawn new task
|
|
# Spawn new task
|
|
|
- taskMgr.spawnMethodNamed(self.HPPanTask, 'manipulateCamera')
|
|
|
|
|
|
|
+ taskMgr.add(self.HPPanTask, 'manipulateCamera')
|
|
|
|
|
|
|
|
def XZTranslateOrHPanYZoomTask(self, state):
|
|
def XZTranslateOrHPanYZoomTask(self, state):
|
|
|
if direct.fShift:
|
|
if direct.fShift:
|
|
@@ -205,7 +205,7 @@ class DirectCameraControl(PandaObject):
|
|
|
|
|
|
|
|
def spawnMouseRotateTask(self):
|
|
def spawnMouseRotateTask(self):
|
|
|
# Kill any existing tasks
|
|
# Kill any existing tasks
|
|
|
- taskMgr.removeTasksNamed('manipulateCamera')
|
|
|
|
|
|
|
+ taskMgr.remove('manipulateCamera')
|
|
|
# Set at markers position in render coordinates
|
|
# Set at markers position in render coordinates
|
|
|
self.camManipRef.setPos(self.coaMarkerPos)
|
|
self.camManipRef.setPos(self.coaMarkerPos)
|
|
|
self.camManipRef.setHpr(direct.camera, ZERO_POINT)
|
|
self.camManipRef.setHpr(direct.camera, ZERO_POINT)
|
|
@@ -214,7 +214,7 @@ class DirectCameraControl(PandaObject):
|
|
|
t.constrainedDir = 'y'
|
|
t.constrainedDir = 'y'
|
|
|
else:
|
|
else:
|
|
|
t.constrainedDir = 'x'
|
|
t.constrainedDir = 'x'
|
|
|
- taskMgr.spawnTaskNamed(t, 'manipulateCamera')
|
|
|
|
|
|
|
+ taskMgr.add(t, 'manipulateCamera')
|
|
|
|
|
|
|
|
def mouseRotateTask(self, state):
|
|
def mouseRotateTask(self, state):
|
|
|
# If moving outside of center, ignore motion perpendicular to edge
|
|
# If moving outside of center, ignore motion perpendicular to edge
|
|
@@ -245,7 +245,7 @@ class DirectCameraControl(PandaObject):
|
|
|
|
|
|
|
|
def spawnMouseRollTask(self):
|
|
def spawnMouseRollTask(self):
|
|
|
# Kill any existing tasks
|
|
# Kill any existing tasks
|
|
|
- taskMgr.removeTasksNamed('manipulateCamera')
|
|
|
|
|
|
|
+ taskMgr.remove('manipulateCamera')
|
|
|
# Set at markers position in render coordinates
|
|
# Set at markers position in render coordinates
|
|
|
self.camManipRef.setPos(self.coaMarkerPos)
|
|
self.camManipRef.setPos(self.coaMarkerPos)
|
|
|
self.camManipRef.setHpr(direct.camera, ZERO_POINT)
|
|
self.camManipRef.setHpr(direct.camera, ZERO_POINT)
|
|
@@ -253,7 +253,7 @@ class DirectCameraControl(PandaObject):
|
|
|
t.coaCenter = getScreenXY(self.coaMarker)
|
|
t.coaCenter = getScreenXY(self.coaMarker)
|
|
|
t.lastAngle = getCrankAngle(t.coaCenter)
|
|
t.lastAngle = getCrankAngle(t.coaCenter)
|
|
|
t.wrtMat = direct.camera.getMat( self.camManipRef )
|
|
t.wrtMat = direct.camera.getMat( self.camManipRef )
|
|
|
- taskMgr.spawnTaskNamed(t, 'manipulateCamera')
|
|
|
|
|
|
|
+ taskMgr.add(t, 'manipulateCamera')
|
|
|
|
|
|
|
|
def mouseRollTask(self, state):
|
|
def mouseRollTask(self, state):
|
|
|
wrtMat = state.wrtMat
|
|
wrtMat = state.wrtMat
|
|
@@ -383,7 +383,7 @@ class DirectCameraControl(PandaObject):
|
|
|
self.updateCoaMarkerSize()
|
|
self.updateCoaMarkerSize()
|
|
|
|
|
|
|
|
def uprightCam(self):
|
|
def uprightCam(self):
|
|
|
- taskMgr.removeTasksNamed('manipulateCamera')
|
|
|
|
|
|
|
+ taskMgr.remove('manipulateCamera')
|
|
|
# Record undo point
|
|
# Record undo point
|
|
|
direct.pushUndo([direct.camera])
|
|
direct.pushUndo([direct.camera])
|
|
|
# Pitch camera till upright
|
|
# Pitch camera till upright
|
|
@@ -395,7 +395,7 @@ class DirectCameraControl(PandaObject):
|
|
|
task = 'manipulateCamera')
|
|
task = 'manipulateCamera')
|
|
|
|
|
|
|
|
def orbitUprightCam(self):
|
|
def orbitUprightCam(self):
|
|
|
- taskMgr.removeTasksNamed('manipulateCamera')
|
|
|
|
|
|
|
+ taskMgr.remove('manipulateCamera')
|
|
|
# Record undo point
|
|
# Record undo point
|
|
|
direct.pushUndo([direct.camera])
|
|
direct.pushUndo([direct.camera])
|
|
|
# Transform camera z axis to render space
|
|
# Transform camera z axis to render space
|
|
@@ -439,7 +439,7 @@ class DirectCameraControl(PandaObject):
|
|
|
self.centerCamIn(0.)
|
|
self.centerCamIn(0.)
|
|
|
|
|
|
|
|
def centerCamIn(self, t):
|
|
def centerCamIn(self, t):
|
|
|
- taskMgr.removeTasksNamed('manipulateCamera')
|
|
|
|
|
|
|
+ taskMgr.remove('manipulateCamera')
|
|
|
# Record undo point
|
|
# Record undo point
|
|
|
direct.pushUndo([direct.camera])
|
|
direct.pushUndo([direct.camera])
|
|
|
# Determine marker location
|
|
# Determine marker location
|
|
@@ -456,7 +456,7 @@ class DirectCameraControl(PandaObject):
|
|
|
t.uponDeath = self.updateCoaMarkerSizeOnDeath
|
|
t.uponDeath = self.updateCoaMarkerSizeOnDeath
|
|
|
|
|
|
|
|
def zoomCam(self, zoomFactor, t):
|
|
def zoomCam(self, zoomFactor, t):
|
|
|
- taskMgr.removeTasksNamed('manipulateCamera')
|
|
|
|
|
|
|
+ taskMgr.remove('manipulateCamera')
|
|
|
# Record undo point
|
|
# Record undo point
|
|
|
direct.pushUndo([direct.camera])
|
|
direct.pushUndo([direct.camera])
|
|
|
# Find a point zoom factor times the current separation
|
|
# Find a point zoom factor times the current separation
|
|
@@ -474,7 +474,7 @@ class DirectCameraControl(PandaObject):
|
|
|
|
|
|
|
|
def spawnMoveToView(self, view):
|
|
def spawnMoveToView(self, view):
|
|
|
# Kill any existing tasks
|
|
# Kill any existing tasks
|
|
|
- taskMgr.removeTasksNamed('manipulateCamera')
|
|
|
|
|
|
|
+ taskMgr.remove('manipulateCamera')
|
|
|
# Record undo point
|
|
# Record undo point
|
|
|
direct.pushUndo([direct.camera])
|
|
direct.pushUndo([direct.camera])
|
|
|
# Calc hprOffset
|
|
# Calc hprOffset
|
|
@@ -525,7 +525,7 @@ class DirectCameraControl(PandaObject):
|
|
|
|
|
|
|
|
def swingCamAboutWidget(self, degrees, t):
|
|
def swingCamAboutWidget(self, degrees, t):
|
|
|
# Remove existing camera manipulation task
|
|
# Remove existing camera manipulation task
|
|
|
- taskMgr.removeTasksNamed('manipulateCamera')
|
|
|
|
|
|
|
+ taskMgr.remove('manipulateCamera')
|
|
|
|
|
|
|
|
# Record undo point
|
|
# Record undo point
|
|
|
direct.pushUndo([direct.camera])
|
|
direct.pushUndo([direct.camera])
|
|
@@ -553,7 +553,7 @@ class DirectCameraControl(PandaObject):
|
|
|
def fitOnWidget(self, nodePath = 'None Given'):
|
|
def fitOnWidget(self, nodePath = 'None Given'):
|
|
|
# Fit the node on the screen
|
|
# Fit the node on the screen
|
|
|
# stop any ongoing tasks
|
|
# stop any ongoing tasks
|
|
|
- taskMgr.removeTasksNamed('manipulateCamera')
|
|
|
|
|
|
|
+ taskMgr.remove('manipulateCamera')
|
|
|
# How big is the node?
|
|
# How big is the node?
|
|
|
nodeScale = direct.widget.scalingNode.getScale(render)
|
|
nodeScale = direct.widget.scalingNode.getScale(render)
|
|
|
maxScale = max(nodeScale[0],nodeScale[1],nodeScale[2])
|
|
maxScale = max(nodeScale[0],nodeScale[1],nodeScale[2])
|
|
@@ -601,16 +601,16 @@ class DirectCameraControl(PandaObject):
|
|
|
# Push state onto undo stack
|
|
# Push state onto undo stack
|
|
|
direct.pushUndo(direct.selected)
|
|
direct.pushUndo(direct.selected)
|
|
|
# Remove the task to keep the widget attached to the object
|
|
# Remove the task to keep the widget attached to the object
|
|
|
- taskMgr.removeTasksNamed('followSelectedNodePath')
|
|
|
|
|
|
|
+ taskMgr.remove('followSelectedNodePath')
|
|
|
# Spawn a task to keep the selected objects with the widget
|
|
# Spawn a task to keep the selected objects with the widget
|
|
|
- taskMgr.spawnMethodNamed(self.stickToWidgetTask, 'stickToWidget')
|
|
|
|
|
|
|
+ taskMgr.add(self.stickToWidgetTask, 'stickToWidget')
|
|
|
# Spawn a task to move the widget
|
|
# Spawn a task to move the widget
|
|
|
t = direct.widget.lerpPos(Point3(centerVec),
|
|
t = direct.widget.lerpPos(Point3(centerVec),
|
|
|
CAM_MOVE_DURATION,
|
|
CAM_MOVE_DURATION,
|
|
|
other = direct.camera,
|
|
other = direct.camera,
|
|
|
blendType = 'easeInOut',
|
|
blendType = 'easeInOut',
|
|
|
task = 'moveToFitTask')
|
|
task = 'moveToFitTask')
|
|
|
- t.uponDeath = lambda state: taskMgr.removeTasksNamed('stickToWidget')
|
|
|
|
|
|
|
+ t.uponDeath = lambda state: taskMgr.remove('stickToWidget')
|
|
|
|
|
|
|
|
def stickToWidgetTask(self, state):
|
|
def stickToWidgetTask(self, state):
|
|
|
# Move the objects with the widget
|
|
# Move the objects with the widget
|
|
@@ -636,5 +636,5 @@ class DirectCameraControl(PandaObject):
|
|
|
base.enableMouse()
|
|
base.enableMouse()
|
|
|
|
|
|
|
|
def removeManipulateCameraTask(self):
|
|
def removeManipulateCameraTask(self):
|
|
|
- taskMgr.removeTasksNamed('manipulateCamera')
|
|
|
|
|
|
|
+ taskMgr.remove('manipulateCamera')
|
|
|
|
|
|