Help with OBS API, obs_properties_add_path in a LUA script?

Stormin

New Member
First, I am very new to Lua, and interfacing into OBS. So I apologise if I've missed something either in Lua or the OBS API docs.

I am having a play with modifying BrowserImageSlideshow-2.0.2 Lua script to add some functionality. Specifically, I want to be able to user select a number of folders to get the images out of.

I've successfully managed to create three paths in the interface that I can browse to. And the code will extract the images names and I added the paths.

I used:
Lua:
props = obs.obs_properties_create()
    obs.obs_properties_add_path(props, "dir1", "Image Dir 1",obs.OBS_PATH_DIRECTORY,"",nil )
    obs.obs_properties_add_path(props, "dir2", "Image Dir 2",obs.OBS_PATH_DIRECTORY,"",nil  )
    obs.obs_properties_add_path(props, "dir3", "Image Dir 3",obs.OBS_PATH_DIRECTORY,"",nil  )

However in the interface I cannot directly edit or delete the text of the paths.

1748606675648.png

This is suboptimal, since sometimes we won't want all the paths filled, and sometimes pasting in a path may be best.

I had a hunt through the OBS API, specifically in this area:


But I couldn't find any properties that would lock a control for direct editing.

Very glad to be pointed to docs, or to an alternate method...

THanks
 
I agree that this is a pain for all the reasons you mentioned, but I haven't found any way to make the UI do what you want.

Some possible (but ugly) work arounds:
  • To "clear" one of the controls, select a directory that doesn't contain any files of the types you are looking for. Maybe "C:\", or maybe "C:\this_is_a_hack_pretending_to_be_an_empty_path"
  • Change the script to ignore duplicated paths between controls (looks lame, clumsy to "delete" a path by selecting another path)
  • Change the fields to text (which supports Paste) and give up the Browse button. (Clumsy, but I could live with it because I always have my file manager app open. It give me faster navigation around my disks than a File dialog, and it has a "copy path to clipboard" button)
None of these get points for elegance, but if the only hammer in the toolbox is a rock sometimes you gotta use the rock.
 
Top