1

我想出了如何在 countdown.lua 中添加和填充场景下拉列表,并且我看到了将切换场景的代码放在哪里。如何使用 lua 更改 OBS 中的场景?带有所选目标场景的下拉列表称为next_scene

function set_time_text()
    ...
    if cur_seconds < 1 then
        --# BJS goto scene stored in field "next_scene"
    end
...
function script_properties
...
    local t = obs.obs_properties_add_list(props, "next_scene", "Next Scene", obs.OBS_COMBO_TYPE_EDITABLE, obs.OBS_COMBO_FORMAT_STRING)
    local scenes = obs.obs_frontend_get_scene_names()
    if scenes ~= nil then
        for _, scene in ipairs(scenes) do
            obs.obs_property_list_add_string(t, scene, scene)
        end
    end
4

1 回答 1

1
function set_time_text()
        ....
        if cur_seconds < 1 then
        if next_scene ~= "" and next_scene ~= "-----" then
            local source = obs.obs_get_source_by_name(next_scene)
            obs.obs_source_release(source)
            obs.obs_frontend_set_current_scene(source)
        else
            text = stop_text
        end
    end
于 2020-08-16T16:13:36.197 回答