libobs: Add sub property group
Description
Add sub property group, this will make the properties in the group be in a setting object with the name of the group instead of all properties in the root settings object.
Motivation and Context
I want to have multiple groups with settings that do not have unique setting names, only unique per group.
How Has This Been Tested?
On windows 64 bit with a plugin that is not published yet.
Types of changes
- New feature (non-breaking change which adds functionality)
Checklist:
- [x] My code has been run through clang-format.
- [x] I have read the contributing document.
- [x] My code is not on the master branch.
- [x] The code has been tested.
- [x] All commit messages are properly formatted and commits squashed where appropriate.
- [x] I have included updates to all appropriate documentation.
@exeldro, What is your usecase for this PR?
A sidenote for Jim,
I'm writing a filter that instantiates outputs at norihiro/obs-output-filter. My problem is how to separate obs_data_t for the instantiated output from other data. I think this PR will solve my issue.
I want the settings from the properties support something like this:
"position1" : { "x" : 0, "y" : 0 }, "position2" : { "x" : 100, "y" : 0 }
Normal groups are searched recursively and the property name must be unique. For the new type of group is not searched recursively and can contain the same name per group. In above example the x and y property are only unique in the group not in the full properties.
Hey there, I can't get this PR to work.
With these properties:
obs_properties_t *final_props = obs_properties_create();
obs_properties_add_text(final_props, "my_text", "Text", OBS_TEXT_DEFAULT);
obs_properties_t *group = obs_properties_create();
obs_properties_add_text(group, "my_text_in_group", "Text in group", OBS_TEXT_DEFAULT);
obs_properties_add_group(final_props, "group", "Group", OBS_GROUP_SUB, group);
return final_props;
I get the following settings obs_data:
{
"group": {},
"my_text": "text on outside",
"my_text_in_group": "text on the inside"
}
What I'd expect is:
{
"group": {
"my_text_in_group": "text on the inside"
},
"my_text": "text on outside",
}
Am I doing something wrong, is my expectation wrong, or is there an issue the PR (e.g. somehow silently conflicts with other changes since October)?
@gxalpha It seems like I did not push the changes to the properties view before. Rebased and added the missing changes.
Thanks for the quick response.
Using the same example as before, the content now properly appears inside the group, but also on the outside.
{
"group": {
"my_text_in_group": "text on the inside"
},
"my_text": "text on outside",
"my_text_in_group": "text on the inside"
}
This is fine for my purposes, but should probably still be considered a wrong/unexpected behavior, could you take another look?
Also, this PR is fantastic. This is what having it does to one of my plugins:

@gxalpha I tried to replicate getting it and also outside the group without success. Are you sure the one outside the group did not remain from the version before?
Yeah, also happens with new sources.
(For reference, I also tested this by dropping the properties code into the properties of OBS' image source to confirm it's not my plugin being weird (I'm doing evil things there, but it doesn't seem to be the reason)).
Fyi, this has conflicts now.
Fixed the merge conflicts (that got caused by hashtables), as I'm working on a plugin that needs this PR as well.