def SetFreeLook(self, freeLook=True):
        """
        Allows freelook to be enabled/disabled
        """
        if self._freeLook == freeLook:
            return
        self._freeLook = freeLook
        camera = self._cameraSvc.GetSpaceCamera()
        if camera is None:
            return
        if freeLook:
            cameraParent = self._cameraSvc.GetCameraParent()
            cameraParent.translationCurve = None
            self.axisLines = trinity.Tr2LineSet()
            self.axisLines.effect = trinity.Tr2Effect()
            self.axisLines.effect.effectFilePath = 'res:/Graphics/Effect/Managed/Utility/LinesWithZ.fx'
            self._clientToolsScene = self._GetClientToolsScene()
            self._clientToolsScene.primitives.append(self.axisLines)
            self._ChangeCamPos(cameraParent.translation)
            self._BuildGridAndAxes()
            uthread.new(self._UpdateFreelookCamera)
        else:
            self._cameraSvc.ResetCamera()
            try:
                self._clientToolsScene.primitives.remove(self.axisLines)
            except ValueError:
                pass

            self.axisLines = None
Example #2
0
 def InitAxisLines(self):
     self.axisLines = trinity.Tr2LineSet()
     self.axisLines.effect = trinity.Tr2Effect()
     self.axisLines.effect.effectFilePath = 'res:/Graphics/Effect/Managed/Utility/LinesWithZ.fx'
     self._clientToolsScene = self._GetClientToolsScene()
     self._clientToolsScene.primitives.append(self.axisLines)
     self._BuildGridAndAxes()
Example #3
0
    def SetFreeLook(self, freeLook=True):
        if self.freeLook == freeLook:
            return
        self.freeLook = freeLook
        camera = sm.GetService('sceneManager').GetRegisteredCamera(
            None, defaultOnActiveCamera=True)
        if camera is None:
            return
        if freeLook:
            cameraParent = self.GetCameraParent()
            cameraParent.translationCurve = None
            self.axisLines = trinity.Tr2LineSet()
            self.axisLines.effect = trinity.Tr2Effect()
            self.axisLines.effect.effectFilePath = 'res:/Graphics/Effect/Managed/Utility/LinesWithZ.fx'
            self.clientToolsScene = self.GetClientToolsScene()
            self.clientToolsScene.primitives.append(self.axisLines)
            self._ChangeCamPos(cameraParent.translation)
            self.BuildGridAndAxes()
            uthread.new(self._UpdateFreelookCamera)
        else:
            self.ResetCamera()
            try:
                self.clientToolsScene.primitives.remove(self.axisLines)
            except ValueError:
                pass

            self.axisLines = None
 def __init__(self,
              name,
              color=(0.0, 0.0, 0.0, 1.0),
              scaleByDistance=True,
              viewOriented=False,
              primitiveScene=None):
     basearea.__init__(self, name, color, primitiveScene)
     self._lineset = trinity.Tr2LineSet()
     self._lineset.scaleByDistanceToView = scaleByDistance
     self._lineset.viewOriented = viewOriented
     self._lineset.name = name
     self._lineset.effect = trinity.Tr2Effect()
     self._lineset.pickEffect = trinity.Tr2Effect()
     self._lineset.effect.effectFilePath = 'res:/Graphics/Effect/Managed/Utility/LinesNoZ.fx'
     self._lineset.pickEffect.effectFilePath = 'res:/Graphics/Effect/Managed/Utility/PrimitivePicking.fx'
     self._solidset = trinity.Tr2SolidSet()
     self._solidset.scaleByDistanceToView = scaleByDistance
     self._solidset.name = name
     self._solidset.effect = trinity.Tr2Effect()
     self._solidset.pickEffect = trinity.Tr2Effect()
     self._solidset.effect.effectFilePath = 'res:/Graphics/Effect/Managed/Utility/SolidsNoZ.fx'
     self._solidset.pickEffect.effectFilePath = 'res:/Graphics/Effect/Managed/Utility/PrimitivePicking.fx'
     self.primitives.append(self._solidset)
     self.primitives.append(self._lineset)