[Plugin] [obs-studio] obs_data_t settings changes + properties_t close behaviour

jip

New Member
hey guys,

first things first. Thanks for the great work you guys doing with obs-studio.Great source examples and the
documentation makes it easier :).

Anyways, i am developing an plugin for obs studio (latest version) in C++ and i have a minor
issue with the "dirty"-flag behaviour of "obs_properties_t" or "obs_data_t".

Before showing the properties window of an source i need to change some values in the settings.
The main reason behind it is that i have some "global" settings which should be able to be changed by
every source property window. Before showing the property window, i need to bring the source settings uptodate,
because they might differ.

So far so good all works fine, the information will be displayed correctly and the behaviour of "OK" and "Cancel" button is like expected.

My only problem is, that by closing the property window with the "X" (top-right) it displays the messagebox to save
changes. This behaviour also occures if i open the window and close it directly.

Here is an example code part, how i manipulate the settings: ("as" is an object of a class, which stores a pointer to the obs source (type: obs_source_t) and makes it available with the "GetSource()" method)

Code:
obs_data_t *settings = obs_source_get_settings(as->GetSource());
obs_data_set_string(settings, "client_id", GetSettings()->GetClientCredentials()->GetId().c_str());
obs_data_set_string(settings, "client_secret", GetSettings()->GetClientCredentials()->GetSecret().c_str());

Is there maybe a way to tell the properties_t or obs_data_t that the data is not dirty or another workaround? Or should i consider another approach in general?

Looking forward to your answers guys :)

Jip
 

jip

New Member
Sometimes you do not see the easiest solution, even if it is directly in front of you.

After i make the changes on the settings, i just needed to trigger obs_properties_apply_settings method at the end of the properties building.

Code:
obs_properties_apply_settings(props, settings);

I could not detect any side effects so far, if something unexpected will happen, i will let you guys know.
 
Top