def ApplyAttributes(self, attributes):
        uicontrols.Window.ApplyAttributes(self, attributes)
        if self.destroyed:
            return
        self.polling = False
        self.interruptPolling = False
        caption = 'Camera: idle'
        self.SetCaption(caption)
        self.sr.bottomarea = uiprimitives.Container(name='bottomarea', align=uiconst.TOALL, parent=self.sr.main)
        self.sr.scenepar = uiprimitives.Container(name='scenepar', align=uiconst.TOALL, parent=self.sr.bottomarea, left=1, top=2, state=uiconst.UI_NORMAL)
        try:
            self.sr.scenepar.children.remove(self.sr.sceneContainer)
        except:
            pass

        from eve.client.script.ui.control.scenecontainer import SceneContainer
        sc = SceneContainer(align=uiconst.TOALL)
        sc.pickState = uiconst.TR2_SPS_OFF
        sc.SetAlign(uiconst.TOALL)
        self.sr.scenepar.children.append(sc)
        sc.PrepareCamera()
        ball = sm.GetService('michelle').GetBall(eve.session.shipid)
        sc.camera.parent.translationCurve = ball
        sc.camera.translationFromParent = ball.radius * 3
        sc.PrepareSpaceScene()
        s2 = sm.GetService('sceneManager').GetActiveScene()
        sc.renderJob.SetActiveScene(s2)
        self.sr.sceneContainer = sc
        sc.UpdateViewPort()
 def ApplyAttributes(self, attributes):
     uiprimitives.Container.ApplyAttributes(self, attributes)
     self.duration = attributes.duration
     from eve.client.script.ui.control.scenecontainer import SceneContainer
     self.sceneContainer = SceneContainer(parent=self,
                                          align=uiconst.TOALL,
                                          state=uiconst.UI_DISABLED)
     self.sceneContainer.Startup()
     self.sceneContainer.PrepareSpaceScene(offscreen=True)
     self.PreviewType(attributes.typeID)
 def Close(self, *args, **kwds):
     SceneContainer.Close(self, *args, **kwds)
     self.scene = None
     self.camera = None
     self.projection = None
     self.renderJob = None
     self.bracketCurveSet = None
Пример #4
0
 def ApplyAttributes(self, attributes):
     SceneContainer.ApplyAttributes(self, attributes)
     self.controller = attributes.controller
     self.controller.on_new_itemID.connect(self.ReloadShipModel)
     self.controller.on_subsystem_fitted.connect(self.ReloadShipModel)
     self.controller.on_hardpoints_fitted.connect(self.UpdateHardpoints)
     self.controller.on_module_online_state.connect(self.ProcessOnlineStateChange)
     self.controller.on_skin_material_changed.connect(self.OnSkinChanged)
     self.controller.on_stance_activated.connect(self.OnStanceActive)
     self.CreateActiveShipModelThrottled = CallCombiner(self.CreateActiveShipModel, 1.0)
     sm.RegisterNotify(self)
Пример #5
0
    def ApplyAttributes(self, attributes):
        uicontrols.Window.ApplyAttributes(self, attributes)
        if self.destroyed:
            return
        self.polling = False
        self.interruptPolling = False
        caption = 'Camera: idle'
        self.SetCaption(caption)
        self.sr.bottomarea = uiprimitives.Container(name='bottomarea',
                                                    align=uiconst.TOALL,
                                                    parent=self.sr.main)
        self.sr.scenepar = uiprimitives.Container(name='scenepar',
                                                  align=uiconst.TOALL,
                                                  parent=self.sr.bottomarea,
                                                  left=1,
                                                  top=2,
                                                  state=uiconst.UI_NORMAL)
        try:
            self.sr.scenepar.children.remove(self.sr.sceneContainer)
        except:
            pass

        from eve.client.script.ui.control.scenecontainer import SceneContainer
        sc = SceneContainer(align=uiconst.TOALL)
        sc.pickState = uiconst.TR2_SPS_OFF
        sc.SetAlign(uiconst.TOALL)
        self.sr.scenepar.children.append(sc)
        sc.PrepareCamera()
        ball = sm.GetService('michelle').GetBall(eve.session.shipid)
        sc.camera.parent.translationCurve = ball
        sc.camera.translationFromParent = ball.radius * 3
        sc.PrepareSpaceScene()
        s2 = sm.GetService('sceneManager').GetActiveScene()
        sc.renderJob.SetActiveScene(s2)
        self.sr.sceneContainer = sc
        sc.UpdateViewPort()
Пример #6
0
 def _OnClose(self, *args):
     sm.UnregisterNotify(self)
     SceneContainer._OnClose(self)
 def _OnClose(self, *args):
     sm.UnregisterNotify(self)
     SceneContainer._OnClose(self)
class Scene3dCont(uiprimitives.Container):
    __guid__ = 'uicls.Scene3dCont'
    default_typeID = None

    def ApplyAttributes(self, attributes):
        uiprimitives.Container.ApplyAttributes(self, attributes)
        self.duration = attributes.duration
        from eve.client.script.ui.control.scenecontainer import SceneContainer
        self.sceneContainer = SceneContainer(parent=self,
                                             align=uiconst.TOALL,
                                             state=uiconst.UI_DISABLED)
        self.sceneContainer.Startup()
        self.sceneContainer.PrepareSpaceScene(offscreen=True)
        self.PreviewType(attributes.typeID)

    @telemetry.ZONE_METHOD
    def PreviewType(self, typeID, subsystems=None):
        typeOb = cfg.invtypes.Get(typeID)
        groupID = typeOb.groupID
        groupOb = cfg.invgroups.Get(groupID)
        categoryID = groupOb.categoryID
        godma = sm.GetService('godma')
        if IsModularShip(typeID):
            if subsystems is None:
                subsystems = {}
                subSystemsForType = {}
                for group in cfg.groupsByCategories.get(
                        const.categorySubSystem, []):
                    if group.groupID not in subSystemsForType:
                        subSystemsForType[group.groupID] = []
                    for t in cfg.typesByGroups.get(group.groupID, []):
                        if t.published and godma.GetTypeAttribute(
                                t.typeID,
                                const.attributeFitsToShipType) == typeID:
                            subSystemsForType[group.groupID].append(t.typeID)

                for k, v in subSystemsForType.iteritems():
                    subsystems[k] = random.choice(v)

            model = sm.StartService('t3ShipSvc').GetTech3ShipFromDict(
                typeID, subsystems)
        else:
            dna = gfxutils.BuildSOFDNAFromTypeID(typeID)
            if dna is not None:
                spaceObjectFactory = sm.GetService(
                    'sofService').spaceObjectFactory
                model = spaceObjectFactory.BuildFromDNA(dna)
            else:
                fileName = typeOb.GraphicFile()
                if fileName == '':
                    log.LogWarn('type', typeID, 'has no graphicFile')
                    return
                model = trinity.Load(fileName)
            if model is None:
                self.sceneContainer.ClearScene()
                raise UserError('PreviewNoModel')
            if getattr(model, 'boosters', None) is not None:
                model.boosters = None
            if getattr(model, 'modelRotationCurve', None) is not None:
                model.modelRotationCurve = None
            if getattr(model, 'modelTranslationCurve', None) is not None:
                model.modelTranslationCurve = None
        if hasattr(model, 'ChainAnimationEx'):
            model.ChainAnimationEx('NormalLoop', 0, 0, 1.0)
        self._CreateRotationCurve(model)
        self.sceneContainer.AddToScene(model)
        camera = self.sceneContainer.camera
        if camera is not None:
            rad = model.GetBoundingSphereRadius()
            minZoom = rad + camera.frontClip
            camera.translationFromParent = minZoom * 2
            self.sceneContainer.UpdateViewPort()

    def _CreateRotationCurve(self, model):
        model.rotationCurve = trinity.TriYPRSequencer()
        model.rotationCurve.YawCurve = yawCurve = trinity.TriScalarCurve()
        yawCurve.start = blue.os.GetWallclockTime()
        yawCurve.extrapolation = trinity.TRIEXT_CONSTANT
        yawCurve.AddKey(0.0, -70.0, 0, 0, trinity.TRIINT_HERMITE)
        yawCurve.AddKey(self.duration, 70.0, 0, 0, trinity.TRIINT_HERMITE)
        model.rotationCurve.PitchCurve = pitchCurve = trinity.TriScalarCurve()
        pitchCurve.start = blue.os.GetWallclockTime()
        pitchCurve.extrapolation = trinity.TRIEXT_CONSTANT
        pitchCurve.AddKey(0.0, -10.0, 0, 0, trinity.TRIINT_HERMITE)
        pitchCurve.AddKey(self.duration, 10.0, 0, 0, trinity.TRIINT_HERMITE)
Пример #9
0
 def UpdateViewPort(self, *args):
     self.fieldOfView = self.camera.fieldOfView
     self.backClip = self.camera.backClip
     self.frontClip = self.camera.frontClip
     SceneContainer.UpdateViewPort(self, *args)