assetlab.py (4331B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\packages\eveclientqatools\assetlab.py 2 from __future__ import print_function 3 import math 4 from eve.client.script.parklife import states as state 5 from carbonui.control.window import Window 6 from eve.client.script.ui.control.eveLabel import Label 7 from carbonui.button.group import ButtonGroup 8 import carbonui.const as uiconst 9 10 class AssetLabWindow(Window): 11 default_caption = 'Asset Lab' 12 default_windowID = 'assetLabWindow' 13 default_width = 400 14 default_height = 250 15 default_someValue = 10 16 default_otherValue = 20 17 18 def ApplyAttributes(self, attributes): 19 Window.ApplyAttributes(self, attributes) 20 self.yaw = 0.0 21 self.pitch = 0.0 22 23 def GetModel(): 24 selectedID = sm.GetService('stateSvc').GetExclState(state.selected) 25 ball = sm.GetService('michelle').GetBall(selectedID) 26 return getattr(ball, 'model', None) 27 28 def Start(): 29 self.scene = sm.GetService('space').GetScene() 30 self.sunBallCache = self.scene.sunBall 31 self.scene.sunBall = None 32 self.scene.sunDirection = (0.0, 0.0, -1.0) 33 model = GetModel() 34 GoToX(model, 10000000000.0) 35 36 Label(name='goLabel', parent=self.sr.main, align=uiconst.TOTOP, text='Fly') 37 38 def GoToX(model, offset): 39 print('GoToX', offset) 40 model.translationCurve.gotoX = model.translationCurve.x + offset 41 model.translationCurve.gotoY = model.translationCurve.y 42 model.translationCurve.gotoZ = model.translationCurve.z 43 print(model.translationCurve.gotoX) 44 45 def FlyLeft(_): 46 model = GetModel() 47 GoToX(model, -10000000000.0) 48 49 def FlyRight(_): 50 model = GetModel() 51 GoToX(model, +10000000000.0) 52 53 buttonGroup = ButtonGroup(name='flyButtons', parent=self.sr.main, align=uiconst.TOTOP) 54 buttonGroup.AddButton('Left', FlyLeft) 55 buttonGroup.AddButton('Right', FlyRight) 56 57 def Orbit(): 58 camera = sm.GetService('sceneManager').GetActiveCamera() 59 camera.SetOrbit(self.yaw, self.pitch) 60 61 Label(name='cameraLabel', parent=self.sr.main, align=uiconst.TOTOP, text='Camera Yaw') 62 63 def Yaw(button): 64 yawDeg = float(button.name.split('_')[0]) 65 self.yaw = math.radians(yawDeg) 66 Orbit() 67 68 buttonGroup = ButtonGroup(name='yawButtons', parent=self.sr.main, align=uiconst.TOTOP) 69 buttonGroup.AddButton('-135', Yaw) 70 buttonGroup.AddButton('-90', Yaw) 71 buttonGroup.AddButton('-45', Yaw) 72 buttonGroup.AddButton('0', Yaw) 73 buttonGroup.AddButton('45', Yaw) 74 buttonGroup.AddButton('90', Yaw) 75 buttonGroup.AddButton('135', Yaw) 76 buttonGroup.AddButton('180', Yaw) 77 Label(name='cameraLabel', parent=self.sr.main, align=uiconst.TOTOP, text='Camera Pitch') 78 79 def Pitch(button): 80 yawDeg = float(button.name.split('_')[0]) 81 self.pitch = -math.radians(yawDeg) 82 Orbit() 83 84 buttonGroup = ButtonGroup(name='pitchButtons', parent=self.sr.main, align=uiconst.TOTOP) 85 buttonGroup.AddButton('-89', Pitch) 86 buttonGroup.AddButton('-45', Pitch) 87 buttonGroup.AddButton('0', Pitch) 88 buttonGroup.AddButton('45', Pitch) 89 buttonGroup.AddButton('89', Pitch) 90 Label(name='controlLabel', parent=self.sr.main, align=uiconst.TOTOP, text='Sunlight') 91 92 def SunDirection(button): 93 angle = float(button.name.split('_')[0]) 94 angleRad = math.radians(-angle) - math.pi / 2.0 95 self.scene.sunDirection = (math.cos(angleRad), 0.0, math.sin(angleRad)) 96 97 buttonGroup = ButtonGroup(name='sunlightButtons', parent=self.sr.main, align=uiconst.TOTOP) 98 buttonGroup.AddButton('-135', SunDirection) 99 buttonGroup.AddButton('-90', SunDirection) 100 buttonGroup.AddButton('-45', SunDirection) 101 buttonGroup.AddButton('0', SunDirection) 102 buttonGroup.AddButton('45', SunDirection) 103 buttonGroup.AddButton('90', SunDirection) 104 buttonGroup.AddButton('135', SunDirection) 105 buttonGroup.AddButton('180', SunDirection) 106 Start() 107 108 109 def ShowAssetLabWindow(): 110 AssetLabWindow()