From 6b2c3f4845530cd39b7830c9089729d978e60c53 Mon Sep 17 00:00:00 2001 From: jp9000 Date: Mon, 17 May 2021 16:34:09 -0700 Subject: [PATCH] libobs: Add obs_group_or_scene_from_source() Makes it a little bit easier to get a scene from either a source or group. --- libobs/obs.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libobs/obs.h b/libobs/obs.h index 94461e8dd..00ed7fdd3 100644 --- a/libobs/obs.h +++ b/libobs/obs.h @@ -1772,6 +1772,13 @@ EXPORT void obs_sceneitem_group_enum_items(obs_sceneitem_t *group, /** Gets the group from its source, or NULL if not a group */ EXPORT obs_scene_t *obs_group_from_source(const obs_source_t *source); +static inline obs_scene_t * +obs_group_or_scene_from_source(const obs_source_t *source) +{ + obs_scene_t *s = obs_scene_from_source(source); + return s ? s : obs_group_from_source(source); +} + EXPORT void obs_sceneitem_defer_group_resize_begin(obs_sceneitem_t *item); EXPORT void obs_sceneitem_defer_group_resize_end(obs_sceneitem_t *item);