Bug: SceneItemCreated event reports incorrect scene item ID while changing scene collections
Operating System Info
Other
Other OS
Arch Linux
OBS Studio Version
27.2.4
OBS Studio Version (Other)
No response
obs-websocket Version
Git
OBS Studio Log URL
https://obsproject.com/logs/IzaD_EbNGUx9aYMM
OBS Studio Crash Log URL
No response
Expected Behavior
SceneItemCreated gives the correct scene item ID while changing scene collections.
Current Behavior
The SceneItemCreated event does not give the correct scene item ID while changing scene collections.
Steps to Reproduce
- Change scene collections (emits
CurrentSceneCollectionChanging) - Wait for
CurrentSceneCollectionChangedevent to emit - Call
GetSceneItemListon a scene - Compare the scene item ID from a
SceneItemCreatedevent (that was emitted between theCurrentSceneCollectionChangingevent and theCurrentSceneCollectionChangedevent) to the scene item ID inGetSceneItemList
Anything else we should know?
Truncated event log:
{eventData: {sceneCollectionName: Main}, eventType: CurrentSceneCollectionChanging}
{eventData: {isGroup: false, sceneName: Scene}, eventType: SceneCreated}
{eventData: {sceneItemId: 1, sceneItemIndex: 0, sceneName: Scene, sourceName: Text (FreeType 2)}, eventType: SceneItemCreated}
{eventData: {sceneCollectionName: Test}, eventType: CurrentSceneCollectionChanged}
Call GetSceneItemList("Scene"):
{sceneItems: [{inputKind: text_ft2_source_v2, isGroup: null, sceneItemId: 3, sceneItemIndex: 0, sourceName: Text (FreeType 2), sourceType: OBS_SOURCE_TYPE_INPUT}]}
Notice how the ID is 1 in the SceneItemCreated event, but the ID is 3 in GetSceneItemList for the same scene item.
Hmmm, I'd be tempted to mark events sent during scene collection change as undefined and unsupported, but I definitely could understand the value of having that insight for clients that rely on clientside state caching mechanisms. I'll have to look further into this, as it's most likely an OBS issue, and not an obs-websocket issue (though still only relevant for obs-websocket of course)
Related to this, IMHO the CurrentSceneCollectionChanged event should also emit a SceneListChanged event, since the list of scenes changes. See also: https://github.com/Niek/obs-web/commit/c698bf95a03bd813ba5e63c04fbad83ff9036584
Closing this, as it should be irrelevant now that we no longer emit events during scene collection changes.