def removeEffect(effect): ch = list(PostProcessing.chain()) try: ch.remove(effect) PostProcessing.chain(ch) except ValueError: pass
def disable(self): self.__curMode = None for effect in self.__curEffects: effect.disable() self.__curEffects = [] PostProcessing.chain([])
def detach(self, actor, source, target = None): ch = PostProcessing.chain() for effect in actor: try: ch.remove(effect) except ValueError: pass PostProcessing.chain(ch)
def init(self): self.__loadSettings() PostProcessing.g_graphicsSettingListeners.append(_FuncObj(self, 'onSelectQualityOption')) PostProcessing.init() PostProcessing.chain(None) section = ResMgr.openSection(WGPostProcessing.__CONFIG_FILE_NAME) self.__load(section) for mode in self.__modes.itervalues(): for effect in mode: effect.create()
def onBlurred(self, callbackFn): import PostProcessing c = list(PostProcessing.chain()) ch = [] for e in c: if e.name != 'Teleport Progress Bar': ch.append(e) PostProcessing.chain(ch) if callbackFn: callbackFn()
def enable(self, mode): if self.__modes.get(mode, None) is None: LOG_WARNING('Effect mode with name %s was not found.' % mode) return self.__curMode = mode self.__gatherEffects('common') self.__gatherEffects(mode) chain = [] for effect in self.__curEffects: chain += effect.enable(self.__settings) PostProcessing.chain(chain)
def preTeleport(self, callbackFn): import PostProcessing effect = PostProcessing.blur() effect.name = 'Teleport Progress Bar' effect.phases[-1].renderTarget = BigWorld.RenderTarget('teleportGobo', -3, -3) effect.phases[-1].material.additionalAlpha = 1.0 c = list(PostProcessing.chain()) c.append(effect) PostProcessing.chain(c) self.component.secondaryTexture = effect.phases[-1].renderTarget.texture self.component.freeze = None self.component.fader.value = 1.0 BigWorld.callback(self.component.fader.speed, lambda : self.onBlurred(callbackFn)) return
def init(self): self.__loadSettings() PostProcessing.g_graphicsSettingListeners.append(_FuncObj(self, 'onSelectQualityOption')) PostProcessing.init() PostProcessing.chain(None) section = ResMgr.openSection(WGPostProcessing.__CONFIG_FILE_NAME) self.__load(section) for mode in self.__modes.itervalues(): for effect in mode: effect.create() from account_helpers.SettingsCore import g_settingsCore g_settingsCore.onSettingsChanged += self.__onSettingsChanging return
def getShimmerEffect(): import PostProcessing c = PostProcessing.chain() for e in c: if e.name == 'heatShimmer': return e return
def _getBloomEffect(): """ This function finds the bloom effect in the post-processing chain """ chain = PostProcessing.chain() for e in chain: if e.name in ('Bloom', 'bloom'): return e return None
def loadStyle(ds, fadeSpeed = 1.0): """ This function loads a bloom style from the given data section. It smoothly changes from the current bloom settings to the new settings over "fadeSpeed" seconds. """ newBloom = None if ds != None: enable = ds.readBool('enable', True) filterMode = ds.readInt('filterMode', 1) bloomBlur = ds.readBool('bloomAndBlur', True) attenuation = ds.readVector4('attenuation', (1, 1, 1, 1)) attenuation *= attenuation.w attenuation.w = 1.0 numPasses = ds.readInt('numPasses', 2) power = ds.readFloat('power', 8) width = ds.readFloat('width', 1.0) if bloomBlur: newBloom = PostProcessing.Effects.Bloom.bloom(filterMode, attenuation, numPasses, width, power) else: newBloom = PostProcessing.Effects.Bloom.blur(filterMode, attenuation, numPasses, width) else: print 'Bloom.loadStyle : No DataSection was provided' return ch = list(PostProcessing.chain()) oldBloomList = _getBloomEffects() for oldBloom in oldBloomList: v4mDn = Math.Vector4Morph((1, 1, 1, 1)) v4mDn.duration = fadeSpeed v4mDn.target = (0, 0, 0, 0) oldBloom.phases[-1].material.alpha = v4mDn oldBloom.bypass = v4mDn BigWorld.callback(fadeSpeed, partial(removeEffect, oldBloom)) ch.append(newBloom) v4mUp = Math.Vector4Morph((0, 0, 0, 0)) v4mUp.duration = fadeSpeed v4mUp.target = (1, 1, 1, 1) newBloom.phases[-1].material.alpha = v4mUp newBloom.bypass = v4mUp PostProcessing.chain(ch) return
def _getBloomEffects(): """ This function finds all bloom effects in the post-processing chain """ blooms = [] chain = PostProcessing.chain() for e in chain: if e.name in ('Bloom', 'bloom'): blooms.append(e) return blooms
def _getBloomEffects(): """ This function finds all bloom effects in the post-processing chain """ blooms = [] chain = PostProcessing.chain() for e in chain: if e.name in ('Bloom', 'bloom'): blooms.append(e) return blooms
def attach(self, actor, source, target = None): ch = PostProcessing.chain() ch += actor PostProcessing.chain(ch)
def attach(self, actor, source, target = None): ch = PostProcessing.chain() ch += actor PostProcessing.chain(ch)