mirror of
https://github.com/obsproject/obs-studio.git
synced 2024-10-23 06:44:27 +08:00
libobs: Deprecate obs_scene_sceneitem_from_source
obs_scene_sceneitem_from_source is problematic because there can be multiple items of the same source in a scene, which the function doesn't account for. In such a case, it would return the first item it finds, which often might not be what a developer expects. It was originally added for the undo/redo-operation of "Add New Source" where the UI guarantees that the item is unique, but for a general case it's not suitable.
This commit is contained in:
parent
e3435f8dee
commit
4dd3cf6758
@ -326,6 +326,11 @@ Scene Item Functions
|
||||
|
||||
:return: The sceneitem associated with a source in a scene. Returns NULL if not found.
|
||||
|
||||
.. deprecated:: 31.0
|
||||
This function is problematic because there can be multiple items of the same source in a scene.
|
||||
In that case, which of those this function will return is undefined.
|
||||
If this is the behavior you need, manually use :c:func:`obs_scene_enum_items` instead.
|
||||
|
||||
---------------------
|
||||
|
||||
.. function:: void obs_sceneitem_set_id(obs_sceneitem_t *item);
|
||||
|
@ -1806,8 +1806,8 @@ EXPORT void obs_sceneitem_save(obs_sceneitem_t *item, obs_data_array_t *arr);
|
||||
EXPORT void obs_sceneitem_set_id(obs_sceneitem_t *sceneitem, int64_t id);
|
||||
|
||||
/** Tries to find the sceneitem of the source in a given scene. Returns NULL if not found */
|
||||
EXPORT obs_sceneitem_t *obs_scene_sceneitem_from_source(obs_scene_t *scene,
|
||||
obs_source_t *source);
|
||||
OBS_DEPRECATED EXPORT obs_sceneitem_t *
|
||||
obs_scene_sceneitem_from_source(obs_scene_t *scene, obs_source_t *source);
|
||||
|
||||
/** Save all the transform states for a current scene's sceneitems */
|
||||
EXPORT obs_data_t *obs_scene_save_transform_states(obs_scene_t *scene,
|
||||
|
Loading…
Reference in New Issue
Block a user