obs-websocket icon indicating copy to clipboard operation
obs-websocket copied to clipboard

Bug: SceneItemCreated event reports incorrect scene item ID while changing scene collections

Open entriphy opened this issue 3 years ago • 1 comments

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

  1. Change scene collections (emits CurrentSceneCollectionChanging)
  2. Wait for CurrentSceneCollectionChanged event to emit
  3. Call GetSceneItemList on a scene
  4. Compare the scene item ID from a SceneItemCreated event (that was emitted between the CurrentSceneCollectionChanging event and the CurrentSceneCollectionChanged event) to the scene item ID in GetSceneItemList

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.

entriphy avatar May 23 '22 00:05 entriphy

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)

tt2468 avatar Jun 08 '22 08:06 tt2468

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

Niek avatar Oct 02 '22 08:10 Niek

Closing this, as it should be irrelevant now that we no longer emit events during scene collection changes.

tt2468 avatar Jan 16 '24 09:01 tt2468