Reorder Scenes via Scripting?

aega

New Member
I've been scouring through the API, but I can't find an elegant way to do this in Python.

I know you can reorder scene items with a call to obs.obs_sceneitem_set_order_position(scene_item, index), but I'm looking to rearrange the actual scenes.

Currently I'm renaming the scene I want to move, duplicating it, then deleting the old one, but this seems inefficient.

Code:
src   = obs.obs_get_source_by_name(sceneName)
scene = obs.obs_scene_from_source(src)
obs.obs_source_set_name(src,'DELETEME')
newScene = obs.obs_scene_duplicate(scene,sceneName,obs.OBS_SCENE_DUP_REFS)
obs.obs_source_remove(src)
obs.obs_source_release(src)
obs.obs_scene_release(newScene)

As a side note, is my use of obs_source_remove() the correct way to remove a scene? Although this works, it seems like there should be a scene_remove function exposed (since scene_create is).

Thanks!!
 
Top