This PR updates the refresh_sceneitem() function so that it will search for the matching source_name inside nested scenes.
Issue:
Previously if you had a scene nested inside another scene then the script would be unable to find the matching sceneitem. This would prevent any zooming because without the sceneitem we cannot update the crop/pad filter.
Cause:
The problem was due to assuming that the source_name would be available in the current scene via the obs_scene_sceneitem_from_source() call. Apparently this isn't the case if you have nested a scene inside the current scene.
Fix:
The fix is to use obs_scene_find_source() to find the matching source in the specified scene. We start with the current scene, and if the source isn't found, we enumerate the scene items to look for nested scenes. If we find any, we then search into those scenes too. We use BFS as the source is most likely to be at the top level of the scene.
Also fixes an issue with sub-pixel coordinates by using math.floor()
This PR updates the
refresh_sceneitem()
function so that it will search for the matchingsource_name
inside nested scenes.Issue: Previously if you had a scene nested inside another scene then the script would be unable to find the matching sceneitem. This would prevent any zooming because without the sceneitem we cannot update the crop/pad filter.
Cause: The problem was due to assuming that the source_name would be available in the current scene via the
obs_scene_sceneitem_from_source()
call. Apparently this isn't the case if you have nested a scene inside the current scene.Fix: The fix is to use
obs_scene_find_source()
to find the matching source in the specified scene. We start with the current scene, and if the source isn't found, we enumerate the scene items to look for nested scenes. If we find any, we then search into those scenes too. We use BFS as the source is most likely to be at the top level of the scene.Also fixes an issue with sub-pixel coordinates by using
math.floor()
Fixes #4