mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-08-24 02:34:23 -05:00
libobs: Fix scene and group load state
This commit is contained in:
@@ -3963,11 +3963,21 @@ bool obs_source_is_group(const obs_source_t *source)
|
||||
return source && strcmp(source->info.id, group_info.id) == 0;
|
||||
}
|
||||
|
||||
bool obs_source_type_is_group(const char *id)
|
||||
{
|
||||
return id && strcmp(id, group_info.id) == 0;
|
||||
}
|
||||
|
||||
bool obs_source_is_scene(const obs_source_t *source)
|
||||
{
|
||||
return source && strcmp(source->info.id, scene_info.id) == 0;
|
||||
}
|
||||
|
||||
bool obs_source_type_is_scene(const char *id)
|
||||
{
|
||||
return id && strcmp(id, scene_info.id) == 0;
|
||||
}
|
||||
|
||||
bool obs_scene_is_group(const obs_scene_t *scene)
|
||||
{
|
||||
return scene ? scene->is_group : false;
|
||||
|
||||
@@ -157,6 +157,12 @@ obs_module_t *obs_source_get_module(const char *id)
|
||||
|
||||
enum obs_module_load_state obs_source_load_state(const char *id)
|
||||
{
|
||||
if (!id)
|
||||
return OBS_MODULE_INVALID;
|
||||
|
||||
if (obs_source_type_is_scene(id) || obs_source_type_is_group(id))
|
||||
return OBS_MODULE_ENABLED;
|
||||
|
||||
obs_module_t *module = obs_source_get_module(id);
|
||||
if (!module) {
|
||||
return OBS_MODULE_MISSING;
|
||||
|
||||
+1
-1
@@ -2258,7 +2258,7 @@ static obs_source_t *obs_load_source_type(obs_data_t *source_data, bool is_priva
|
||||
if (!*v_id)
|
||||
v_id = id;
|
||||
|
||||
if (strcmp(id, scene_info.id) == 0 || strcmp(id, group_info.id) == 0) {
|
||||
if (obs_source_type_is_scene(id) || obs_source_type_is_group(id)) {
|
||||
const char *canvas_uuid = obs_data_get_string(source_data, "canvas_uuid");
|
||||
canvas = obs_get_canvas_by_uuid(canvas_uuid);
|
||||
/* Fall back to main canvas if canvas cannot be found. */
|
||||
|
||||
@@ -1710,6 +1710,7 @@ EXPORT bool obs_scene_reorder_items2(obs_scene_t *scene, struct obs_sceneitem_or
|
||||
size_t item_order_size);
|
||||
|
||||
EXPORT bool obs_source_is_scene(const obs_source_t *source);
|
||||
EXPORT bool obs_source_type_is_scene(const char *id);
|
||||
|
||||
/** Adds/creates a new scene item for a source */
|
||||
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
|
||||
EXPORT obs_sceneitem_t *obs_sceneitem_get_group(obs_scene_t *scene, obs_sceneitem_t *item);
|
||||
|
||||
EXPORT bool obs_source_is_group(const obs_source_t *source);
|
||||
EXPORT bool obs_source_type_is_group(const char *id);
|
||||
EXPORT bool obs_scene_is_group(const obs_scene_t *scene);
|
||||
|
||||
EXPORT void obs_sceneitem_group_enum_items(obs_sceneitem_t *group,
|
||||
|
||||
Reference in New Issue
Block a user