GE Lua Documentation

Press F to search!

settingsSetEnabled

Definition


-- @/lua/ge/client/postFx.lua:278

M.settingsSetEnabled = function(enablePostFX)
  TorqueScriptLua.setVar("$PostFX::Enabled", enablePostFX)
  -- if to enable the postFX, apply the ones that are enabled
  if enablePostFX then
    -- SSAO, HDR, LightRays, DOF
    local dof = scenetree.findObject("DOFPostEffect")
    local ssao = scenetree.findObject("SSAOPostFx")
    local lightRay = scenetree.findObject("LightRayPostFX")
    local hdrPostFx = scenetree.findObject("HDRPostFx")

    if ssao then
      if TorqueScriptLua.getBoolVar("$SSAOPostFx::Enable") then
        ssao:enable()
      else
        ssao:disable()
        end
    end

    if lightRay then
      if TorqueScriptLua.getBoolVar("$LightRayPostFX::Enable") then
        lightRay:enable()
      else
        lightRay:disable()
      end
    end

    if dof then
      if TorqueScriptLua.getBoolVar("$DOFPostFx::Enable") then
        dof:enable()
      else
        dof:disable()
      end
    end

    -- log('I','postfx',"PostFX Manager - PostFX enabled")
  else
    -- Disable all postFX
    if ssao then ssao:disable() end
    if hdr then hdr:disable() end
    if lightRay then lightRay:disable() end
    if dof then dof:disable() end

    -- log('I','postfx',"PostFX Manager - PostFX disabled")
  end
end

Callers

@/lua/ge/client/postFx.lua
  TorqueScriptLua.setVar("$PostFX::Enabled",  enablePostFX)
  M.settingsSetEnabled(enablePostFX)
end