Useful when you need to modify transform properties of group sub-items
and have the transform available immediately (group sub-items always
automatically defer their transform update to the next frame).
The value of 0 can represent a valid hotkey ID, so make sure that when
we initialize a hotkey variable, that we use OBS_INVALID_HOTKEY_ID or
OBS_INVALID_HOTKEY_PAIR_ID and not 0.
This fixes a bug where scene item hotkey pair IDs would be initialized
to 0, and it would unregister valid unrelated hotkeys. Particularly,
the start/stop streaming hotkey pair ID, which would commonly be the
first hotkey pair created, thus having the hotkey pair ID of 0. The
start/streaming hotkey pair would unintentionally be unregistered via
code in obs-scene.c.
Because groups can now be used in multiple scenes at once, it's
important that if the user wishes to ungroup a group, that they must be
able to keep the group intact if it exists in other scenes. This
requires duplicating all scene items (as well as their hotkey/private
data) instead of just reparenting the subitems.
This fixes an issue where if the user had the group referenced in
multiple scenes, the group would become empty in other scenes.
Due to the recent change in which scene items now only update their
transforms during the next frame's tick, snapping sources would
sometimes jitter and have incorrect snapping. This fixes that issue by
reverting to the behavior of updating the transform immediately rather
than deferring the update to the next frame tick, but only on non-group
items.
This should not be done on items that are sub-items of groups because we
rely on the obs_scene_item::update_transform variable to update the
parent group's transform in addition.
Instead of updating the scene item texture any time
update_item_transform() is called, only update it when
obs_scene_item::update_transform is called. Prevents having to lock the
graphics mutex needlessly.
If the scene item crop/filtering is updated, instead of
creating/destroying the item texture on the spot, update it in the
graphics thread to prevent potential race conditions (especially when
the crop function for example could be called from within
obs_scene_enum_items in some situations, which would lock the graphics
and scene mutexes in the wrong order).
(This commit also modifies UI)
Changes groups to their own independent type, "group". This allows them
to be used like other regular types, and allows the ability to reference
groups in multiple scenes. Before, a group would always be linked to
the scene it was in. This made it cumbersome for users to modify groups
if they had a similar group in multiple scenes (they would have to
modify each group in each scene). Making groups like other source types
makes more sense to solve this issue so they can be referenced in
multiple scenes at once. This also removes a significant amount of
group-specific handling code required for implementing groups in the
front-end.
One limitation however: due to the way sub-items of groups are
seamlessly modifiable and sortable as part of the whole scene, the user
cannot have multiple references to the same group within one scene.
(This commit also modifies UI)
Removes obs_scene::group_sceneitem and replaces it with
obs_scene::is_group. Changes a number of other functions related to
groups so that a group is not inherently tied to a specific scene, and
helps allow a single group to be referenced in multiple scenes if
desired.
Allows the ability to group scene items. Groups internally are
sub-scenes, which allows the ability to add unique filters and
transforms to each group.
Fixes a bug where items that had cropping would recalculate transform
every frame. obs_scene_item::last_width and obs_scene_item::last_height
would be set to the cropped sizes rather than the source's actual size.
When a scene is added as a scene item with the same audio sources that
are already in the current scene, it would cause the current scene to no
longer output audio due to audio.
To replicate the issue, you would create two separate audio device
captures in scene 1, use add existing in scene 2 and add one of those
audio sources, then go back to scene 1, add scene 2 as a source, then
make scene 1 invisible.
Fixes https://obsproject.com/mantis/view.php?id=508
The toggle_visibility set only by init_hotkeys() call, but used each
time in obs_sceneitem_destroy() call. Because zero hotkey_pair_id is
valid - we need to set item property other than zero here.
Closesjp9000/obs-studio#1000
When item in the old scene had only Scale Filter, texture renderer
was not created for an item in the new scene. However if the item also
had Crop set, the texture renderer was created.
Now after copying the data, texture renderer is created for the item in
the new scene when needed.
Closesjp9000/obs-studio#969
Scene items would incorrectly have pre-multiplied alpha when they were
scaled with different scale filtering, when they were cropped, or when
the item itself was a scene. This happens because the scene renders the
items to a texture in those cases, and when they are rendered to a
texture the blend function would be the default srcalpha/invsrcalpha
blend function, which would cause alpha to become pre-multiplied in the
texture's result rather than straight alpha.
This changes the behavior to directly copy the color/alpha to the
texture using the one/zero blend function instead, which makes the
resulting texture straight alpha. (Note that you do not want to turn
off the blend mode for the same result because certain sources can have
custom drawing that may rely on blending being available)
Related Issue: https://obsproject.com/mantis/view.php?id=954Closesjp9000/obs-studio#966
When there are audio sources in a scene and they've all stopped playing
their audio (audio is pending), all scene item audio actions (volume
changes, toggling visibility) will perpetually buffer and no longer be
processed until audio plays again.
So instead of that, if all audio sources have stopped playing in the
scene, just process all pending scene item audio actions immediately to
prevent them from never being processed while waiting for a scene item
to start playing audio.
Allows the ability to use scale filters such as point, bicubic, lanczos
on specific scene items, disabled by default. When using one of the
latter two options, if the item's scale is under half of the source's
original size, it uses the bilinear low resolution downscale shader
instead.