Merge pull request #2006 from cg2121/pause-scene

obs-scripting: Add pause scene script
master
Jim 2019-08-08 20:15:23 -07:00 committed by GitHub
commit 36a123f653
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 44 additions and 0 deletions

View File

@ -0,0 +1,44 @@
obs = obslua
pause_scene = ""
function on_event(event)
if event == obs.OBS_FRONTEND_EVENT_SCENE_CHANGED then
local scene = obs.obs_frontend_get_current_scene()
local scene_name = obs.obs_source_get_name(scene)
if pause_scene == scene_name then
obs.obs_frontend_recording_pause(true)
else
obs.obs_frontend_recording_pause(false)
end
obs.obs_source_release(scene);
end
end
function script_properties()
local props = obs.obs_properties_create()
local p = obs.obs_properties_add_list(props, "pause_scene", "Pause Scene", obs.OBS_COMBO_TYPE_EDITABLE, obs.OBS_COMBO_FORMAT_STRING)
local scenes = obs.obs_frontend_get_scenes()
if scenes ~= nil then
for _, scene in ipairs(scenes) do
local name = obs.obs_source_get_name(scene);
obs.obs_property_list_add_string(p, name, name)
end
end
obs.source_list_release(scenes)
return props
end
function script_description()
return "Adds the ability to pause recording when switching to a specific scene"
end
function script_update(settings)
pause_scene = obs.obs_data_get_string(settings, "pause_scene")
end
function script_load(settings)
obs.obs_frontend_add_event_callback(on_event)
end