def Prepare(self, addToScene=True):
        shipBall = self.GetEffectShipBall()
        self.isShortWarp = self._IsShortWarp(shipBall)
        if self.isShortWarp:
            return
        model = getattr(shipBall, 'model', None)
        if model is None:
            return
        self.startPos = shipBall.GetVectorAt(blue.os.GetSimTime())
        self.startPos = (self.startPos.x, self.startPos.y, self.startPos.z)
        self.lastPos = self.startPos

        def _sizeFunction(x):
            return 0.0039 * x + 2.5

        r = _sizeFunction(model.boundingSphereRadius)
        self.gfx_trace = trinity.Load('res:/fisfx/jump/warp/warp_out.red')
        self.gfxModel_trace = trinity.EveRootTransform()
        self.gfxModel_trace.children.append(self.gfx_trace)
        self.gfxModel_trace.scaling = (r, r, 8)
        self.gfx_ship = trinity.Load('res:/fisfx/jump/warp/warp_glow.red')
        self.gfxModel_ship = trinity.EveRootTransform()
        self.gfxModel_ship.children.append(self.gfx_ship)
        r *= 0.5
        self.gfxModel_ship.scaling = (r, r, 6)
        self.soundInsert = 'frig'
        if model.boundingSphereRadius > 350:
            self.soundInsert = 'battle'
        self.gfx = self.gfx_trace
        self.AddSoundToEffect(0.0007)
Beispiel #2
0
 def __init__(self):
     self.rootPersistenceKey = (self, 'rootTransform')
     self.rootCurve = OffsetPositionFunction(None)
     self.sceneManager = sm.GetService('sceneManager')
     self.rootTransform = trinity.EveRootTransform()
     self.rootTransform.translationCurve = self.rootCurve.GetBlueFunction()
     self.sceneManager.RegisterPersistentSpaceObject(self.rootPersistenceKey, self.rootTransform)
     self.rootTransform.name = 'TacticalOverlayMain'
     self.connectorPersistenceKey = (self, 'connectorContainer')
     self.connectorContainer = trinity.Load('res:/ui/inflight/tactical/tacticalOverlay.red')
     self.connectorContainer.translationCurve = self.rootCurve.GetBlueFunction()
     self.sceneManager.RegisterPersistentSpaceObject(self.connectorPersistenceKey, self.connectorContainer)
     self.anchorDiffuse = self.connectorContainer.anchorEffect.parameters.FindByName('DiffuseColor')
     self.bombSphere = trinity.Load(_RANGE_SPHERE_PATH)
     self.bombSpherePersistanceKey = (self, 'bombSphere')
     self.sceneManager.RegisterPersistentSpaceObject(self.bombSpherePersistanceKey, self.bombSphere)
     self.bombRangeAnchorConnector = None
     self.firingRangePersistenceKey = (self, 'firingRange')
     self.firingRangeRoot = trinity.EveRootTransform()
     self.firingRangeRoot.name = 'TacticalOverlayRangeSphere'
     self.sceneManager.RegisterPersistentSpaceObject(self.firingRangePersistenceKey, self.firingRangeRoot)
     self.darkDiscPersistenceKey = (self, 'darkDisc')
     self.darkDiscContainer = trinity.EveRootTransform()
     self.darkDiscContainer.name = 'TacticalOverlayDarkDisc'
     self.sceneManager.RegisterPersistentSpaceObject(self.darkDiscPersistenceKey, self.darkDiscContainer)
     self.connectors = {}
     self.selection = None
     self.targetingRange = None
     self.optimalRange = None
     self.falloffRange = None
     self.baseRadius = 0.0
     self.compassDisc = CompassDisc(self.rootTransform, self.firingRangeRoot, self.darkDiscContainer)
Beispiel #3
0
 def ApplyAttributes(self, attributes):
     Base.ApplyAttributes(self, attributes)
     self.viewport = trinity.TriViewport()
     self.viewport.x = 0
     self.viewport.y = 0
     self.viewport.width = 1
     self.viewport.height = 1
     self.viewport.minZ = 0.0
     self.viewport.maxZ = 1.0
     self.projection = trinity.TriProjection()
     self.frontClip = 1.0
     self.backClip = 350000.0
     self.fieldOfView = 1.0
     self.minPitch = -3.0
     self.maxPitch = 3.4
     self.minZoom = 0.0
     self.maxZoom = 1.0
     self._zoom = 0.5
     self.scene = trinity.EveSpaceScene()
     self.transform = trinity.EveRootTransform()
     self.scene.objects.append(self.transform)
     self.PrepareCamera()
     self.DisplayScene()
     self.CreateBracketCurveSet()
     self.UpdateViewPort()
Beispiel #4
0
    def AddBoundingCube(self,
                        ball,
                        model,
                        scale=1.0,
                        rotation=geo2.Vector(0, 0, 0, 1)):
        scene = sm.GetService('sceneManager').GetRegisteredScene('default')
        transform = trinity.EveRootTransform()
        transform.name = '_dungeon_editor_'
        transform.children.append(model)
        if hasattr(ball, 'model') and ball.model is not None:
            transform.translationCurve = ball.model.translationCurve
        else:
            try:
                transform.translationCurve = self.fakeBallTransforms[
                    ball.id].translationCurve
            except KeyError:
                self.LogError('AddBoundingCube failed because ball', ball.id,
                              "didn't have a fake ball!")

        transform.rotationCurve = trinity.TriRotationCurve()
        transform.rotationCurve.value = (rotation.x, rotation.y, rotation.z,
                                         rotation.w)
        scaleFromBall = max(ball.radius, 150)
        scale = scale * scaleFromBall
        model.scaling = (scale, scale, scale)
        scene.objects.append(transform)
 def ShowSiteDuringSweep(self, locatorData, scene, siteData, sleepTimeSec,
                         soundLocators, vectorCurve):
     ball = locatorData.ballRef()
     if ball is None:
         return
     audio = audio2.AudEmitter('sensor_overlay_site_%s' %
                               str(siteData.siteID))
     obs = trinity.TriObserverLocal()
     obs.front = (0.0, -1.0, 0.0)
     obs.observer = audio
     vectorSequencer = trinity.TriVectorSequencer()
     vectorSequencer.operator = trinity.TRIOP_MULTIPLY
     vectorSequencer.functions.append(ball)
     vectorSequencer.functions.append(vectorCurve)
     tr = trinity.EveRootTransform()
     tr.name = 'sensorSuiteSoundLocator_%s' % str(siteData.siteID)
     tr.translationCurve = vectorSequencer
     tr.observers.append(obs)
     scene.objects.append(tr)
     soundLocators.append(tr)
     uthread2.SleepSim(sleepTimeSec)
     if siteData.GetSiteType() == ANOMALY:
         audio.SendEvent('ui_scanner_result_anomaly')
     elif siteData.GetSiteType() == SIGNATURE:
         audio.SendEvent('ui_scanner_result_signature')
     locatorData.bracket.DoEntryAnimation(enable=False)
     locatorData.bracket.state = uiconst.UI_DISABLED
Beispiel #6
0
    def _RunEffect(self):
        shipBall = self.GetEffectShipBall()
        if shipBall is None:
            self._Cleanup()
            return
        self._WaitForDecceleration()
        posNow = shipBall.GetVectorAt(blue.os.GetSimTime())
        posNow = (posNow.x, posNow.y, posNow.z)
        self.gfxBall = self._SpawnClientBall(posNow)
        for each in self.gfx.Find('trinity.EveTransform'):
            each.useLodLevel = False

        self.gfxModel = trinity.EveRootTransform()
        self.gfxModel.children.append(self.gfx)
        self.gfxModel.translationCurve = self.gfxBall
        if self.graphicInfo != 'npc':
            blue.synchro.SleepSim(random.random() * 200.0)
        shipBall = self.GetEffectShipBall()
        if shipBall is None:
            self._Cleanup()
            return
        self.AddToScene(self.gfxModel)
        self.gfx.curveSets[0].Play()
        self.observer.observer.SendEvent(self.soundEvent)
        self.gfxModel_ship.translationCurve = shipBall
        self.gfxModel_ship.rotationCurve = shipBall
        self.AddToScene(self.gfxModel_ship)
        self.gfx_ship.curveSets[0].Play()
        if self.useBigGlow:
            blue.synchro.SleepSim(300.0)
            WarpFlashIn._bigGlows -= 1
            blue.synchro.SleepSim(2700.0)
        else:
            blue.synchro.SleepSim(3000.0)
        self._Cleanup()
Beispiel #7
0
 def Create3DRender(self):
     self.renderTexture = trinity.TriTexture2DParameter()
     self.renderTexture.name = 'DiffuseMap'
     self.renderColor = trinity.TriVector4Parameter()
     self.renderColor.name = 'DiffuseColor'
     self.renderColor.value = (1, 1, 1, 1)
     self.renderEffect = trinity.Tr2Effect()
     self.renderEffect.effectFilePath = 'res:/Graphics/Effect/Managed/Space/SpecialFX/TextureColor.fx'
     self.renderEffect.resources.append(self.renderTexture)
     self.renderEffect.parameters.append(self.renderColor)
     self.renderArea = trinity.Tr2MeshArea()
     self.renderArea.effect = self.renderEffect
     self.renderMesh = trinity.Tr2Mesh()
     self.renderMesh.name = 'orbitalBombardmentTarget'
     self.renderMesh.geometryResPath = 'res:/Graphics/Generic/UnitPlane/UnitPlane.gr2'
     self.renderMesh.transparentAreas.append(self.renderArea)
     self.transform = trinity.EveRootTransform()
     self.transform.mesh = self.renderMesh
     self.renderScene.objects.append(self.transform)
     self.renderJob = trinity.CreateRenderJob()
     self.renderJob.Update(self.renderScene)
     self.renderObject = self.GetRenderObject()
     self.renderObject.is2dPick = False
     self.renderTarget = trinity.Tr2RenderTarget(
         self.width, self.height, 1, trinity.PIXEL_FORMAT.B8G8R8A8_UNORM)
     self.renderJob.PushRenderTarget(self.renderTarget)
     self.renderJob.RenderScene(self.renderObject)
     self.renderJob.PopRenderTarget()
     self.renderJob.ScheduleRecurring(insertFront=True)
     self.renderTexture.SetResource(trinity.TriTextureRes(
         self.renderTarget))
     self.renderSteps[-1].enabled = False
     return self.transform
Beispiel #8
0
    def Prepare(self, addToScene=True):
        shipBall = self.GetEffectShipBall()
        if WarpFlashIn._bigGlows < 5:
            gfx = trinity.Load('res:/fisfx/jump/warp/warp_in_glow.red')
            WarpFlashIn._bigGlows += 1
            self.useBigGlow = True
        else:
            gfx = trinity.Load('res:/fisfx/jump/warp/warp_in_noglow.red')
            self.useBigGlow = False
        if gfx is None:
            return
        self.gfx = gfx
        model = getattr(shipBall, 'model', None)
        if model is None:
            return
        s = 0.7778 * model.GetBoundingSphereRadius()**0.3534
        self.gfx.scaling = (s, s, s)
        self.gfx_ship = trinity.Load('res:/fisfx/jump/warp/warp_glow.red')

        def _glowScale(x):
            return 9e-08 * x * x + 0.005 * x + 0.6898

        self.gfxModel_ship = trinity.EveRootTransform()
        self.gfxModel_ship.children.append(self.gfx_ship)
        r = 0.125 * _glowScale(model.boundingSphereRadius)
        self.gfxModel_ship.scaling = (r, r, r * 3)
        self.soundEvent = 'warp_in_frig_play'
        if model.GetBoundingSphereRadius() > 350:
            self.soundEvent = 'warp_in_battle_play'
        self.AddSoundToEffect(0.001)
    def Prepare(self):
        shipID = self.ballIDs[0]
        shipBall = self.fxSequencer.GetBall(shipID)
        if shipBall is None:
            raise RuntimeError('EMPWave: no ball found')
        if self.moduleTypeID == 0:
            self.moduleTypeID = 15957
        graphicID = cfg.invtypes.Get(self.moduleTypeID).graphicID
        if graphicID is None:
            raise RuntimeError('EMPWave: no graphic ID')
        gfxString = util.GraphicFile(graphicID)
        self.gfx = trinity.Load(gfxString)
        if self.gfx is None:
            raise RuntimeError('EMPWave: no effect found')
        entity = audio2.AudEmitter('effect_' + str(shipID))
        obs = trinity.TriObserverLocal()
        obs.observer = entity
        if self.gfx.__bluetype__ in ('trinity.EveTransform', ):
            self.gfx.observers.append(obs)
        for curveSet in self.gfx.curveSets:
            for curve in curveSet.curves:
                if curve.__typename__ == 'TriEventCurve' and curve.name == 'audioEvents':
                    curve.eventListener = entity

        self.gfxModel = trinity.EveRootTransform()
        radius = self.fxSequencer.GetTypeAttribute(
            self.moduleTypeID, const.attributeEmpFieldRange)
        self.gfxModel.scaling = (radius / 1000, radius / 1000, radius / 1000)
        self.radius = radius
        self.gfxModel.name = self.__guid__
        self.gfxModel.children.append(self.gfx)
        self.gfxModel.translationCurve = shipBall
        scene = self.fxSequencer.GetScene()
        scene.objects.append(self.gfxModel)
Beispiel #10
0
 def LoadModel(self, fileName = None, loadedModel = None):
     if not self.typeData.get('graphicID', None) or gfxsettings.Get(gfxsettings.UI_EFFECTS_ENABLED) == 0:
         model = trinity.EveRootTransform()
         SpaceObject.LoadModel(self, fileName, loadedModel=model)
     else:
         SpaceObject.LoadModel(self, fileName, loadedModel)
         self.SetupAmbientAudio()
def CreateRadiusObject(name, radius):
    t = trinity.EveRootTransform()
    t.name = name
    s = blue.resMan.LoadObject('res:/model/global/gridSphere.red')
    radius = radius * 2
    s.scaling = (radius, radius, radius)
    t.children.append(s)
    return t
Beispiel #12
0
 def Explode(self,
             explosionURL=None,
             scaling=1.0,
             managed=False,
             delay=0.0):
     self.LogInfo('Exploding')
     if self.exploded:
         return False
     sm.ScatterEvent('OnObjectExplode', self.GetModel())
     self.exploded = True
     delayedRemove = delay
     if settings.user.ui.Get('explosionEffectsEnabled', 1):
         gfx = None
         if managed:
             gfx = self.explosionManager.GetExplosion(
                 explosionURL, callback=self.ClearExplosion)
         else:
             if explosionURL is None:
                 self.LogError(
                     'explosionURL not set when calling Explode. Possibly wrongly authored content. typeID:',
                     self.typeID)
                 explosionURL, (delay, scaling) = self.GetExplosionInfo()
             explosionURL = explosionURL.replace('.blue', '.red').replace(
                 '/Effect/', '/Effect3/')
             gfx = trinity.Load(explosionURL)
             if not gfx:
                 self.LogError('Failed to load explosion: ', explosionURL,
                               ' - using default')
                 gfx = trinity.Load(
                     'res:/Model/Effect/Explosion/entityExplode_large.red')
             if gfx.__bluetype__ == 'trinity.EveEffectRoot':
                 self.LogWarn(
                     'EveEffectRoot explosion not managed for %s. ExplosionManager circumvented.'
                     % explosionURL)
                 gfx.Start()
             elif gfx.__bluetype__ != 'trinity.EveRootTransform':
                 root = trinity.EveRootTransform()
                 root.children.append(gfx)
                 root.name = explosionURL
                 gfx = root
         gfx.translationCurve = self
         self.explosionModel = gfx
         scale = scaling
         gfx.scaling = (gfx.scaling[0] * scale, gfx.scaling[1] * scale,
                        gfx.scaling[2] * scale)
         scene = sm.StartService('sceneManager').GetRegisteredScene(
             'default')
         scene.objects.append(gfx)
     if self.wreckID is not None:
         wreckBall = sm.StartService('michelle').GetBall(self.wreckID)
         if wreckBall is not None:
             uthread.pool('Wreck::DisplayWreck', wreckBall.DisplayWreck,
                          500)
     return delayedRemove
Beispiel #13
0
 def CreateScene(self):
     self.LogInfo('CreateScene')
     self.planetScene = self.GetPlanetScene()
     self.planetRoot = trinity.EveRootTransform()
     self.planetRoot.name = 'planetRoot'
     self.planetScene.objects.append(self.planetRoot)
     self.LoadPlanet()
     self.LoadOrbitalObjects(self.planetScene)
     camera = PlanetCamera()
     camera.translationFromParent = PLANET_ZOOM_MAX
     sm.GetService('sceneManager').RegisterCamera(camera)
     sm.GetService('sceneManager').RegisterScene(self.planetScene, 'planet')
    def Prepare(self, addToScene=True):
        shipBall = self.GetEffectShipBall()
        self.position = shipBall.GetVectorAt(blue.os.GetSimTime())
        self.position = (self.position.x, self.position.y, self.position.z)
        if WarpFlashIn._bigGlows < 5:
            gfx = trinity.Load('res:/fisfx/jump/warp/warp_in_glow.red')
            WarpFlashIn._bigGlows += 1
            self.useBigGlow = True
        else:
            gfx = trinity.Load('res:/fisfx/jump/warp/warp_in_noglow.red')
            self.useBigGlow = False
        if gfx is None:
            return
        self.gfx = gfx
        model = getattr(shipBall, 'model', None)
        if model is None:
            return
        s = 0.7778 * model.GetBoundingSphereRadius()**0.3534
        gfx.scaling = (s, s, s)
        self.gfx_ship = trinity.Load('res:/fisfx/jump/warp/warp_glow.red')

        def _glowScale(x):
            return 9e-08 * x * x + 0.005 * x + 0.6898

        self.gfxModel_ship = trinity.EveRootTransform()
        self.gfxModel_ship.children.append(self.gfx_ship)
        r = 0.125 * _glowScale(model.boundingSphereRadius)
        self.gfxModel_ship.scaling = (r, r, r * 3)
        self.gfxBall = self._SpawnClientBall(self.position)
        for each in gfx.Find('trinity.EveTransform'):
            each.useLodLevel = False

        gfxModel = trinity.EveRootTransform()
        gfxModel.children.append(gfx)
        gfxModel.translationCurve = self.gfxBall
        self.gfxModel = gfxModel
        self.soundEvent = 'warp_in_frig_play'
        if model.GetBoundingSphereRadius() > 350:
            self.soundEvent = 'warp_in_battle_play'
        self.AddSoundToEffect(0.001)
def CreateMiniballObject(name, miniballs):
    t = trinity.EveRootTransform()
    sphere = blue.resMan.LoadObject('res:/Model/Global/Miniball.red')
    if len(miniballs) > 0:
        for miniball in miniballs:
            mball = sphere.CopyTo()
            mball.translation = (miniball.x, miniball.y, miniball.z)
            r = miniball.radius * 2
            mball.scaling = (r, r, r)
            t.children.append(mball)

    t.name = name
    return t
Beispiel #16
0
 def Prepare(self, addToScene=True):
     shipBall = self.GetEffectShipBall()
     if shipBall is None:
         raise RuntimeError('ShipEffect: no ball found:' + self.__guid__)
     self.gfx = self.RecycleOrLoad(self.graphicFile)
     if self.gfx is None:
         raise RuntimeError('ShipEffect: no effect found:' + self.__guid__)
     self.AddSoundToEffect(2)
     if type(self.gfx) == trinity.EveTransform:
         self.gfxModel = trinity.EveRootTransform()
         self.gfxModel.children.append(self.gfx)
     else:
         self.gfxModel = self.gfx
     self.gfxModel.modelRotationCurve = getattr(shipBall.model,
                                                'modelRotationCurve', None)
     self.gfxModel.modelTranslationCurve = getattr(shipBall.model,
                                                   'modelTranslationCurve',
                                                   None)
     effectBall = shipBall
     if FX_TF_POSITION_BALL in self.transformFlags:
         self.gfxModel.translationCurve = self.GetBallPositionCurve(
             shipBall)
     if FX_TF_POSITION_MODEL in self.transformFlags:
         behavior = trinity.EveLocalPositionBehavior.centerBounds
         self.gfxModel.translationCurve = trinity.EveLocalPositionCurve(
             behavior)
         self.gfxModel.translationCurve.parent = shipBall.model
     if FX_TF_POSITION_TARGET in self.transformFlags:
         effectBall = self.GetEffectTargetBall()
         self.gfxModel.translationCurve = self.GetBallPositionCurve(
             effectBall)
     if FX_TF_SCALE_BOUNDING in self.transformFlags:
         shipBBoxMin, shipBBoxMax = effectBall.model.GetLocalBoundingBox()
         bBox = (max(-shipBBoxMin[0], shipBBoxMax[0]) * 1.2,
                 max(-shipBBoxMin[1], shipBBoxMax[1]) * 1.2,
                 max(-shipBBoxMin[2], shipBBoxMax[2]) * 1.2)
         self.gfxModel.scaling = bBox
     elif FX_TF_SCALE_SYMMETRIC in self.transformFlags:
         radius = effectBall.model.GetBoundingSphereRadius()
         self.gfxModel.scaling = (radius, radius, radius)
         self.gfx.translation = (0, 0, 0)
     elif FX_TF_SCALE_RADIUS in self.transformFlags:
         radius = effectBall.model.GetBoundingSphereRadius()
         self.gfxModel.scaling = (radius, radius, radius)
     if FX_TF_ROTATION_BALL in self.transformFlags:
         self.gfxModel.rotationCurve = effectBall
     self.gfxModel.name = self.__guid__
     if addToScene:
         self.AddToScene(self.gfxModel)
Beispiel #17
0
 def EnableDebug(self):
     scaling = [(self.ship.radius + 20) * 2, (self.ship.radius + 20) * 2,
                (self.ship.radius + 20) * 2]
     self.localModel = trinity.EveRootTransform()
     self.localGfx = trinity.Load('res:/model/global/gridSphere.red')
     self.localGfx.scaling = geo2.Vec3Scale(scaling, 1.0)
     self.localModel.name = 'FlightSimulationLocal'
     self.localModel.translationCurve = self.ball
     self.localModel.rotationCurve = self.ball
     self.localModel.children.append(self.localGfx)
     sm.GetService('sceneManager').GetRegisteredScene(
         'default').objects.append(self.localModel)
     self.remoteModel = trinity.EveRootTransform()
     self.remoteGfx = trinity.Load('res:/model/global/gridSphere.red')
     self.remoteGfx.scaling = geo2.Vec3Scale(scaling, 1.5)
     color = self.remoteGfx.mesh.additiveAreas[0].effect.parameters[1].value
     self.remoteGfx.mesh.additiveAreas[0].effect.parameters[1].value = (
         color[0], color[2], color[1], color[3])
     self.remoteModel.name = 'FlightSimulationRemote'
     self.remoteModel.translationCurve = self.ship
     self.remoteModel.rotationCurve = self.ship
     self.remoteModel.children.append(self.remoteGfx)
     sm.GetService('sceneManager').GetRegisteredScene(
         'default').objects.append(self.remoteModel)
     self.curveModel = trinity.EveRootTransform()
     self.curveGfx = trinity.Load('res:/model/global/gridSphere.red')
     self.curveGfx.scaling = geo2.Vec3Scale(scaling, 1.25)
     color = self.curveGfx.mesh.additiveAreas[0].effect.parameters[1].value
     self.curveGfx.mesh.additiveAreas[0].effect.parameters[1].value = (
         color[2], color[1], color[0], color[3])
     self.curveModel.name = 'FlightSimulationRemote'
     self.curveModel.translationCurve = self.ball
     self.curveModel.rotationCurve = self.curve
     self.curveModel.children.append(self.curveGfx)
     sm.GetService('sceneManager').GetRegisteredScene(
         'default').objects.append(self.curveModel)
Beispiel #18
0
 def FakeWarp(self):
     blue.pyos.synchro.SleepSim(random.randint(100, 1000))
     url = 'res:/Model/Effect3/ProbeWarp.red'
     gfx = trinity.Load(url)
     if gfx.__bluetype__ != 'trinity.EveRootTransform':
         root = trinity.EveRootTransform()
         root.children.append(gfx)
         root.name = url
         gfx = root
     gfx.translationCurve = self
     scene = sm.StartService('sceneManager').GetRegisteredScene('default')
     scene.objects.append(gfx)
     uthread.pool('ScannerProbe::HideBall', self.HideBall)
     uthread.pool('ScannerProbe::DelayedRemove', self.DelayedRemove, 3000,
                  self.model)
     uthread.pool('ScannerProbe::DelayedRemove', self.DelayedRemove, 3000,
                  gfx)
Beispiel #19
0
 def Prepare(self):
     self.ball = self._SpawnClientBall(self.position)
     gfx = trinity.Load('res:/dx9/model/effect/mjd_effect_jump.red')
     if gfx is None:
         return
     model = getattr(self.GetEffectShipBall(), 'model', None)
     if model is None:
         return
     radius = model.GetBoundingSphereRadius()
     gfx.scaling = (radius, radius, radius)
     self.gfxModel = trinity.EveRootTransform()
     self.gfxModel.children.append(gfx)
     self.gfxModel.boundingSphereRadius = radius
     self.gfxModel.translationCurve = self.ball
     self.sourceObject = self.gfxModel
     self.gfx = gfx
     self.AddSoundToEffect(2)
Beispiel #20
0
 def Prepare(self, shipBall, destSystem):
     self.shipBall = shipBall
     self.ending = False
     self.effectRoot = trinity.EveRootTransform()
     self.effect = blue.resMan.LoadObject('res:/fisfx/jump/jumpgates/tunnel.red')
     self.effectRoot.children.append(self.effect)
     self._FindCurveSets(self.effect)
     sceneManager = sm.GetService('sceneManager')
     self.camera = sceneManager.GetRegisteredCamera('default')
     self.camera.useExtraTranslation = True
     self.camera.extraTranslation = (0, 0, 0)
     transition = sm.GetService('viewState').GetTransitionByName('inflight', 'inflight')
     transition.SetTransitionEffect(self)
     self.transition = transition
     destNebulaPath = sceneManager.GetNebulaPathForSystem(destSystem)
     self._ApplyTexturePath(self.effect.mesh.transparentAreas[0].effect, 'NebulaMap', destNebulaPath)
     self._CreateCameraShakeCurves()
 def FakeWarp(self):
     blue.pyos.synchro.SleepSim(random.randint(100, 1000))
     url = 'res:/Model/Effect3/ProbeWarp.red'
     gfx = trinity.Load(url)
     if gfx.__bluetype__ != 'trinity.EveRootTransform':
         root = trinity.EveRootTransform()
         root.children.append(gfx)
         root.name = url
         gfx = root
     gfx.translationCurve = self
     scene = self.spaceMgr.GetScene()
     if scene is not None:
         scene.objects.append(gfx)
     uthread.pool('ScannerProbe::HideBall', self.HideBall)
     uthread.pool('ScannerProbe::DelayedRemove', self.DelayedRemove, 3000,
                  self.model)
     uthread.pool('ScannerProbe::DelayedRemove', self.DelayedRemove, 3000,
                  gfx)
Beispiel #22
0
 def Explode(self):
     if not gfxsettings.Get(gfxsettings.UI_EXPLOSION_EFFECTS_ENABLED):
         return self.exploded
     if self.radius < 100.0:
         explosionURL = entityExplosionsS[self.typeID % 3]
     elif self.radius < 400.0:
         explosionURL = entityExplosionsM[self.typeID % 3]
     elif self.radius <= 900.0:
         explosionURL = entityExplosionsL[self.typeID % 3]
     if self.radius <= 900.0:
         return SpaceObject.Explode(self, explosionURL)
     if self.exploded:
         return False
     self.exploded = True
     exlosionBasePath = 'res:/Emitter/tracerexplosion/'
     if self.radius > 3000.0:
         extraPath = 'StructureDeathRadius1500.blue'
     elif self.radius > 1500.0:
         extraPath = 'StructureDeathRadius1000.blue'
     else:
         extraPath = 'StructureDeathRadius500.blue'
     explosionURL = exlosionBasePath + extraPath
     gfx = trinity.Load(explosionURL.replace('.blue', '.red'))
     if gfx is None:
         return False
     explodingObjectDisplay = [
         x for x in gfx.curveSets if x.name == 'ExplodingObjectDisplay'
     ]
     if gfx.__bluetype__ != 'trinity.EveRootTransform':
         root = trinity.EveRootTransform()
         root.children.append(gfx)
         root.name = explosionURL
         gfx = root
     self.model.translationCurve = self
     self.model.rotationCurve = None
     gfx.translationCurve = self
     self.explosionModel = gfx
     scene = self.spaceMgr.GetScene()
     scene.objects.append(gfx)
     if len(explodingObjectDisplay):
         explodingObjectDisplay = explodingObjectDisplay[0]
         explodingObjectDisplay.bindings[0].destinationObject = self.model
         self.explosionDisplayBinding = explodingObjectDisplay.bindings[0]
     return True
Beispiel #23
0
 def Explode(self):
     if not settings.user.ui.Get('explosionEffectsEnabled', 1):
         return self.exploded
     if self.radius < 100.0:
         explosionURL = entityExplosionsS[self.typeID % 3]
     elif self.radius < 400.0:
         explosionURL = entityExplosionsM[self.typeID % 3]
     elif self.radius <= 900.0:
         explosionURL = entityExplosionsL[self.typeID % 3]
     if self.radius <= 900.0:
         return spaceObject.SpaceObject.Explode(self, explosionURL)
     if self.exploded:
         return False
     self.exploded = True
     exlosionBasePath = 'res:/Emitter/tracerexplosion/'
     if self.radius > 3000.0:
         extraPath = 'StructureDeathRadius1500.blue'
     elif self.radius > 1500.0:
         extraPath = 'StructureDeathRadius1000.blue'
     else:
         extraPath = 'StructureDeathRadius500.blue'
     explosionURL = exlosionBasePath + extraPath
     gfx = trinity.Load(explosionURL.replace('.blue', '.red'))
     if gfx is None:
         return False
     explodingObjectDisplay = [
         x for x in gfx.curveSets if x.name == 'ExplodingObjectDisplay'
     ]
     if gfx.__bluetype__ != 'trinity.EveRootTransform':
         root = trinity.EveRootTransform()
         root.children.append(gfx)
         root.name = explosionURL
         gfx = root
     self.model.translationCurve = self
     self.model.rotationCurve = None
     gfx.translationCurve = self
     self.explosionModel = gfx
     scene = sm.StartService('sceneManager').GetRegisteredScene('default')
     scene.objects.append(gfx)
     if len(explodingObjectDisplay):
         explodingObjectDisplay = explodingObjectDisplay[0]
         explodingObjectDisplay.bindings[0].destinationObject = self.model
         self.explosionDisplayBinding = explodingObjectDisplay.bindings[0]
     return True
 def __init__(self,
              solarsystemID,
              scene=None,
              scaling=1.0,
              position=None,
              markersHandler=None):
     self.scene = scene
     self.solarsystemID = solarsystemID
     self.scaling = scaling
     self.bracketsByID = {}
     self.systemMapSvc = sm.GetService('systemmap')
     self.markersHandler = markersHandler
     self.localMarkerIDs = set()
     parent = trinity.EveRootTransform()
     parent.name = 'solarsystem_%s' % solarsystemID
     self.systemMapTransform = parent
     if scene:
         scene.objects.append(self.systemMapTransform)
     if position:
         self.SetPosition(position)
Beispiel #25
0
 def Prepare(self, addToScene=True):
     shipBall = self.GetEffectShipBall()
     if shipBall is None:
         raise RuntimeError('ShipEffect: no ball found:' + self.__guid__)
     self.gfx = self.RecycleOrLoad(self.graphicFile)
     if self.gfx is None:
         raise RuntimeError('ShipEffect: no effect found:' + self.__guid__)
     self.AddSoundToEffect(2)
     self.gfxModel = trinity.EveRootTransform()
     if shipBall.model.__bluetype__ == 'trinity.EveShip2':
         self.gfxModel.modelRotationCurve = shipBall.model.modelRotationCurve
         self.gfxModel.modelTranslationCurve = shipBall.model.modelTranslationCurve
     self.gfxModel.children.append(self.gfx)
     import effects
     effectBall = shipBall
     if effects.FX_TF_POSITION_BALL & self.transformFlags:
         self.gfxModel.translationCurve = shipBall
     if effects.FX_TF_POSITION_MODEL & self.transformFlags:
         self.gfxModel.translationCurve = trinity.EveSO2ModelCenterPos()
         self.gfxModel.translationCurve.parent = shipBall.model
     if effects.FX_TF_POSITION_TARGET & self.transformFlags:
         effectBall = self.GetEffectTargetBall()
         self.gfxModel.translationCurve = effectBall
     if effects.FX_TF_SCALE_BOUNDING & self.transformFlags:
         shipBBoxMin, shipBBoxMax = effectBall.model.GetLocalBoundingBox()
         bBox = (max(-shipBBoxMin[0], shipBBoxMax[0]) * 1.2,
                 max(-shipBBoxMin[1], shipBBoxMax[1]) * 1.2,
                 max(-shipBBoxMin[2], shipBBoxMax[2]) * 1.2)
         self.gfxModel.scaling = bBox
     elif effects.FX_TF_SCALE_SYMMETRIC & self.transformFlags:
         radius = effectBall.model.GetBoundingSphereRadius()
         self.gfxModel.scaling = (radius, radius, radius)
         self.gfx.translation = (0, 0, 0)
     elif effects.FX_TF_SCALE_RADIUS & self.transformFlags:
         radius = effectBall.model.GetBoundingSphereRadius()
         self.gfxModel.scaling = (radius, radius, radius)
     if effects.FX_TF_ROTATION_BALL & self.transformFlags:
         self.gfxModel.rotationCurve = effectBall
     self.gfxModel.name = self.__guid__
     if addToScene:
         self.AddToScene(self.gfxModel)
    def ReplaceObjectBall(self, ballID, slimItem):
        """
        Replaces the ball of an object with a very small, fake ball that is used to
        safely move the object during editing.
        """
        if ballID in self.fakeBallTransforms:
            return
        targetBall = sm.GetService('michelle').GetBall(ballID)
        targetModel = getattr(targetBall, 'model', None)
        modelWaitEntryTime = blue.os.GetWallclockTime()
        if slimItem.groupID not in self.groupsWithNoModel:
            while not targetModel:
                blue.pyos.synchro.SleepWallclock(100)
                targetModel = getattr(targetBall, 'model', None)
                if blue.os.GetWallclockTime(
                ) > modelWaitEntryTime + const.SEC * 15.0:
                    self.LogError(
                        'ReplaceObjectBall gave up on waiting for the object model to load.'
                    )
                    return False

        bp = sm.GetService('michelle').GetBallpark()
        replacementBall = bp.AddBall(-ballID, 1.0, 0.0, 0, 0, 0, 0, 0, 0,
                                     targetBall.x, targetBall.y, targetBall.z,
                                     0, 0, 0, 0, 1.0)
        replacementBall = FakeBall(replacementBall)
        replacementBall.__dict__['id'] = ballID
        tf = trinity.EveRootTransform()
        tf.translationCurve = replacementBall
        if targetModel and targetModel.rotationCurve and hasattr(
                targetModel.rotationCurve, 'value'):
            tf.rotationCurve = targetModel.rotationCurve
        elif hasattr(targetModel, 'rotation'):
            tf.rotationCurve = trinity.TriRotationCurve()
            tf.rotationCurve.value = targetModel.rotation
        self.fakeBallTransforms[ballID] = tf
        if targetModel:
            self.backupTranslations[ballID] = targetModel.translationCurve
            self.backupRotations[ballID] = targetModel.rotationCurve
            targetModel.translationCurve = tf.translationCurve
            targetModel.rotationCurve = tf.rotationCurve
Beispiel #27
0
    def RefreshSelection_thread(self):
        if getattr(self, 'refreshingSelection', None) != None:
            return
        self.refreshingSelection = 1
        if not self.isActive:
            self.ShowCursor()
        scene = sm.GetService('sceneManager').GetRegisteredScene('default')
        dungeonEditorObjects = [
            obj for obj in scene.objects if obj.name == '_dungeon_editor_'
        ]
        for obj in dungeonEditorObjects:
            scene.objects.fremove(obj)

        bp = sm.GetService('michelle').GetBallpark()
        if bp is None:
            self.refreshingSelection = None
            return
        balls = []
        self.HideCursor()
        showAggrRadius = settings.user.ui.Get('showAggrRadius', 0)
        aggrSettingsAll = settings.user.ui.Get('aggrSettingsAll', 0)
        if showAggrRadius == 1 or aggrSettingsAll == 1:
            aggrSphere = blue.resMan.LoadObject(
                'res:/model/global/gridSphere.red')
            aggrSphere.scaling = (1, 1, 1)
        for ballID in bp.balls:
            ball = bp.GetBall(ballID)
            if ball is None:
                continue
            slimItem = sm.GetService('michelle').GetItem(ballID)
            if slimItem and slimItem.dunObjectID in self.lockedObjects:
                if self.lockedObjects[slimItem.dunObjectID] > 0:
                    scale = 1.5
                    self.AddBoundingCube(ball,
                                         blue.resMan.LoadObject(
                                             'res:/Model/UI/redGlassCube.red'),
                                         scale=scale)
                    balls.append(ball)
                else:
                    scale = 1.5
                    self.AddBoundingCube(
                        ball,
                        blue.resMan.LoadObject(
                            'res:/Model/UI/yellowGlassCube.red'),
                        scale=scale)
                    balls.append(ball)

        for ballID in self.selection[:]:
            ball = bp.GetBall(ballID)
            if ball is None:
                self.selection.remove(ballID)
                continue
            scale = 1.5
            self.AddBoundingCube(
                ball,
                blue.resMan.LoadObject('res:/Model/UI/blueLineCube.red'),
                scale=scale)
            balls.append(ball)

        if aggrSettingsAll == 1 or showAggrRadius == 1:
            if aggrSettingsAll == 1:
                slimItems = self.GetDunObjects()
            else:
                slimItems = self.GetSelObjects()
            self.LogInfo('ScenarioMgr: showAggrRadius')
            for slimItem in slimItems:
                if hasattr(slimItem, 'dunGuardCommands'):
                    gc = slimItem.dunGuardCommands
                    if gc == None:
                        continue
                    aggressionRange = gc.aggressionRange
                    ball = bp.GetBall(slimItem.itemID)
                    aggrSphereInst = trinity.EveRootTransform()
                    aggrSphereInst.name = '_dungeon_editor_'
                    aggrSphereInst.children.append(aggrSphere.CloneTo())
                    aggrSphereInst.translationCurve = ball
                    aggrSphereInst.scaling = (aggressionRange * 2,
                                              aggressionRange * 2,
                                              aggressionRange * 2)
                    scene.objects.append(aggrSphereInst)

        if len(balls):
            self.ShowCursor()
        self.LogInfo('ScenarioMgr: RefreshSelection Done')
        self.refreshingSelection = None
Beispiel #28
0
 def LoadModel(self):
     model = None
     model = trinity.EveRootTransform()
     spaceObject.SpaceObject.LoadModel(self, fileName='', loadedModel=model)
 def Explode(self,
             explosionURL=None,
             scaling=1.0,
             managed=False,
             delay=0.0):
     """
     Makes the spaceobject explode.
     Arguments:
         explosionURL is the path to the explosion asset
         scaling controls additionsl scaling of the explosion asset
         managed determines whether to use the explosionManager to manage the explosion
         delay is the delay with which to hide the exploding spaceobject during the explosion
     """
     self.LogInfo('Exploding')
     if self.exploded:
         return False
     self.sm.ScatterEvent('OnObjectExplode', self.GetModel())
     self.exploded = True
     delayedRemove = delay
     self.explodedTime = blue.os.GetTime()
     if gfxsettings.Get(gfxsettings.UI_EXPLOSION_EFFECTS_ENABLED):
         if managed:
             gfx = self.explosionManager.GetExplosion(
                 explosionURL, callback=self.ClearExplosion)
         else:
             if explosionURL is None:
                 self.LogError(
                     'explosionURL not set when calling Explode. Possibly wrongly authored content. typeID:',
                     self.typeID)
                 explosionURL, (delay, scaling) = self.GetExplosionInfo()
             explosionURL = explosionURL.replace('.blue', '.red').replace(
                 '/Effect/', '/Effect3/')
             gfx = trinity.Load(explosionURL)
             if not gfx:
                 self.LogError('Failed to load explosion: ', explosionURL,
                               ' - using default')
                 gfx = trinity.Load(
                     'res:/Model/Effect3/Explosion/entityExplode_large.red')
             if gfx.__bluetype__ == 'trinity.EveEffectRoot':
                 msg = 'ExplosionManager circumvented, explosion not managed for %s. (Class:%s, Type:%s)'
                 self.LogWarn(
                     msg %
                     (explosionURL, self.__class__.__name__, self.typeID))
                 gfx.Start()
             elif gfx.__bluetype__ != 'trinity.EveRootTransform':
                 root = trinity.EveRootTransform()
                 root.children.append(gfx)
                 root.name = explosionURL
                 gfx = root
         gfx.translationCurve = self
         self.explosionModel = gfx
         scale = scaling
         gfx.scaling = (gfx.scaling[0] * scale, gfx.scaling[1] * scale,
                        gfx.scaling[2] * scale)
         scene = self.spaceMgr.GetScene()
         scene.objects.append(gfx)
     if self.wreckID is not None:
         wreckBall = self.sm.StartService('michelle').GetBall(self.wreckID)
         if wreckBall is not None:
             uthread2.StartTasklet(wreckBall.DisplayWreck, delayedRemove)
     return delayedRemove
Beispiel #30
0
 def __init__(self):
     self.model = trinity.EveRootTransform()