undockCamera.py (2495B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\camera\undockCamera.py 2 import math 3 from eve.client.script.ui.camera.baseSpaceCamera import BaseSpaceCamera 4 from eve.client.script.ui.camera.cameraUtil import GetSpeedDirection, GetBall, GetBallPosition, GetBallMaxZoom, GetBallRadius, GetBallWaitForModel, IsDynamicCameraMovementEnabled 5 from eve.client.script.ui.view.viewStateConst import ViewState 6 import evecamera 7 import uthread 8 import blue 9 import geo2 10 from carbonui.uicore import uicore 11 12 class UndockCamera(BaseSpaceCamera): 13 cameraID = evecamera.CAM_UNDOCK 14 name = 'UndockCamera' 15 16 def __init__(self): 17 BaseSpaceCamera.__init__(self) 18 self.animEntryThread = None 19 20 def Update(self): 21 BaseSpaceCamera.Update(self) 22 if IsDynamicCameraMovementEnabled(): 23 self.SetFovTarget(self.GetDynamicFov()) 24 ball = GetBall(self.ego) 25 if ball: 26 self.SetAtPosition(GetBallPosition(ball)) 27 28 def OnActivated(self, **kwargs): 29 BaseSpaceCamera.OnActivated(self, **kwargs) 30 self.animEntryThread = uthread.new(self._OnActivated) 31 32 def _OnActivated(self): 33 duration = 30.0 34 ball = GetBallWaitForModel(self.ego) 35 self.SetEyePosition(geo2.Vec3Scale(GetSpeedDirection(ball), 2 * GetBallRadius(ball))) 36 self.SetMaxZoom(GetBallMaxZoom(ball, self.nearClip)) 37 self.pitch -= math.pi / 40 38 uicore.animations.MorphScalar(self, 'yaw', self.yaw, self.yaw + math.pi / 3, duration=duration) 39 uicore.animations.MorphScalar(self, 'pitch', self.pitch, self.pitch - math.pi / 10, duration=duration) 40 zoom0 = 0.48 41 zoom1 = 0.65 42 self.SetZoom(zoom0) 43 uicore.animations.MorphScalar(self, 'zoom', zoom0, zoom1, duration=duration * 0.8) 44 blue.synchro.SleepWallclock(duration * 1000 + 500) 45 uthread.new(self.SwitchToPrimaryCamera) 46 47 def SwitchToPrimaryCamera(self): 48 sm.GetService('viewState').GetView(ViewState.Space).ActivatePrimaryCamera() 49 50 def OnDeactivated(self): 51 BaseSpaceCamera.OnDeactivated(self) 52 uicore.animations.StopAllAnimations(self) 53 if self.animEntryThread: 54 self.animEntryThread.kill() 55 self.animEntryThread = None 56 57 def Track(self, itemID, **kwargs): 58 self.SwitchToPrimaryCamera() 59 60 def LookAt(self, itemID, **kwargs): 61 self.SwitchToPrimaryCamera() 62 63 def LookAtMaintainDistance(self, itemID): 64 pass