Durss / Twitchat

Full featured Twitch chat alternative to fill gaps from the official one.
https://twitchat.fr
GNU General Public License v3.0
269 stars 30 forks source link

Sources are not moved if animation is enabled #62

Closed kuon closed 8 months ago

kuon commented 8 months ago

If I create a trigger to move a source, it works only if "Animate change" is unchecked.

With "Animate change" checked, the source doesn't move, and here is the debug log from OBS:

info: [obs-websocket] [debug] [WebSocketServer::onMessage] Incoming message (decoded):
{
  "d": {
    "requestId": "484",
    "requestType": "GetCurrentProgramScene"
  },
  "op": 6
}
info: [obs-websocket] [debug] [WebSocketServer::onMessage] Outgoing message:
{
  "d": {
    "requestId": "484",
    "requestStatus": {
      "code": 100,
      "result": true
    },
    "requestType": "GetCurrentProgramScene",
    "responseData": {
      "currentProgramSceneName": "Start Scene"
    }
  },
  "op": 7
}
info: [obs-websocket] [debug] [WebSocketServer::onMessage] Incoming message (decoded):
{
  "d": {
    "requestData": {
      "sceneItemId": 53,
      "sceneName": "Start Scene"
    },
    "requestId": "485",
    "requestType": "GetSceneItemTransform"
  },
  "op": 6
}
info: [obs-websocket] [debug] [WebSocketServer::onMessage] Outgoing message:
{
  "d": {
    "requestId": "485",
    "requestStatus": {
      "code": 100,
      "result": true
    },
    "requestType": "GetSceneItemTransform",
    "responseData": {
      "sceneItemTransform": {
        "alignment": 5,
        "boundsAlignment": 0,
        "boundsHeight": 1.0,
        "boundsType": "OBS_BOUNDS_NONE",
        "boundsWidth": 1.0,
        "cropBottom": 0,
        "cropLeft": 0,
        "cropRight": 0,
        "cropTop": 0,
        "height": 84.0,
        "positionX": 58.0,
        "positionY": 100.0,
        "rotation": 0.0,
        "scaleX": 1.0,
        "scaleY": 1.0,
        "sourceHeight": 84.0,
        "sourceWidth": 1804.0,
        "width": 1804.0
      }
    }
  },
  "op": 7
}

There is no message to set the transform.

In the trigger log, I see:

4.451Animate transformation. Duration: undefined. Easing: sine.in

The animation duration was set to the default 500ms value. If I rewrite 500, then the animation works. It seems there is a problem with the default value in the form. I use firefox, and it might be why the behaviour is different.

As a side note, I see that the input is of type number. I highly suggest you do not use that.

Durss commented 8 months ago

Thank you (again!) for that super complete feedback and for digging that far in the source code to help me on fixing things !

I've read all your links, very interesting reads thank you! I believe I handled the most critical cases by always validating and clamping numeric values and falling back to min value or 0 anytime it's changed. So I guess things should be "ok", and i'm really only using number field for actual numbers. I'm also a bit relluctant in updating the component that handles kinda all input types within Twitchat as making a mistake can have impacts everywhere if I make a mistake. But I'll definitely keep that in mind for the future, thank you very much for sharing this !

In the meantime, i fixed the missing fields default values for OBS transform animations and will deploy that in the coming days !

kuon commented 8 months ago

Yes, not using number field was more of a general suggestion and not a required immediate change.

Durss commented 8 months ago

The default values should be good now !