tinodo / obsclient

A Complete .NET Client for OBS Studio 28 and up.
MIT License
10 stars 2 forks source link

Issue with GetSceneItemTransform #6

Closed FaNim21 closed 6 months ago

FaNim21 commented 6 months ago

Hi i got this error:

System.InvalidCastException
  HResult=0x80004002
  Message=Unable to cast object of type 'OBSStudioClient.Responses.SceneItemIdResponse' to type 'OBSStudioClient.Responses.SceneItemTransformResponse'.
  Source=OBSClient
  Ślad stosu:
   w OBSStudioClient.ObsClient.<SendRequestAsync>d__76`1.MoveNext()
   w OBSStudioClient.ObsClient.<GetSceneItemTransform>d__334.MoveNext()

trying to get transform from scene item:

SceneItem[] sceneItems = await MainViewModel.client.GetSceneItemList(MainViewModel.CurrentChosen.Scene);
foreach (var item in sceneItems)
{
    if (item.SourceName.StartsWith("pov", StringComparison.OrdinalIgnoreCase))
    {
        PointOfView pov = new();
        var response = await MainViewModel.client.GetSceneItemTransform(MainViewModel.CurrentChosen.Scene, item.SceneItemId);

    }
}

and any casting or any thing like that does not works. Iam using obs 30.0.2 and .net8 in wpf

tinodo commented 6 months ago

Great find @FaNim21!

I found the issue in the code, and published a fix for the issue in version 2.0.1. The new packages should be available on nuget soon!

Thanks!