Esempio n. 1
0
 def OnSlimItemUpdated(self, slimItem):
     with ExceptionEater('ship::OnSlimItemUpdated failed'):
         self.typeData['slimItem'] = slimItem
         stanceID = self.GetStanceIDFromSlimItem(self.typeData['slimItem'])
         if stanceID != self.stanceID:
             self.lastStanceID = self.stanceID
             self.stanceID = stanceID
             spaceobjanimation.SetShipAnimationStance(self.model, stanceID)
Esempio n. 2
0
 def OnSlimItemUpdated(self, slimItem):
     with ExceptionEater('ship::OnSlimItemUpdated failed'):
         oldSlim = self.typeData['slimItem']
         self.typeData['slimItem'] = slimItem
         stanceID = self.GetStanceIDFromSlimItem(self.typeData['slimItem'])
         if stanceID != self.stanceID:
             self.lastStanceID = self.stanceID
             self.stanceID = stanceID
             spaceobjanimation.SetShipAnimationStance(self.model, stanceID)
         if getattr(oldSlim, 'skinMaterialSetID') != getattr(slimItem, 'skinMaterialSetID'):
             uthread.new(self.ChangeSkin)
Esempio n. 3
0
 def _SetInitialState(self):
     stanceID = self.GetStanceIDFromSlimItem(self.typeData['slimItem'])
     if stanceID is not None:
         self.stanceID = stanceID
         spaceobjanimation.SetShipAnimationStance(self.model, self.stanceID)
     if self.mode == destiny.DSTBALL_WARP:
         self.TriggerAnimation('warping')
         if session.shipid != self.id:
             self.sm.GetService('FxSequencer').OnSpecialFX(
                 self.id, None, None, None, None, 'effects.WarpIn', 0, 1, 0)
     elif self.GetCurrentAnimationState(
             spaceobjanimation.STATE_MACHINE_SHIP_STANDARD) is None:
         self.TriggerAnimation('normal')
Esempio n. 4
0
 def SetupAnimation(self, model, shipItem):
     if model is None:
         return
     typeObj = cfg.invtypes.GetIfExists(shipItem.typeID)
     if typeObj is None:
         return
     animationStates = typeObj.AnimationStates()
     spaceobjanimation.LoadAnimationStates(animationStates,
                                           cfg.graphicStates, model,
                                           trinity)
     if model.animationSequencer is not None:
         model.animationSequencer.GoToState('normal')
         spaceobjanimation.SetShipAnimationStance(
             model,
             shipstance.get_ship_stance(shipItem.itemID, shipItem.typeID))
Esempio n. 5
0
 def SetupAnimation(self, model, shipItem):
     if model is None:
         return
     if not evetypes.Exists(shipItem.typeID):
         return
     animationStates = inventorycommon.typeHelpers.GetAnimationStates(
         shipItem.typeID)
     spaceobjanimation.LoadAnimationStates(animationStates,
                                           cfg.graphicStates, model,
                                           trinity)
     if model.animationSequencer is not None:
         model.animationSequencer.GoToState('normal')
         spaceobjanimation.SetShipAnimationStance(
             model,
             shipstance.get_ship_stance(shipItem.itemID, shipItem.typeID))
Esempio n. 6
0
 def ReloadShipModel(self, throttle = False, animate = True):
     if self.destroyed:
         return
     with self._reloadLock:
         if throttle:
             newModel = self.CreateActiveShipModelThrottled()
         else:
             newModel = self.CreateActiveShipModel()
         if not newModel:
             return
         newModel.FreezeHighDetailMesh()
         trinity.WaitForResourceLoads()
         self.AddToScene(newModel)
         if animate:
             self.AnimEntry()
         if isinstance(self.controller.dogmaLocation.GetCurrentShipID(), basestring):
             _ApplyIsisEffect(newModel, isSkinned=False)
             grid = trinity.Load('res:/dx9/model/UI/ScanGrid.red')
             grid.scaling = (4, 4, 4)
             self.scene.objects.append(grid)
         camera = self.camera
         rad = newModel.GetBoundingSphereRadius()
         minZoom = rad + camera.nearClip
         alpha = camera.fov / 2.0
         maxZoom = min(self.backClip - rad, rad * (1 / math.tan(alpha)) * 2)
         oldZoomDistance = self.minZoom + (self.maxZoom - self.minZoom) * self.zoom
         defaultZoom = minZoom / (maxZoom - minZoom)
         self.SetMinMaxZoom(minZoom, maxZoom)
         if animate or oldZoomDistance < minZoom or oldZoomDistance > maxZoom:
             self.SetZoom(defaultZoom)
         shipTypeID = self.controller.GetTypeID()
         stanceBtnControllerClass = self.controller.GetStanceBtnControllerClass()
         stanceID = stanceBtnControllerClass().get_ship_stance(self.controller.GetItemID(), shipTypeID)
         animationStates = []
         if evetypes.Exists(shipTypeID):
             animationStates = inventorycommon.typeHelpers.GetAnimationStates(shipTypeID)
         spaceobjanimation.LoadAnimationStates(animationStates, cfg.graphicStates, newModel, trinity)
         if newModel.animationSequencer is not None:
             newModel.animationSequencer.GoToState('normal')
             spaceobjanimation.SetShipAnimationStance(newModel, stanceID)
         if not self.controller.IsSimulated():
             self.UpdateHardpoints(newModel)
Esempio n. 7
0
 def OnStanceActive(self, shipID, stanceID):
     if self.activeShipModel is not None:
         spaceobjanimation.SetShipAnimationStance(self.activeShipModel, stanceID)
Esempio n. 8
0
 def OnStanceActive(self, stanceID):
     spaceobjanimation.SetShipAnimationStance(self.GetSceneShip(), stanceID)
Esempio n. 9
0
 def OnStanceActive(self, shipID, stanceID):
     if util.GetActiveShip() == shipID:
         if self.activeshipmodel is not None:
             spaceobjanimation.SetShipAnimationStance(
                 self.activeshipmodel, stanceID)