upgradeQ / libre-macros

Scripting and macros hotkeys overhaul for OBS Studio
https://obsproject.com/forum/resources/libre-macros.1228/
GNU Affero General Public License v3.0
24 stars 4 forks source link

click_property help #3

Closed UUoocl closed 8 months ago

UUoocl commented 1 year ago

Thank you for making this plug-in. obs-libre-macros has been helping me explore OBS with lua.
I want to automate clicking the "Get Value" button in the Move Transition Plug-in's Move Video Capture Device filter. I can't get the click_property() function to work. There is no response when I use this function.

image

This script shows that the property is named "value_get". I tried modifying this script to include the "obs_property_button_clicked" function, and the following error is returned.

Error in obs_property_button_clicked (arg 1), expected 'obs_property_t *' got 'cdata'

upgradeQ commented 1 year ago

@UUoocl What kind of response do you expect? Also what OBS Studio version do you use? Maybe something has changed. In the code you mentioned, you are using obslua (SWIG bingings) instead of defining a proper ctype for ffi in LuaJIT, you should try to add this line bool obs_property_button_clicked(obs_property_t *p, void *obj); to ffi.cdef string as it defined in libobs header, and call obsffi.obs_property_button_clicked(prop, fSource)

UUoocl commented 1 year ago

Thank you for replying. The expected behavior is when the function runs the filter's settings are updated with all of the camera's current settings. The camera I'm using can rotate, and I want to use the camera's current position in the script.
For example, before clicking the button the camera has a "pan" position of 14. image Then the camera position moves. After clicking the "Get Value" button, the filter is set to the new "pan" position of 94. image

The "Get Filter" button calls this function to read the camera's properties.
image

I'm using OBS 29.1.3(64bit).

Adding the line bool obs_property_button_clicked(obs_property_t *p, void *obj); as you suggested did correct the code!

Thank you very much!