Example #1
0
 def ReduceCharacterGraphics(self):
     gfxsettings.Set(gfxsettings.GFX_CHAR_FAST_CHARACTER_CREATION,
                     True,
                     pending=False)
     gfxsettings.Set(gfxsettings.GFX_CHAR_CLOTH_SIMULATION,
                     0,
                     pending=False)
     gfxsettings.Set(gfxsettings.GFX_CHAR_TEXTURE_QUALITY, 2, pending=False)
Example #2
0
 def ReduceCharacterGraphics(self):
     """Sets the graphics to low for character creation"""
     gfxsettings.Set(gfxsettings.GFX_CHAR_FAST_CHARACTER_CREATION,
                     True,
                     pending=False)
     gfxsettings.Set(gfxsettings.GFX_CHAR_CLOTH_SIMULATION,
                     0,
                     pending=False)
     gfxsettings.Set(gfxsettings.GFX_CHAR_TEXTURE_QUALITY, 2, pending=False)
Example #3
0
 def Initialize(self):
     DeviceMgr.Initialize(self)
     aaQuality = gfxsettings.Get(gfxsettings.GFX_ANTI_ALIASING)
     if aaQuality > 0 and self.GetMSAATypeFromQuality(aaQuality) == 0:
         gfxsettings.Set(gfxsettings.GFX_ANTI_ALIASING, 0, pending=False)
     shaderQuality = gfxsettings.Get(gfxsettings.GFX_SHADER_QUALITY)
     if shaderQuality == 3 and gfxsettings.MAX_SHADER_MODEL < gfxsettings.SHADER_MODEL_HIGH:
         gfxsettings.Set(gfxsettings.GFX_SHADER_QUALITY,
                         gfxsettings.SHADER_MODEL_MEDIUM,
                         pending=False)
Example #4
0
 def Initialize(self):
     DeviceMgr.Initialize(self)
     self.msaaTypes = {}
     gfxsettings.ValidateSettings()
     aaQuality = gfxsettings.Get(gfxsettings.GFX_ANTI_ALIASING)
     msaaQuality = gfxsettings.GetMSAAQuality(aaQuality)
     msaaType = self.GetMSAATypeFromQuality(aaQuality)
     if msaaQuality > 0 and msaaType == 0:
         gfxsettings.Set(gfxsettings.GFX_ANTI_ALIASING,
                         gfxsettings.AA_QUALITY_DISABLED,
                         pending=False)
     brightness = gfxsettings.Get(gfxsettings.GFX_BRIGHTNESS)
     trinity.settings.SetValue('eveSpaceSceneGammaBrightness', brightness)
Example #5
0
 def SetUIScaleValue(self, scaleValue, windowed):
     self.LogInfo('SetUIScaleValue', scaleValue, 'windowed', windowed)
     capValue = self.CapUIScaleValue(scaleValue)
     if windowed:
         gfxsettings.Set(gfxsettings.GFX_UI_SCALE_WINDOWED,
                         capValue,
                         pending=False)
     else:
         gfxsettings.Set(gfxsettings.GFX_UI_SCALE_FULLSCREEN,
                         capValue,
                         pending=False)
     if capValue != uicore.desktop.dpiScaling:
         PreUIScaleChange_DesktopLayout = uicontrols.Window.GetDesktopWindowLayout(
         )
         oldValue = uicore.desktop.dpiScaling
         uicore.desktop.dpiScaling = capValue
         uicore.desktop.UpdateSize()
         self.LogInfo('SetUIScaleValue capValue', capValue)
         sm.ScatterEvent('OnUIScalingChange', (oldValue, capValue))
         uicontrols.Window.LoadDesktopWindowLayout(
             PreUIScaleChange_DesktopLayout)
     else:
         self.LogInfo('SetUIScaleValue No Change')
Example #6
0
 def SetToSafeMode(self):
     gfxsettings.Set(gfxsettings.GFX_TEXTURE_QUALITY, 2, pending=False)
     gfxsettings.Set(gfxsettings.GFX_SHADER_QUALITY, 1, pending=False)
     gfxsettings.Set(gfxsettings.GFX_HDR_ENABLED, False, pending=False)
     gfxsettings.Set(gfxsettings.GFX_POST_PROCESSING_QUALITY,
                     0,
                     pending=False)
     gfxsettings.Set(gfxsettings.GFX_SHADOW_QUALITY, 0, pending=False)
     gfxsettings.Set(gfxsettings.MISC_RESOURCE_CACHE_ENABLED,
                     0,
                     pending=False)
Example #7
0
    def SetDevice(self,
                  device,
                  tryAgain=1,
                  fallback=0,
                  keepSettings=1,
                  hideTitle=None,
                  userModified=False,
                  muteExceptions=False,
                  updateWindowPosition=True):
        if hideTitle is None:
            hideTitle = not device.Windowed
        self.LogInfo('SetDevice: tryAgain', tryAgain, 'fallback', fallback,
                     'keepSettings', keepSettings, 'hideTitle', hideTitle,
                     'deviceDict', device.__dict__)
        if not fallback:
            device = self.EnforceDeviceSettings(device)
        self.SanitizeDeviceTypes(device)
        change = self.CheckDeviceDifference(device, getChange=1)
        dev = trinity.device
        if not change and tryAgain and dev.DoesD3DDeviceExist():
            return True
        sm.ChainEvent('ProcessDeviceChange')
        pr = []
        for k, v in device.__dict__.items():
            pr.append((k, v))

        pr.sort()
        msg = 'SetDevice: Found a difference\n'
        for k, v in pr:
            extra = ''
            if k in change:
                extra = '   >> this one changed, it was ' + str(change[k][0])
            msg += '        ' + str(k) + ':    ' + str(v) + extra + '\n'

        self.LogInfo(msg)
        triapp = trinity.app
        if tryAgain:
            self.BackupSettings()
        try:
            triapp.hideTitle = hideTitle
            triapp.AdjustWindowForChange(
                device.Windowed,
                settings.public.device.Get('FixedWindow', False))
            msg = 'SetDevice - trying again\n'
            msg += 'Before:\n'
            msg += repr(device.__dict__) + '\n'
            if device.Adapter not in self.adapters:
                device.Adapter = self.adapters[0]
            device.__dict__.update(
                self.FixupPresentation(device.Adapter, device.__dict__))
            msg += 'After:\n'
            msg += repr(device.__dict__) + '\n'
            self.LogInfo(msg)
            dev = trinity.device
            dev.viewport.width = device.BackBufferWidth
            dev.viewport.height = device.BackBufferHeight
            while True:
                try:
                    triapp.ChangeDevice(device.Adapter, 0, 0, device.__dict__)
                    break
                except trinity.D3DERR_DEVICELOST:
                    blue.pyos.synchro.SleepWallclock(1000)

        except Exception as e:
            import traceback
            self.LogInfo(traceback.format_exc())
            self.LogInfo(repr(device.__dict__))
            if trinity.device.GetRenderingPlatformID() == 2:
                if prefs.HasKey('trinityPreferredPlatform') and prefs.GetValue(
                        'trinityPreferredPlatform') == 'dx11':
                    prefs.SetValue('trinityPreferredPlatform', 'dx9')
                    log.Quit(
                        'Failed to create device under DX11 - setting preferred platform to DX9'
                    )
                else:
                    log.Quit('Failed to create device under DX11')
            if tryAgain and self.settingsBackup:
                sys.exc_clear()
                self.LogInfo(
                    'SetDevice failed, trying again with backup settings')
                return self.SetDevice(self.settingsBackup,
                                      0,
                                      keepSettings=keepSettings)
            if not fallback:
                sys.exc_clear()
                self.LogInfo(
                    'SetDevice with backup settings failed, falling back to savemode'
                )
                set = self.GetSaveMode()
                return self.SetDevice(set,
                                      fallback=1,
                                      tryAgain=0,
                                      hideTitle=not set.Windowed,
                                      keepSettings=False)
            if muteExceptions:
                log.LogException()
                sys.exc_clear()
            self.LogInfo('SetDevice failed completely')
            return False

        if updateWindowPosition:
            self.UpdateWindowPosition(device)
        else:
            wr = triapp.GetWindowRect()
            triapp.SetWindowPos(wr.left, wr.top)
        sm.ScatterEvent('OnSetDevice')
        if uicore.desktop:
            uicore.desktop.UpdateSize()
        if keepSettings:
            set = self.GetSettings()
            keep = set.__dict__
            del keep['hDeviceWindow']
            gfxsettings.Set(gfxsettings.GFX_DEVICE_SETTINGS,
                            keep,
                            pending=False)
            self.settings.SaveSettings()
            self.LogInfo('Keeping device settings:', repr(keep))
            if self.IsWindowed(set):
                val = (set.BackBufferWidth, set.BackBufferHeight)
                gfxsettings.Set(gfxsettings.GFX_RESOLUTION_WINDOWED,
                                val,
                                pending=False)
            else:
                val = (set.BackBufferWidth, set.BackBufferHeight)
                gfxsettings.Set(gfxsettings.GFX_RESOLUTION_FULLSCREEN,
                                val,
                                pending=False)
                if userModified and self.resolutionBackup and self.resolutionBackup != val:
                    self.AskForConfirmation()
        sm.ScatterEvent('OnEndChangeDevice', change)
        unsupportedModels = ['SM_1_1', 'SM_2_0_LO', 'SM_2_0_HI']
        maxCardModel = trinity.GetMaxShaderModelSupported()
        if maxCardModel in unsupportedModels:
            message = localization.GetByLabel(
                '/Carbon/UI/Service/Device/ShaderModelNotSupportedMessage')
            title = localization.GetByLabel(
                '/Carbon/UI/Service/Device/ShaderModelNotSupportedTitle')
            blue.os.ShowErrorMessageBox(title, message)
            bluepy.Terminate('Shader Model version check failed')
        return True
 def Apply(self):
     if self.combo.selectedValue is None:
         return
     value = self.combo.selectedValue
     if value == 3:
         gfxsettings.Set(gfxsettings.GFX_TEXTURE_QUALITY, 0)
         gfxsettings.Set(gfxsettings.GFX_SHADER_QUALITY,
                         gfxsettings.MAX_SHADER_MODEL)
         gfxsettings.Set(gfxsettings.GFX_SHADOW_QUALITY, 2)
         gfxsettings.Set(gfxsettings.GFX_HDR_ENABLED, 1)
         gfxsettings.Set(gfxsettings.GFX_POST_PROCESSING_QUALITY, 2)
         gfxsettings.Set(gfxsettings.MISC_RESOURCE_CACHE_ENABLED, 0)
         gfxsettings.Set(gfxsettings.GFX_LOD_QUALITY, 3)
         gfxsettings.Set(gfxsettings.GFX_CHAR_FAST_CHARACTER_CREATION, 0)
         gfxsettings.Set(gfxsettings.GFX_CHAR_CLOTH_SIMULATION, 1)
         gfxsettings.Set(gfxsettings.GFX_CHAR_TEXTURE_QUALITY, 0)
         gfxsettings.Set(gfxsettings.GFX_ANTI_ALIASING, 2)
         if eve.session.userid:
             gfxsettings.Set(gfxsettings.UI_DRONE_MODELS_ENABLED, 1)
             gfxsettings.Set(gfxsettings.UI_EFFECTS_ENABLED, 1)
             gfxsettings.Set(gfxsettings.UI_MISSILES_ENABLED, 1)
             gfxsettings.Set(gfxsettings.UI_EXPLOSION_EFFECTS_ENABLED, 1)
             gfxsettings.Set(gfxsettings.UI_TURRETS_ENABLED, 1)
             gfxsettings.Set(gfxsettings.UI_TRAILS_ENABLED, 1)
             gfxsettings.Set(gfxsettings.UI_GPU_PARTICLES_ENABLED, 1)
             gfxsettings.Set(gfxsettings.UI_GODRAYS, 1)
             gfxsettings.Set(gfxsettings.UI_ASTEROID_ATMOSPHERICS, 1)
             gfxsettings.Set(gfxsettings.UI_SHIPSKINSINSPACE_ENABLED, 1)
     elif value == 2:
         gfxsettings.Set(gfxsettings.GFX_TEXTURE_QUALITY, 1)
         gfxsettings.Set(gfxsettings.GFX_SHADER_QUALITY, 1)
         gfxsettings.Set(gfxsettings.GFX_SHADOW_QUALITY, 0)
         gfxsettings.Set(gfxsettings.GFX_HDR_ENABLED, 0)
         gfxsettings.Set(gfxsettings.GFX_POST_PROCESSING_QUALITY, 0)
         gfxsettings.Set(gfxsettings.MISC_RESOURCE_CACHE_ENABLED, 0)
         gfxsettings.Set(gfxsettings.GFX_LOD_QUALITY, 1)
         gfxsettings.Set(gfxsettings.GFX_CHAR_FAST_CHARACTER_CREATION, 1)
         gfxsettings.Set(gfxsettings.GFX_CHAR_CLOTH_SIMULATION, 0)
         gfxsettings.Set(gfxsettings.GFX_CHAR_TEXTURE_QUALITY, 1)
         gfxsettings.Set(gfxsettings.GFX_ANTI_ALIASING, 0)
         if eve.session.userid:
             gfxsettings.Set(gfxsettings.UI_DRONE_MODELS_ENABLED, 0)
             gfxsettings.Set(gfxsettings.UI_EFFECTS_ENABLED, 0)
             gfxsettings.Set(gfxsettings.UI_MISSILES_ENABLED, 0)
             gfxsettings.Set(gfxsettings.UI_EXPLOSION_EFFECTS_ENABLED, 0)
             gfxsettings.Set(gfxsettings.UI_TURRETS_ENABLED, 0)
             gfxsettings.Set(gfxsettings.UI_TRAILS_ENABLED, 0)
             gfxsettings.Set(gfxsettings.UI_GPU_PARTICLES_ENABLED, 0)
             gfxsettings.Set(gfxsettings.UI_GODRAYS, 0)
             gfxsettings.Set(gfxsettings.UI_ASTEROID_ATMOSPHERICS, 0)
             gfxsettings.Set(gfxsettings.UI_SHIPSKINSINSPACE_ENABLED, 0)
     elif value == 1:
         gfxsettings.Set(gfxsettings.GFX_TEXTURE_QUALITY, 2)
         gfxsettings.Set(gfxsettings.GFX_SHADER_QUALITY, 1)
         gfxsettings.Set(gfxsettings.GFX_SHADOW_QUALITY, 0)
         gfxsettings.Set(gfxsettings.GFX_HDR_ENABLED, 0)
         gfxsettings.Set(gfxsettings.GFX_POST_PROCESSING_QUALITY, 0)
         gfxsettings.Set(gfxsettings.MISC_RESOURCE_CACHE_ENABLED, 0)
         gfxsettings.Set(gfxsettings.GFX_LOD_QUALITY, 2)
         gfxsettings.Set(gfxsettings.GFX_CHAR_FAST_CHARACTER_CREATION, 1)
         gfxsettings.Set(gfxsettings.GFX_CHAR_CLOTH_SIMULATION, 0)
         gfxsettings.Set(gfxsettings.GFX_CHAR_TEXTURE_QUALITY, 2)
         gfxsettings.Set(gfxsettings.GFX_ANTI_ALIASING, 0)
         if eve.session.userid:
             gfxsettings.Set(gfxsettings.UI_DRONE_MODELS_ENABLED, 0)
             gfxsettings.Set(gfxsettings.UI_EFFECTS_ENABLED, 1)
             gfxsettings.Set(gfxsettings.UI_MISSILES_ENABLED, 1)
             gfxsettings.Set(gfxsettings.UI_EXPLOSION_EFFECTS_ENABLED, 1)
             gfxsettings.Set(gfxsettings.UI_TURRETS_ENABLED, 1)
             gfxsettings.Set(gfxsettings.UI_TRAILS_ENABLED, 0)
             gfxsettings.Set(gfxsettings.UI_GPU_PARTICLES_ENABLED, 0)
             gfxsettings.Set(gfxsettings.UI_GODRAYS, 0)
             gfxsettings.Set(gfxsettings.UI_ASTEROID_ATMOSPHERICS, 0)
             gfxsettings.Set(gfxsettings.UI_SHIPSKINSINSPACE_ENABLED, 1)
     self.CloseByUser()
Example #9
0
 def Save(self, *_):
     self.savedValue = self.currentValue
     gfxsettings.Set(gfxsettings.GFX_BRIGHTNESS,
                     self.savedValue,
                     pending=False)
     self.Close()