GE Lua Documentation

Press F to search!

toggleLightVisualizer

Definition


-- @/lua/ge/client/lighting/advanced/lightViz.lua:200

local function toggleLightVisualizer(objName, enable, tsVariable)
  -- log('I','lightViz', 'toggleLightVisualizer called: name = '..tostring(objName)..' enable = '..tostring(enable)..'  var = '..tostring(tsVariable))
  local vizualiser = scenetree.findObject(objName)
  if not vizualiser then
    log('E','lightViz', 'Could not find vizualiser object - '..tostring(objName))
    return
  end

  local isEnabled = vizualiser:isEnabled()
  -- log('I','lightViz', objName..'.enabled = '..tostring(isEnabled))
  if enable == nil or enable == "" then
    TorqueScriptLua.setVar(tsVariable, not isEnabled)
    vizualiser:toggle()
  elseif enable then
    vizualiser:enable()
  else
    vizualiser:disable()
  end
end

Callers

@/lua/ge/client/lighting/advanced/lightViz.lua
rawset(_G, "toggleLightVisualizer", toggleLightVisualizer)
rawset(_G, "toggleAnnotationVisualize",function (enable) toggleLightVisualizer("AnnotationVisualize",        enable, "$AnnotationVisualizeVar") end)
rawset(_G, "toggleDepthViz",           function (enable) toggleLightVisualizer("AL_DepthVisualize",        enable, "$AL_DepthVisualizeVar") end)
rawset(_G, "toggleAnnotationVisualize",function (enable) toggleLightVisualizer("AnnotationVisualize",        enable, "$AnnotationVisualizeVar") end)
rawset(_G, "toggleDepthViz",           function (enable) toggleLightVisualizer("AL_DepthVisualize",        enable, "$AL_DepthVisualizeVar") end)
rawset(_G, "toggleNormalsViz",         function (enable) toggleLightVisualizer("AL_NormalsVisualize",      enable, "$AL_NormalsVisualizeVar") end)
rawset(_G, "toggleDepthViz",           function (enable) toggleLightVisualizer("AL_DepthVisualize",        enable, "$AL_DepthVisualizeVar") end)
rawset(_G, "toggleNormalsViz",         function (enable) toggleLightVisualizer("AL_NormalsVisualize",      enable, "$AL_NormalsVisualizeVar") end)
rawset(_G, "toggleLightColorViz",      function (enable) toggleLightVisualizer("AL_LightColorVisualize",    enable, "$AL_LightColorVisualizeVar") end)
rawset(_G, "toggleNormalsViz",         function (enable) toggleLightVisualizer("AL_NormalsVisualize",      enable, "$AL_NormalsVisualizeVar") end)
rawset(_G, "toggleLightColorViz",      function (enable) toggleLightVisualizer("AL_LightColorVisualize",    enable, "$AL_LightColorVisualizeVar") end)
rawset(_G, "toggleLightSpecularViz",   function (enable) toggleLightVisualizer("AL_LightSpecularVisualize", enable, "$AL_LightSpecularVisualizeVar") end)
rawset(_G, "toggleLightColorViz",      function (enable) toggleLightVisualizer("AL_LightColorVisualize",    enable, "$AL_LightColorVisualizeVar") end)
rawset(_G, "toggleLightSpecularViz",   function (enable) toggleLightVisualizer("AL_LightSpecularVisualize", enable, "$AL_LightSpecularVisualizeVar") end)