[Question] Manual property widgets refresh

Manusan42

New Member
Hi, I'm working on Win 10 and trying to write a python script for OBS.
I had a lot of problems. For me it seems impossible to use set_modified_callback() inside of script_properties() without OBS crashes after restart.
I overcame this by using a timer which registers the modified callback after script_properties().

The next thing is, that obs_properties_apply_settings() does not seem to refresh the property widgets. Maybe it's not supposed to do this? For me it just triggers the modified callbacks. After many trial and error, I did not see a programmatic way to refresh the properties widgets except inside a modified callback function (with returning True).
But I do have some poll-code on a timer which checks a status. I would like to set some data value reflecting this status. This works with the obs_data_set_*()-functions and the value is saved after exit, but I could not figure out how to refresh the corresponding property widget to reflect this data change without a restart.

Is there some function I'm missing or a way to do this?

Thanks in advance
 

Nom_XD

New Member
You are doing it almost correctly; some widgets, like buttons, have their own callback, which should return True if their content was updated. Then, inside the callback function, we need to call obs_property_set_description to change the content of this widget (this cannot be done anywhere else). If a widget doesn't have a callback, such as text for showing information about your script. Then, we should attach a function to it using set_modified_callback() when creating a property widget for the first time and call obs_properties_apply_settings whenever we need that widget updated.
 
Last edited:
Top