reference-scenes.rst 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772
  1. Scene API Reference (obs_scene_t)
  2. =================================
  3. A scene is a source which contains and renders other sources using
  4. specific transforms and/or filtering
  5. .. type:: obs_scene_t
  6. A reference-counted scene object.
  7. .. type:: obs_sceneitem_t
  8. A reference-counted scene item object.
  9. .. code:: cpp
  10. #include <obs.h>
  11. Scene Item Transform Structure (obs_transform_info)
  12. ---------------------------------------------------
  13. .. struct:: obs_transform_info
  14. Scene item transform structure.
  15. .. member:: struct vec2 obs_transform_info.pos
  16. Position.
  17. .. member:: float obs_transform_info.rot
  18. Rotation (degrees).
  19. .. member:: struct vec2 obs_transform_info.scale
  20. Scale.
  21. .. member:: uint32_t obs_transform_info.alignment
  22. The alignment of the scene item relative to its position.
  23. Can be 0 or a bitwise OR combination of one of the following values:
  24. - **OBS_ALIGN_CENTER**
  25. - **OBS_ALIGN_LEFT**
  26. - **OBS_ALIGN_RIGHT**
  27. - **OBS_ALIGN_TOP**
  28. - **OBS_ALIGN_BOTTOM**
  29. .. member:: enum obs_bounds_type obs_transform_info.bounds_type
  30. Can be one of the following values:
  31. - **OBS_BOUNDS_NONE** - No bounding box
  32. - **OBS_BOUNDS_STRETCH** - Stretch to the bounding box without preserving aspect ratio
  33. - **OBS_BOUNDS_SCALE_INNER** - Scales with aspect ratio to inner bounding box rectangle
  34. - **OBS_BOUNDS_SCALE_OUTER** - Scales with aspect ratio to outer bounding box rectangle
  35. - **OBS_BOUNDS_SCALE_TO_WIDTH** - Scales with aspect ratio to the bounding box width
  36. - **OBS_BOUNDS_SCALE_TO_HEIGHT** - Scales with aspect ratio to the bounding box height
  37. - **OBS_BOUNDS_MAX_ONLY** - Scales with aspect ratio, but only to the size of the source maximum
  38. .. member:: uint32_t obs_transform_info.bounds_alignment
  39. The alignment of the source within the bounding box.
  40. Can be 0 or a bitwise OR combination of one of the following values:
  41. - **OBS_ALIGN_CENTER**
  42. - **OBS_ALIGN_LEFT**
  43. - **OBS_ALIGN_RIGHT**
  44. - **OBS_ALIGN_TOP**
  45. - **OBS_ALIGN_BOTTOM**
  46. .. member:: struct vec2 obs_transform_info.bounds
  47. The bounding box (if a bounding box is enabled).
  48. Scene Item Crop Structure (obs_sceneitem_crop)
  49. ----------------------------------------------
  50. .. struct:: obs_sceneitem_crop
  51. Scene item crop structure.
  52. .. member:: int obs_sceneitem_crop.left
  53. Left crop value.
  54. .. member:: int obs_sceneitem_crop.top
  55. Top crop value.
  56. .. member:: int obs_sceneitem_crop.right
  57. Right crop value.
  58. .. member:: int obs_sceneitem_crop.bottom
  59. Bottom crop value.
  60. Scene Item Order Info Structure (\*obs_sceneitem_order_info)
  61. ------------------------------------------------------------
  62. .. struct:: obs_sceneitem_order_info
  63. Scene item order info structure.
  64. .. member:: obs_sceneitem_t *obs_sceneitem_order_info.group
  65. Specifies the group this scene item belongs to, or *NULL* if none.
  66. .. member:: obs_sceneitem_t *obs_sceneitem_order_info.item
  67. Specifies the scene item.
  68. .. _scene_signal_reference:
  69. Scene Signals
  70. -------------
  71. **item_add** (ptr scene, ptr item)
  72. Called when a scene item has been added to the scene.
  73. **item_remove** (ptr scene, ptr item)
  74. Called when a scene item has been removed from the scen.
  75. **reorder** (ptr scene)
  76. Called when scene items have been reoredered in the scene.
  77. **refresh** (ptr scene)
  78. Called when the entire scene item list needs to be refreshed.
  79. Usually this is only used when groups have changed.
  80. **item_visible** (ptr scene, ptr item, bool visible)
  81. Called when a scene item's visibility state changes.
  82. **item_locked** (ptr scene, ptr item, bool locked)
  83. Called when a scene item has been locked or unlocked.
  84. **item_select** (ptr scene, ptr item)
  85. **item_deselect** (ptr scene, ptr item)
  86. Called when a scene item has been selected/deselected.
  87. (Author's note: These should be replaced)
  88. **item_transform** (ptr scene, ptr item)
  89. Called when a scene item's transform has changed.
  90. General Scene Functions
  91. -----------------------
  92. .. function:: obs_scene_t *obs_scene_create(const char *name)
  93. :param name: Name of the scene source. If it's not unique, it will
  94. be made unique
  95. :return: A reference to a scene
  96. ---------------------
  97. .. function:: obs_scene_t *obs_scene_create_private(const char *name)
  98. :param name: Name of the scene source. Does not have to be unique,
  99. or can be *NULL*
  100. :return: A reference to a private scene
  101. ---------------------
  102. .. function:: obs_scene_t *obs_scene_duplicate(obs_scene_t *scene, const char *name, enum obs_scene_duplicate_type type)
  103. Duplicates a scene. When a scene is duplicated, its sources can be
  104. just referenced, or fully duplicated.
  105. :param name: Name of the new scene source
  106. :param type: | Type of duplication:
  107. | OBS_SCENE_DUP_REFS - Duplicates the scene, but scene items are only duplicated with references
  108. | OBS_SCENE_DUP_COPY - Duplicates the scene, and scene items are also fully duplicated when possible
  109. | OBS_SCENE_DUP_PRIVATE_REFS - Duplicates with references, but the scene is a private source
  110. | OBS_SCENE_DUP_PRIVATE_COPY - Fully duplicates scene items when possible, but the scene and duplicates sources are private sources
  111. :return: A reference to a new scene
  112. ---------------------
  113. .. function:: void obs_scene_addref(obs_scene_t *scene)
  114. Adds a reference to a scene.
  115. .. deprecated:: 27.2.0
  116. Use :c:func:`obs_scene_get_ref()` instead.
  117. ---------------------
  118. .. function:: obs_scene_t *obs_scene_get_ref(obs_scene_t *scene)
  119. Returns an incremented reference if still valid, otherwise returns
  120. *NULL*. Release with :c:func:`obs_scene_release()`.
  121. ---------------------
  122. .. function:: void obs_scene_release(obs_scene_t *scene)
  123. Releases a reference to a scene.
  124. ---------------------
  125. .. function:: obs_sceneitem_t *obs_scene_add(obs_scene_t *scene, obs_source_t *source)
  126. :return: A new scene item for a source within a scene. Does not
  127. increment the reference
  128. ---------------------
  129. .. function:: obs_source_t *obs_scene_get_source(const obs_scene_t *scene)
  130. :return: The scene's source. Does not increment the reference
  131. ---------------------
  132. .. function:: obs_scene_t *obs_scene_from_source(const obs_source_t *source)
  133. :return: The scene context, or *NULL* if not a scene. Does not
  134. increase the reference
  135. ---------------------
  136. .. function:: obs_sceneitem_t *obs_scene_find_source(obs_scene_t *scene, const char *name)
  137. :param name: The name of the source to find
  138. :return: The scene item if found, otherwise *NULL* if not found
  139. ---------------------
  140. .. function:: obs_sceneitem_t *obs_scene_find_source_recursive(obs_scene_t *scene, const char *name)
  141. Same as obs_scene_find_source, but also searches groups within the
  142. scene.
  143. :param name: The name of the source to find
  144. :return: The scene item if found, otherwise *NULL* if not found
  145. ---------------------
  146. .. function:: obs_sceneitem_t *obs_scene_find_sceneitem_by_id(obs_scene_t *scene, int64_t id)
  147. :param id: The unique numeric identifier of the scene item
  148. :return: The scene item if found, otherwise *NULL* if not found
  149. ---------------------
  150. .. function:: void obs_scene_enum_items(obs_scene_t *scene, bool (*callback)(obs_scene_t*, obs_sceneitem_t*, void*), void *param)
  151. Enumerates scene items within a scene.
  152. Callback function returns true to continue enumeration, or false to end
  153. enumeration.
  154. Use :c:func:`obs_sceneitem_addref()` if you want to retain a
  155. reference after obs_scene_enum_items finishes.
  156. For scripting, use :py:func:`obs_scene_enum_items`.
  157. ---------------------
  158. .. function:: bool obs_scene_reorder_items(obs_scene_t *scene, obs_sceneitem_t * const *item_order, size_t item_order_size)
  159. Reorders items within a scene.
  160. ---------------------
  161. .. function:: bool obs_scene_reorder_items2(obs_scene_t *scene, struct obs_sceneitem_order_info *item_order, size_t item_order_size)
  162. Reorders items within a scene with groups and group sub-items.
  163. ---------------------
  164. .. function:: void obs_scene_prune_sources(obs_scene_t *scene)
  165. Releases all sources from a scene that have been marked as removed by obs_source_remove.
  166. ---------------------
  167. .. _scene_item_reference:
  168. Scene Item Functions
  169. --------------------
  170. .. function:: void obs_sceneitem_addref(obs_sceneitem_t *item)
  171. void obs_sceneitem_release(obs_sceneitem_t *item)
  172. Adds/releases a reference to a scene item.
  173. ---------------------
  174. .. function:: void obs_sceneitem_remove(obs_sceneitem_t *item)
  175. Removes the scene item from the scene.
  176. ---------------------
  177. .. function:: obs_scene_t *obs_sceneitem_get_scene(const obs_sceneitem_t *item)
  178. :return: The scene associated with the scene item. Does not
  179. increment the reference
  180. ---------------------
  181. .. function:: obs_source_t *obs_sceneitem_get_source(const obs_sceneitem_t *item)
  182. :return: The source associated with the scene item. Does not
  183. increment the reference
  184. ---------------------
  185. .. function:: obs_sceneitem_t *obs_scene_sceneitem_from_source(obs_scene_t *scene, obs_source_t *source)
  186. This will add a reference to the sceneitem.
  187. :return: The sceneitem associated with a source in a scene. Returns NULL if not found.
  188. ---------------------
  189. .. function:: void obs_sceneitem_set_id(obs_sceneitem_t *item);
  190. Sets the unique numeric identifier of the sceneitem. This is dangerous function and should not
  191. normally be used. It can cause errors within obs.
  192. ---------------------
  193. .. function:: int64_t obs_sceneitem_get_id(const obs_sceneitem_t *item)
  194. Gets the numeric identifier of the sceneitem.
  195. :return: Gets the unique numeric identifier of the scene item.
  196. ---------------------
  197. .. function:: obs_data_t *obs_scene_save_transform_states(obs_scene_t *scene, bool all_items)
  198. .. function:: void obs_scene_load_transform_states(const char *states)
  199. Saves all the transformation states for the sceneitms in scene. When all_items is false, it
  200. will only save selected items
  201. :return: Data containing transformation states for all* sceneitems in scene
  202. ---------------------
  203. .. function:: void obs_sceneitem_set_pos(obs_sceneitem_t *item, const struct vec2 *pos)
  204. void obs_sceneitem_get_pos(const obs_sceneitem_t *item, struct vec2 *pos)
  205. Sets/gets the position of a scene item.
  206. ---------------------
  207. .. function:: void obs_sceneitem_set_rot(obs_sceneitem_t *item, float rot_deg)
  208. float obs_sceneitem_get_rot(const obs_sceneitem_t *item)
  209. Sets/gets the rotation of a scene item.
  210. ---------------------
  211. .. function:: void obs_sceneitem_set_scale(obs_sceneitem_t *item, const struct vec2 *scale)
  212. void obs_sceneitem_get_scale(const obs_sceneitem_t *item, struct vec2 *scale)
  213. Sets/gets the scaling of the scene item.
  214. ---------------------
  215. .. function:: void obs_sceneitem_set_alignment(obs_sceneitem_t *item, uint32_t alignment)
  216. uint32_t obs_sceneitem_get_alignment(const obs_sceneitem_t *item)
  217. Sets/gets the alignment of the scene item relative to its position.
  218. :param alignment: | Can be any bitwise OR combination of:
  219. | OBS_ALIGN_CENTER
  220. | OBS_ALIGN_LEFT
  221. | OBS_ALIGN_RIGHT
  222. | OBS_ALIGN_TOP
  223. | OBS_ALIGN_BOTTOM
  224. ---------------------
  225. .. function:: void obs_sceneitem_set_order(obs_sceneitem_t *item, enum obs_order_movement movement)
  226. Changes the scene item's order relative to the other scene items
  227. within the scene.
  228. :param movement: | Can be one of the following:
  229. | OBS_ORDER_MOVE_UP
  230. | OBS_ORDER_MOVE_DOWN
  231. | OBS_ORDER_MOVE_TOP
  232. | OBS_ORDER_MOVE_BOTTOM
  233. ---------------------
  234. .. function:: void obs_sceneitem_set_order_position(obs_sceneitem_t *item, int position)
  235. Changes the sceneitem's order index.
  236. ---------------------
  237. .. function:: int obs_sceneitem_get_order_position(obs_sceneitem_t *item)
  238. :return: Gets position of sceneitem in its scene.
  239. ---------------------
  240. .. function:: void obs_sceneitem_set_bounds_type(obs_sceneitem_t *item, enum obs_bounds_type type)
  241. enum obs_bounds_type obs_sceneitem_get_bounds_type(const obs_sceneitem_t *item)
  242. Sets/gets the bounding box type of a scene item. Bounding boxes are
  243. used to stretch/position the source relative to a specific bounding
  244. box of a specific size.
  245. :param type: | Can be one of the following values:
  246. | OBS_BOUNDS_NONE - No bounding box
  247. | OBS_BOUNDS_STRETCH - Stretch to the bounding box without preserving aspect ratio
  248. | OBS_BOUNDS_SCALE_INNER - Scales with aspect ratio to inner bounding box rectangle
  249. | OBS_BOUNDS_SCALE_OUTER - Scales with aspect ratio to outer bounding box rectangle
  250. | OBS_BOUNDS_SCALE_TO_WIDTH - Scales with aspect ratio to the bounding box width
  251. | OBS_BOUNDS_SCALE_TO_HEIGHT - Scales with aspect ratio to the bounding box height
  252. | OBS_BOUNDS_MAX_ONLY - Scales with aspect ratio, but only to the size of the source maximum
  253. ---------------------
  254. .. function:: void obs_sceneitem_set_bounds_alignment(obs_sceneitem_t *item, uint32_t alignment)
  255. uint32_t obs_sceneitem_get_bounds_alignment(const obs_sceneitem_t *item)
  256. Sets/gets the alignment of the source within the bounding box.
  257. :param alignment: | Can be any bitwise OR combination of:
  258. | OBS_ALIGN_CENTER
  259. | OBS_ALIGN_LEFT
  260. | OBS_ALIGN_RIGHT
  261. | OBS_ALIGN_TOP
  262. | OBS_ALIGN_BOTTOM
  263. ---------------------
  264. .. function:: void obs_sceneitem_set_bounds(obs_sceneitem_t *item, const struct vec2 *bounds)
  265. void obs_sceneitem_get_bounds(const obs_sceneitem_t *item, struct vec2 *bounds)
  266. Sets/gets the bounding box width/height of the scene item.
  267. ---------------------
  268. .. function:: void obs_sceneitem_set_info(obs_sceneitem_t *item, const struct obs_transform_info *info)
  269. void obs_sceneitem_get_info(const obs_sceneitem_t *item, struct obs_transform_info *info)
  270. Sets/gets the transform information of the scene item.
  271. ---------------------
  272. .. function:: void obs_sceneitem_get_draw_transform(const obs_sceneitem_t *item, struct matrix4 *transform)
  273. Gets the transform matrix of the scene item used for drawing the
  274. source.
  275. ---------------------
  276. .. function:: void obs_sceneitem_get_box_transform(const obs_sceneitem_t *item, struct matrix4 *transform)
  277. Gets the transform matrix of the scene item used for the bounding box
  278. or edges of the scene item.
  279. ---------------------
  280. .. function:: bool obs_sceneitem_set_visible(obs_sceneitem_t *item, bool visible)
  281. bool obs_sceneitem_visible(const obs_sceneitem_t *item)
  282. Sets/gets the visibility state of the scene item.
  283. ---------------------
  284. .. function:: bool obs_sceneitem_set_locked(obs_sceneitem_t *item, bool locked)
  285. bool obs_sceneitem_locked(const obs_sceneitem_t *item)
  286. Sets/gets the locked/unlocked state of the scene item.
  287. ---------------------
  288. .. function:: void obs_sceneitem_set_crop(obs_sceneitem_t *item, const struct obs_sceneitem_crop *crop)
  289. void obs_sceneitem_get_crop(const obs_sceneitem_t *item, struct obs_sceneitem_crop *crop)
  290. Sets/gets the cropping of the scene item.
  291. ---------------------
  292. .. function:: void obs_sceneitem_set_scale_filter(obs_sceneitem_t *item, enum obs_scale_type filter)
  293. enum obs_scale_type obs_sceneitem_get_scale_filter( obs_sceneitem_t *item)
  294. Sets/gets the scale filter used for the scene item.
  295. :param filter: | Can be one of the following values:
  296. | OBS_SCALE_DISABLE
  297. | OBS_SCALE_POINT
  298. | OBS_SCALE_BICUBIC
  299. | OBS_SCALE_BILINEAR
  300. | OBS_SCALE_LANCZOS
  301. ---------------------
  302. .. function:: void obs_sceneitem_set_blending_method(obs_sceneitem_t *item, enum obs_blending_method method)
  303. enum obs_blending_method obs_sceneitem_get_blending_method(obs_sceneitem_t *item)
  304. Sets/gets the blending method used for the scene item.
  305. :param method: | Can be one of the following values:
  306. | OBS_BLEND_METHOD_DEFAULT
  307. | OBS_BLEND_METHOD_SRGB_OFF
  308. ---------------------
  309. .. function:: void obs_sceneitem_set_blending_mode(obs_sceneitem_t *item, enum obs_blending_type type)
  310. enum obs_blending_type obs_sceneitem_get_blending_mode(obs_sceneitem_t *item)
  311. Sets/gets the blending mode used for the scene item.
  312. :param type: | Can be one of the following values:
  313. | OBS_BLEND_NORMAL
  314. | OBS_BLEND_ADDITIVE
  315. | OBS_BLEND_SUBTRACT
  316. | OBS_BLEND_SCREEN
  317. | OBS_BLEND_MULTIPLY
  318. | OBS_BLEND_LIGHTEN
  319. | OBS_BLEND_DARKEN
  320. ---------------------
  321. .. function:: void obs_sceneitem_defer_update_begin(obs_sceneitem_t *item)
  322. void obs_sceneitem_defer_update_end(obs_sceneitem_t *item)
  323. Allows the ability to call any one of the transform functions without
  324. updating the internal matrices until obs_sceneitem_defer_update_end
  325. has been called.
  326. ---------------------
  327. .. function:: obs_data_t *obs_sceneitem_get_private_settings(obs_sceneitem_t *item)
  328. :return: An incremented reference to the private settings of the
  329. scene item. Allows the front-end to set custom information
  330. which is saved with the scene item. Release with
  331. :c:func:`obs_data_release()`.
  332. ---------------------
  333. .. function:: void obs_sceneitem_set_show_transition(obs_sceneitem_t *item, obs_source_t *transition)
  334. void obs_sceneitem_set_hide_transition(obs_sceneitem_t *item, obs_source_t *transition)
  335. Set a transition for showing or hiding a scene item. Set *NULL* to remove the transition.
  336. ---------------------
  337. .. function:: obs_source_t *obs_sceneitem_get_show_transition(obs_sceneitem_t *item)
  338. obs_source_t *obs_sceneitem_get_hide_transition(obs_sceneitem_t *item)
  339. :return: The transition for showing or hiding a scene item. *NULL* if no transition is set.
  340. ---------------------
  341. .. function:: void obs_sceneitem_set_show_transition_duration(obs_sceneitem_t *item, uint32_t duration_ms)
  342. void obs_sceneitem_set_hide_transition_duration(obs_sceneitem_t *item, uint32_t duration_ms)
  343. Set transition duration for showing or hiding a scene item.
  344. ---------------------
  345. .. function:: uint32_t obs_sceneitem_get_show_transition_duration(obs_sceneitem_t *item)
  346. uint32_t obs_sceneitem_get_hide_transition_duration(obs_sceneitem_t *item)
  347. :return: The transition duration in ms for showing or hiding a scene item.
  348. ---------------------
  349. .. function:: void obs_sceneitem_do_transition(obs_sceneitem_t *item, bool visible)
  350. Start the transition for showing or hiding a scene item.
  351. ---------------------
  352. .. _scene_item_group_reference:
  353. Scene Item Group Functions
  354. --------------------------
  355. .. function:: obs_sceneitem_t *obs_scene_add_group(obs_scene_t *scene, const char *name)
  356. Adds a group with the specified name. Does not signal the scene with
  357. the *refresh* signal.
  358. :param scene: Scene to add the group to
  359. :param name: Name of the group
  360. :return: The new group's scene item
  361. ---------------------
  362. .. function:: obs_sceneitem_t *obs_scene_add_group2(obs_scene_t *scene, const char *name, bool signal)
  363. Adds a group with the specified name.
  364. :param scene: Scene to add the group to
  365. :param name: Name of the group
  366. :param signal: If *true*, signals the scene with the *refresh*
  367. signal
  368. :return: The new group's scene item
  369. ---------------------
  370. .. function:: obs_sceneitem_t *obs_scene_insert_group(obs_scene_t *scene, const char *name, obs_sceneitem_t **items, size_t count)
  371. Creates a group out of the specified scene items. The group will be
  372. inserted at the top scene item. Does not signal the scene with the
  373. *refresh* signal.
  374. :param scene: Scene to add the group to
  375. :param name: Name of the group
  376. :param items: Array of scene items to put in a group
  377. :param count: Number of scene items in the array
  378. :return: The new group's scene item
  379. ---------------------
  380. .. function:: obs_sceneitem_t *obs_scene_insert_group2(obs_scene_t *scene, const char *name, obs_sceneitem_t **items, size_t count, bool signal)
  381. Creates a group out of the specified scene items. The group will be
  382. inserted at the top scene item. Does not signal a refresh.
  383. :param scene: Scene to add the group to
  384. :param name: Name of the group
  385. :param items: Array of scene items to put in a group
  386. :param count: Number of scene items in the array
  387. :param signal: If *true*, signals the scene with the *refresh*
  388. signal
  389. :return: The new group's scene item
  390. ---------------------
  391. .. function:: obs_sceneitem_t *obs_scene_get_group(obs_scene_t *scene, const char *name)
  392. Finds a group within a scene by its name.
  393. :param scene: Scene to find the group within
  394. :param name: The name of the group to find
  395. :return: The group scene item, or *NULL* if not found
  396. ---------------------
  397. .. function:: obs_scene_t *obs_group_from_source(const obs_source_t *source)
  398. :return: The group context, or *NULL* if not a group. Does not
  399. increase the reference
  400. ---------------------
  401. .. function:: obs_scene_t *obs_group_or_scene_from_source(const obs_source_t *source)
  402. :return: The context for the source, regardless of if it is a
  403. group or a scene. *NULL* if neither. Does not increase
  404. the reference
  405. ---------------------
  406. .. function:: bool obs_sceneitem_is_group(obs_sceneitem_t *item)
  407. :param item: Scene item
  408. :return: *true* if scene item is a group, *false* otherwise
  409. ---------------------
  410. .. function:: obs_scene_t *obs_sceneitem_group_get_scene(const obs_sceneitem_t *group)
  411. :param group: Group scene item
  412. :return: Scene of the group, or *NULL* if not a group
  413. ---------------------
  414. .. function:: void obs_sceneitem_group_ungroup(obs_sceneitem_t *group)
  415. Ungroups the specified group. Scene items within the group will be
  416. placed where the group was. Does not signal the scene with the
  417. *refresh* signal.
  418. ---------------------
  419. .. function:: void obs_sceneitem_group_ungroup2(obs_sceneitem_t *group, bool signal)
  420. Ungroups the specified group. Scene items within the group will be
  421. placed where the group was.
  422. :param group: Group scene item
  423. :param signal: If *true*, signals the scene with the *refresh*
  424. signal
  425. ---------------------
  426. .. function:: void obs_sceneitem_group_add_item(obs_sceneitem_t *group, obs_sceneitem_t *item)
  427. Adds a scene item to a group.
  428. ---------------------
  429. .. function:: void obs_sceneitem_group_remove_item(obs_sceneitem_t *item)
  430. Removes a scene item from a group. The item will be placed before
  431. the group in the main scene.
  432. ---------------------
  433. .. function:: obs_sceneitem_t *obs_sceneitem_get_group(obs_sceneitem_t *item)
  434. Returns the parent group of a scene item.
  435. :param item: Scene item to get the group of
  436. :return: The parent group of the scene item, or *NULL* if not in
  437. a group
  438. ---------------------
  439. .. function:: obs_sceneitem_t *obs_sceneitem_group_from_scene(obs_scene_t *scene)
  440. :return: The group associated with the scene, or *NULL* if the
  441. specified scene is not a group.
  442. ---------------------
  443. .. function:: obs_sceneitem_t *obs_sceneitem_group_from_source(obs_source_t *source)
  444. :return: The group associated with the scene's source, or *NULL* if
  445. the specified source is not a group.
  446. ---------------------
  447. .. function:: void obs_sceneitem_group_enum_items(obs_sceneitem_t *group, bool (*callback)(obs_scene_t*, obs_sceneitem_t*, void*), void *param)
  448. Enumerates scene items within a group.
  449. Callback function returns true to continue enumeration, or false to end
  450. enumeration.
  451. Use :c:func:`obs_sceneitem_addref()` if you want to retain a
  452. reference after obs_sceneitem_group_enum_items finishes.
  453. ---------------------
  454. .. function:: void obs_sceneitem_defer_group_resize_begin(obs_sceneitem_t *item)
  455. .. function:: void obs_sceneitem_defer_group_resize_end(obs_sceneitem_t *item)
  456. Allows the ability to call any one of the transform functions on
  457. scene items within a group without updating the internal matrices of
  458. the group until obs_sceneitem_defer_group_resize_end has been called.
  459. This is necessary if the user is resizing items while they are within
  460. a group, as the group's transform will automatically update its
  461. transform every frame otherwise.