Elektordi / obs-websocket-py

Python library to communicate with an obs-websocket server (for OBS Studio)
MIT License
235 stars 59 forks source link

GetSceneItemProperties 'width' and 'height' should return another value. #58

Closed MarioMey closed 3 years ago

MarioMey commented 3 years ago

Supposedly, width and height are the final sceneitem size. They return the base width and height multiplied by their scale:

// Utils.cpp:784
    obs_data_set_double(data, "width", baseSourceWidth * scale.x);
    obs_data_set_double(data, "height", baseSourceHeight * scale.y);

Shouldn't they be substracted by its crop values before multiplying them? Something like:

// Utils.cpp:784
    obs_data_set_double(data, "width", (baseSourceWidth - crop.left - crop.right)* scale.x);
    obs_data_set_double(data, "height", (baseSourceHeight - crop.top - crop.bottom) * scale.y);

(I don't know C++, maybe it's misspelled)

Saddly, I don't use obs-websocket-py anymore 😢... because I programed my own OBS-OSC-PythonScript 0.1. Now, I don't send OSC messages to Python and Python to Websockets... it's slow and it crashes OBS several times. I directly send OSC messages to Python script 😉.

But I've been using obs-websockets-py for a time and now, I realized that GetSceneItemProperties should be different. As I fixed that in my code, maybe you want to change in yours.

Thank you very much for your code!

Elektordi commented 3 years ago

Hello @MarioMey,

Are you sure you opened the issue on the correct repo? There is no C++ here, only python!

If you are talking about this file https://github.com/Palakis/obs-websocket/blob/4.x-current/src/Utils.cpp then the issue is for the websocket server itself, not the python connector. You should open it there: https://github.com/Palakis/obs-websocket/issues

MarioMey commented 3 years ago

Oh, you are right! Sorry!

Elektordi commented 3 years ago

No problem!

I see you opened it there: https://github.com/Palakis/obs-websocket/issues/670 I'm closing this one.