예제 #1
0
    def LoadScene(self, sceneContainer):
        sceneContainer.PrepareSpaceScene(maxPitch=0.0,
                                         scenePath=self.scenePath)
        model = trinity.Load(
            'res:/dx9/model/ship/IconPreview/PreviewTurretShip.red')
        turretSet = TurretSet.FitTurret(model=model,
                                        parentTypeID=None,
                                        turretTypeID=self.typeID,
                                        locatorID=1,
                                        checkSettings=False)
        if turretSet is None:
            typeInfo = cfg.invtypes.Get(self.typeID)
            raise RuntimeError(
                'Failed to load preview for {0.name} ({0.typeID})'.format(
                    typeInfo))
        boundingSphere = turretSet.turretSets[0].boundingSphere
        model.boundingSphereRadius = boundingSphere[3]
        model.boundingSphereCenter = boundingSphere[:3]
        if model.boundingSphereCenter[1] < 2.0:
            model.boundingSphereCenter = (boundingSphere[0], 2.0,
                                          boundingSphere[2])
        for turret in turretSet.turretSets:
            turret.bottomClipHeight = 0.0
            turret.FreezeHighDetailLOD()
            turret.ForceStateDeactive()
            turret.EnterStateIdle()

        sceneContainer.AddToScene(model)
        SetupSpaceCamera(sceneContainer, model)
예제 #2
0
    def LoadScene(self, sceneContainer):
        sceneContainer.PrepareSpaceScene(maxPitch=0.0,
                                         scenePath=self.scenePath)
        model = trinity.Load(
            'res:/dx9/model/ship/IconPreview/PreviewTurretShip.red')
        turretSet = TurretSet.FitTurret(model,
                                        self.typeID,
                                        1,
                                        evetypes.GetSofFactionNameOrNone(
                                            self.typeID),
                                        checkSettings=False)
        if turretSet is None:
            raise RuntimeError('Failed to load preview for %s (%s)' %
                               (evetypes.GetName(self.typeID), self.typeID))
        boundingSphere = turretSet.turretSets[0].boundingSphere
        model.boundingSphereRadius = boundingSphere[3]
        model.boundingSphereCenter = boundingSphere[:3]
        if model.boundingSphereCenter[1] < 2.0:
            model.boundingSphereCenter = (boundingSphere[0], 2.0,
                                          boundingSphere[2])
        for turret in turretSet.turretSets:
            turret.bottomClipHeight = 0.0
            turret.FreezeHighDetailLOD()
            turret.ForceStateDeactive()
            turret.EnterStateIdle()

        sceneContainer.AddToScene(model)
        SetupSpaceCamera(sceneContainer, model)
예제 #3
0
 def FitHardpoints(self, blocking = False):
     if self.model is None:
         self.logger.warning('FitHardpoints - No model')
         return
     if self.fitted:
         return
     self.fitted = True
     turretLocatorCount = int(self.model.GetTurretLocatorCount())
     if 'dreadnought' in self.typeData.get('typeName', '').lower():
         turretLocatorCount = min(max(turretLocatorCount, 1), 3)
     if self.launcherTypeID:
         launcherSet = TurretSet.FitTurret(self.model, self.launcherTypeID, turretLocatorCount, count=1)
         self.modules[0] = launcherSet
         turretLocatorCount = max(turretLocatorCount - 1, 1)
     newTurretSet = TurretSet.FitTurret(self.model, self.turretTypeID, -1, count=turretLocatorCount)
     if newTurretSet is not None:
         self.modules[self.id] = newTurretSet
예제 #4
0
 def FitHardpoints(self, blocking=False):
     if self.model is None:
         self.LogWarn('FitHardpoints - No model')
         return
     if self.fitted:
         return
     self.fitted = True
     turretLocatorCount = int(self.model.GetTurretLocatorCount())
     if self.launcherTypeID:
         launcherSet = TurretSet.FitTurret(self.model, self.typeID,
                                           self.launcherTypeID,
                                           turretLocatorCount, 1)
         self.modules[0] = launcherSet
         turretLocatorCount = max(turretLocatorCount - 1, 1)
     newTurretSet = TurretSet.FitTurret(self.model, self.typeID,
                                        self.turretTypeID, -1,
                                        turretLocatorCount)
     if newTurretSet is not None:
         self.modules[self.id] = newTurretSet
예제 #5
0
 def _FitHardpoints(self):
     if self.fitted:
         return
     if self.model is None:
         self.LogWarn('FitHardpoints - No model')
         return
     self.fitted = True
     newTurretSetDict = TurretSet.FitTurrets(self.id, self.model)
     self.turrets = []
     for key, val in newTurretSetDict.iteritems():
         self.modules[key] = val
         self.turrets.append(val)
예제 #6
0
 def _FitHardpoints(self):
     if self.fitted:
         return
     if self.model is None:
         self.logger.warning('FitHardpoints - No model')
         return
     self.fitted = True
     newTurretSetDict = TurretSet.FitTurrets(self.id, self.model, self.typeData.get('sofFactionName', None))
     self.turrets = []
     for key, val in newTurretSetDict.iteritems():
         self.modules[key] = val
         self.turrets.append(val)
예제 #7
0
 def FitHardpoints(self, blocking = False):
     if self.fitted:
         return
     if self.model is None:
         self.LogWarn('FitHardpoints - No model')
         return
     if self.typeID is None:
         self.LogWarn('FitHardpoints - No typeID')
         return
     self.fitted = True
     self.modules = {}
     groupID = self.typeData.get('groupID', None)
     if groupID is not None:
         turretTypeID = TURRET_TYPE_ID.get(groupID, None)
         if turretTypeID is not None:
             ts = TurretSet.FitTurret(self.model, self.typeID, turretTypeID, 1)
             if ts is not None:
                 self.modules[self.id] = ts
예제 #8
0
 def FitTurrets(self, itemID, typeID, model):
     sofFactionName = evetypes.GetSofFactionNameOrNone(typeID)
     if sofFactionName is None:
         sofFactionName = GetSofFactionName(evetypes.GetGraphicID(typeID))
     TurretSet.FitTurrets(itemID, model, sofFactionName)