For updates, you should follow me on


Switching scenes using scripted transitions


 

WARNING - Scripted transitions are a new feature.  Don't use in a live situation unless you have tested them and are confident they will behave!

 

 

V2.1.12 : Lua script and transition scripts have been updated - click 'Files' in the UPDeck setup screen then delete the existing Transitions folder.  When UPDeck is restarted, the Transitions folder will be recreated with the new transition files. This version behaved perfectly for me on the Ryzen PC and was much more stable on the Mac, however, I did manage to freeze OBS a couple of times on the Macbook so I'm going to have another look at getting it 100%.

 

 

V2.1.11 : The transitions were initially tested on an AMD Ryzen 2700x PC and all worked OK. When testing on a 2015 Macbook Pro, the curtain transitions crashed OBS : the Macbook was running much slower and needed more time to complete the transition. A quick script edit fixed the problem on the slower machine. Future updates will try to automatically compensate for different hardware, but it's easy to tweak the scripts if you have to - see below for details...

 

 

The command to switch to another scene using a scripted transition is scriptswitch

The parameters are;

The transition parameter is one of the files from the Transitions folder (without the .lua file extension) - click the Files button on the UPDeck setup page to open the main folder that contains this folder. More transition files can be saved here to give more effects, but at the moment, the choices are;

 

The optional delay specifies a time (in milliseconds) to wait before running the command.

 

 

Example

 

Switch to Game scene

scriptswitch

scene=Game

trans=rect_melt_right

 

 

 

 

 

 

 

 

V2.1.11 only - tweaking the transition script : each transition file ends with a block of code like the one below.  You just have to alter the number shown in red - it's the number of seconds to wait before the transition is considered complete.  If you run a transition and you see that OBS cuts to the target scene before the animation finishes (OBS may also crash!), then add some extra time - maybe try 5000, etc...

 

 

obs.timer_add(

    function()
        obs.obs_frontend_set_current_scene(sceneSource)
 
        obs.script_log(obs.LOG_INFO, "Transition ready to animate")
        local cmd = ""
        for i = 1, 32 do
            cmd = cmd..format(
            "animatetdelay=%dtscene=%stitem=%stgroup=%ststeps=50tinterval=10tr=(-90)tw=0th=0n",
            40 * i, sceneName, "UPD_TRANS_OBJ_"..i, groupName
            )
        end
        listen(cmd)
        obs.timer_add(
            function()
                local targetScene = obs.obs_get_source_by_name(sceneNameB)
                if targetScene then
                    obs.obs_frontend_set_current_scene(targetScene)
                    obs.obs_source_release(targetScene)
                end
                scrSwitch.busy = false
                obs.script_log(obs.LOG_INFO, "Transition complete")
                obs.remove_current_callback()
            end,
            3000
        )
        releaseAll("animating")
        obs.remove_current_callback()
    end,
    200
)

 

 



Prev: Using another deck app or hardware  
Next: Fetching properties of scene items



Privacy
© 2021 8up.uk