Skip to content

Commit fc21c0f

Browse files
exeldroRytoEX
authored andcommitted
libobs: Fix scene and group load state
1 parent 8e79dcf commit fc21c0f

File tree

4 files changed

+19
-1
lines changed

4 files changed

+19
-1
lines changed

libobs/obs-scene.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3963,11 +3963,21 @@ bool obs_source_is_group(const obs_source_t *source)
39633963
return source && strcmp(source->info.id, group_info.id) == 0;
39643964
}
39653965

3966+
bool obs_source_type_is_group(const char *id)
3967+
{
3968+
return id && strcmp(id, group_info.id) == 0;
3969+
}
3970+
39663971
bool obs_source_is_scene(const obs_source_t *source)
39673972
{
39683973
return source && strcmp(source->info.id, scene_info.id) == 0;
39693974
}
39703975

3976+
bool obs_source_type_is_scene(const char *id)
3977+
{
3978+
return id && strcmp(id, scene_info.id) == 0;
3979+
}
3980+
39713981
bool obs_scene_is_group(const obs_scene_t *scene)
39723982
{
39733983
return scene ? scene->is_group : false;

libobs/obs-source.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,12 @@ obs_module_t *obs_source_get_module(const char *id)
157157

158158
enum obs_module_load_state obs_source_load_state(const char *id)
159159
{
160+
if (!id)
161+
return OBS_MODULE_INVALID;
162+
163+
if (obs_source_type_is_scene(id) || obs_source_type_is_group(id))
164+
return OBS_MODULE_ENABLED;
165+
160166
obs_module_t *module = obs_source_get_module(id);
161167
if (!module) {
162168
return OBS_MODULE_MISSING;

libobs/obs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2258,7 +2258,7 @@ static obs_source_t *obs_load_source_type(obs_data_t *source_data, bool is_priva
22582258
if (!*v_id)
22592259
v_id = id;
22602260

2261-
if (strcmp(id, scene_info.id) == 0 || strcmp(id, group_info.id) == 0) {
2261+
if (obs_source_type_is_scene(id) || obs_source_type_is_group(id)) {
22622262
const char *canvas_uuid = obs_data_get_string(source_data, "canvas_uuid");
22632263
canvas = obs_get_canvas_by_uuid(canvas_uuid);
22642264
/* Fall back to main canvas if canvas cannot be found. */

libobs/obs.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1710,6 +1710,7 @@ EXPORT bool obs_scene_reorder_items2(obs_scene_t *scene, struct obs_sceneitem_or
17101710
size_t item_order_size);
17111711

17121712
EXPORT bool obs_source_is_scene(const obs_source_t *source);
1713+
EXPORT bool obs_source_type_is_scene(const char *id);
17131714

17141715
/** Adds/creates a new scene item for a source */
17151716
EXPORT obs_sceneitem_t *obs_scene_add(obs_scene_t *scene, obs_source_t *source);
@@ -1839,6 +1840,7 @@ EXPORT void obs_sceneitem_group_remove_item(obs_sceneitem_t *group, obs_sceneite
18391840
EXPORT obs_sceneitem_t *obs_sceneitem_get_group(obs_scene_t *scene, obs_sceneitem_t *item);
18401841

18411842
EXPORT bool obs_source_is_group(const obs_source_t *source);
1843+
EXPORT bool obs_source_type_is_group(const char *id);
18421844
EXPORT bool obs_scene_is_group(const obs_scene_t *scene);
18431845

18441846
EXPORT void obs_sceneitem_group_enum_items(obs_sceneitem_t *group,

0 commit comments

Comments
 (0)