-
Notifications
You must be signed in to change notification settings - Fork 84
/
enable-source-all.lua
106 lines (82 loc) · 2.33 KB
/
enable-source-all.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
-- Open Broadcaster Software®️
-- OBS > Tools > Scripts
--
-- 30/03/2021 14:58 @midnight-studios
--
-- Globals
obs = obslua
source_name = ""
--
-- Just a tool
-- If testing and log event writing is needed
--
--
--
local function log(name, msg)
if msg ~= nil then
msg = " > " .. tostring(msg)
else
msg = ""
end
obs.script_log(obs.LOG_DEBUG, name .. msg)
end
--
--
--
--
--
--
function source_enable()
local scenes = obs.obs_frontend_get_scenes()
if scenes ~= nil then
for _, scenesource in ipairs(scenes) do
local scenename = obs.obs_source_get_name(scenesource)
local scene = obs.obs_scene_from_source(scenesource)
local sceneitems = obs.obs_scene_enum_items(scene)
local sourcename = ''
for i, sceneitem in ipairs(sceneitems) do
local source = obs.obs_sceneitem_get_source(sceneitem)
local group = obs.obs_group_from_source(source)
sourcename = obs.obs_source_get_name(source)
if not obs.obs_source_enabled(source) then
log(sourcename, obs.obs_source_enabled(source))
obs.obs_source_set_enabled(source,true)
end
if group ~= nil then
local groupitems = obs.obs_scene_enum_items(group)
if groupitems ~= nil then
for j, groupitem in ipairs(groupitems) do
local groupitemsource = obs.obs_sceneitem_get_source(groupitem)
sourcename = obs.obs_source_get_name(groupitemsource)
if not obs.obs_source_enabled(groupitemsource) then
log(sourcename, obs.obs_source_enabled(groupitemsource))
obs.obs_source_set_enabled(groupitemsource,true)
end
end -- end for
obs.sceneitem_list_release(groupitems)
end
end
if not obs.obs_source_enabled(source) then
log(sourcename, obs.obs_source_enabled(source))
obs.obs_source_set_enabled(source,true)
end
end
obs.sceneitem_list_release(sceneitems)
end
obs.source_list_release(scenes)
--obs.obs_frontend_source_list_free(scenes)
end
end
function script_properties()
end
function script_description()
return "Enable all scene items"
end
function script_update(settings)
source_enable()
end
function script_defaults(settings)
end
function script_load(settings)
script_update(settings)
end