mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-03-21 17:34:57 -05:00
Fix SetSourceSetting() not changing settings if the default value is set
This won't help in scenarios in which even a default value does not exist, e.g. "text" for the text sources, as here it is unclear which value type to use
This commit is contained in:
parent
1381654fed
commit
61fbff5821
|
|
@ -1,5 +1,6 @@
|
|||
#include "source-setting.hpp"
|
||||
#include "json-helpers.hpp"
|
||||
#include "log-helper.hpp"
|
||||
#include "obs-module-helper.hpp"
|
||||
#include "math-helpers.hpp"
|
||||
|
||||
|
|
@ -151,10 +152,14 @@ void SetSourceSetting(obs_source_t *source, const SourceSetting &setting,
|
|||
{
|
||||
auto id = setting.GetID();
|
||||
OBSDataAutoRelease data = obs_source_get_settings(source);
|
||||
auto item = obs_data_item_byname(data, id.c_str());
|
||||
OBSDataAutoRelease dataWithDefaults = obs_data_get_defaults(data);
|
||||
obs_data_apply(dataWithDefaults, data);
|
||||
auto item = obs_data_item_byname(dataWithDefaults, id.c_str());
|
||||
auto type = obs_data_item_gettype(item);
|
||||
switch (type) {
|
||||
case OBS_DATA_NULL:
|
||||
vblog(LOG_WARNING,
|
||||
"could not set settings value, as the value does not (yet) exist!");
|
||||
break;
|
||||
case OBS_DATA_STRING:
|
||||
obs_data_set_string(data, id.c_str(), value.c_str());
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user