BlankSourceCode / obs-zoom-to-mouse

An OBS lua script to zoom a display-capture source to focus on the mouse
178 stars 15 forks source link

Prevent zero size when loading #22

Closed BlankSourceCode closed 6 months ago

BlankSourceCode commented 6 months ago

This PR fixes #21 where the source size can be set to zero when loading OBS meaning that it looks all messed up.

Issue: When loading OBS, the script would attempt to refresh the sceneitem when the settings were loaded but when it looked up the source size it would get a zero. This would cause the crop/pad filter that gets added for zoom to mess up the source.

Cause: It seems that during load, OBS is not always ready to report source size information and returns 0.

Fix: The fix is to add an is_loaded flag that we use to tell if OBS has finished loading, and only refresh the sceneitem when the flag is true.