Cool VL Viewer forum
http://sldev.free.fr/forum/

Lua scripting: ApplySkySettings()
http://sldev.free.fr/forum/viewtopic.php?f=6&t=1759
Page 1 of 1

Author:  Amalia Illios [ 2017-03-11 15:09:31 ]
Post subject:  Lua scripting: ApplySkySettings()

Hello Henri,

are there any specifics to consider when using ApplySkySettings() beyond what you posted? Somehow it doesn't seem to do anything for me beyond causing a slight jump in cloud rendering.

This is my script:
Code:
function OnLogin(location)                                                                                         
        SideBarButton(1, "\u{1f5be}", "AutomationMessage('photo_off')", "Disable photo settings")                 
        SideBarButton(2, "\u{1f5bc}", "AutomationMessage('photo_on')", "Enable photo settings")                   
        SideBarButton(3, "\u{2699}", "OpenFloater('preferences')", "Opens the Preferences floater")               
        SideBarButton(4, "\u{1f505}", "AutomationMessage('dark_room')", "Dark room setting")                       
        SideBarHideOnRightClick()                                                                                 
        SideBarHide(false)                                                                                         
end                                                                                                               


function OnSideBarVisibilityChange(visible)                                                                       
        if visible then                                                                                           
                StatusBarLuaIcon("")                                                                               
        else                                                                                                       
                StatusBarLuaIcon("SideBarHide(false)", "Shows the Lua buttons side bar")                           
        end                                                                                                       
end                                                                                                               


function SetPhotoModeOn()                                                                                         
        print("Photo mode on");                                                                                   
        SetDebugSetting("TextureLoadFullRes", true)                                                               
        SetDebugSetting("RenderVolumeLODFactor", 6.0)                                                             
        SetDebugSetting("RenderAvatarLODFactor", 3.0)                                                             
        SetDebugSetting("RenderRiggedMeshShadow", 3)                                                               
        SetDebugSetting("RenderDepthOfField", true)                                                               
end                                                                                                               


function SetPhotoModeOff()                                                                                         
        print("Photo mode off");                                                                                   
        SetDebugSetting("TextureLoadFullRes", false)                                                               
        SetDebugSetting("RenderVolumeLODFactor", 3.0)                                                             
        SetDebugSetting("RenderAvatarLODFactor", 1.0)                                                             
        SetDebugSetting("RenderRiggedMeshShadow", 0)                                                               
        SetDebugSetting("RenderDepthOfField", false)                                                               
end                                                                                                               


function SetDarkRoom()                                                                                             
        print("Dark room on");                                                                                     
        ApplySkySettings("A-12AM");                                                                               
end                                                                                                               
                                                                                                                   
                                                                                                                   
function OnAutomationMessage(text)                                                                                 
        if text == "photo_on" then                                                                                 
                SetPhotoModeOn()                                                                                   
        elseif text == "photo_off" then                                                                           
                SetPhotoModeOff()                                                                                 
        elseif text == "dark_room" then                                                                           
                SetDarkRoom()                                                                                     
        end                                                                                                       
end                                                                                                               

No matter what preset I am using, the effect does remain the same. I'm stumped.

Oh, and is there a way to trigger the equivalent of "Revert to region default"? Because loading "Default" would obviously not do that.

Love,
Lia

Author:  Henri Beauchamp [ 2017-03-11 17:12:47 ]
Post subject:  Re: Lua scripting: ApplySkySettings()

Apparently, the A-12AM setting only works when you first override the region settings.

Try CTRL SHIFT Y (set to mid-day) then "/lua ApplySkySettings("A-12AM")" -> working.
Now try "World" -> "Environment settings" -> "Revert to region default" and "/lua ApplySkySettings("A-12AM")" -> not working.

Windlight always was an ugly mess...

Quote:
Oh, and is there a way to trigger the equivalent of "Revert to region default"? Because loading "Default" would obviously not do that.

I'll add a new Lua function for it in next release (I already implemented an OnWindlightChange() event too)...

Author:  Amalia Illios [ 2017-03-12 07:51:25 ]
Post subject:  Re: Lua scripting: ApplySkySettings()

Hello again Henri,

thank you for looking into it. I was beginning to doubt my sanity. :lol: You wrote:
Henri Beauchamp wrote:
Apparently, the A-12AM setting only works when you first override the region settings.
Well, it's not just that setting, but all of the presets, standard or custom, it seems. As soon as you move away from the region default, they will load, at region default they won't, just as you stated.

Henri Beauchamp wrote:
I'll add a new Lua function for it in next release (I already implemented an OnWindlightChange() event too)...
Thank you. I'm no expert, but wouldn't it be cleaner and more intuitive to trigger that with an empty string? I actually wondered if it might have been implemented that way in the first place.

Love,
Lia

Author:  Henri Beauchamp [ 2017-03-12 09:13:23 ]
Post subject:  Re: Lua scripting: ApplySkySettings()

Amalia Illios wrote:
Well, it's not just that setting, but all of the presets, standard or custom, it seems. As soon as you move away from the region default, they will load, at region default they won't, just as you stated.
Well, since I'm always overriding the region time, I did not notice this weird "feature" when I performed the tests...

Amalia Illios wrote:
Henri Beauchamp wrote:
I'll add a new Lua function for it in next release (I already implemented an OnWindlightChange() event too)...
Thank you. I'm no expert, but wouldn't it be cleaner and more intuitive to trigger that with an empty string? I actually wondered if it might have been implemented that way in the first place.
No, because the new function will allow to both deactivate and reactivate region time...

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/