Resource icon

Zoom to Mouse 1.0.1

i try use that Set manual source position, still not work.
pretty much nothing change to in that width & height.
since my display capture monitor is 1080p

and also i use 2nd script but for browser only. both not working for me now.
sorry if to many screenshot :x
Hmmm, very odd. Do you still get that warning in the script log?
 

jenks_

New Member
I'm struggling to get this to work with a source clone of a nested scene. It's possible what I'm trying to do just won't work, but maybe you have an idea?

I have a nested scene called [N] Display Capture that has two Display Capture sources inside of it (one for each monitor I have).
Then, in my Desktop scene, I use a clone of that nested scene, called [C] Display Capture.

I tried "Allow any zoom source" and selecting [C] Display Capture, and I tried setting the manual source position. Two issues occur:

1. The display capture clone won't show up at all, unless I uncheck the obs-zoom-to-mouse-crop filter.
2. Even if I uncheck that filter, the clone will show up, but the size is too small and off-center, no matter what I change the manual source position to.

Any help would be much appreciated! Thank you!!
 
I'm struggling to get this to work with a source clone of a nested scene. It's possible what I'm trying to do just won't work, but maybe you have an idea?

I have a nested scene called [N] Display Capture that has two Display Capture sources inside of it (one for each monitor I have).
Then, in my Desktop scene, I use a clone of that nested scene, called [C] Display Capture.

I tried "Allow any zoom source" and selecting [C] Display Capture, and I tried setting the manual source position. Two issues occur:

1. The display capture clone won't show up at all, unless I uncheck the obs-zoom-to-mouse-crop filter.
2. Even if I uncheck that filter, the clone will show up, but the size is too small and off-center, no matter what I change the manual source position to.

Any help would be much appreciated! Thank you!!
Removing the filter and it showing up, suggested that the calculated sizes are wrong.

Can you enable debug script logging, re load the script and share the log? That might help me figure out what is going wrong. Thanks
 

devaughn46

New Member
Is there a way to make the zoom follow the mouse even outside the bounds/edge of the source? In the original "zoom & follow" (python) it follows the mouse even when it moves toward/outside the edges.

I've linked a video example of what i mean. If its not possible now, would it be considered to be added in a future update?

Example: https://gifyu.com/image/S0YX0
 

jenks_

New Member
Removing the filter and it showing up, suggested that the calculated sizes are wrong.

Can you enable debug script logging, re load the script and share the log? That might help me figure out what is going wrong. Thanks
It seems that it has something to do with the crop/pad filter I have on [C] Display Capture. It's saying that it's a "non-relative crop," but that's not true, it's a relative crop of -200 on all sides (padding for a drop-shadow filter).

[obs-zoom-to-mouse.lua] Finding sceneitem for Zoom Source '[C] Display Capture'
[obs-zoom-to-mouse.lua] Looking in scene 'Scene'
[obs-zoom-to-mouse.lua] Found sceneitem '[C] Display Capture'
[obs-zoom-to-mouse.lua] Using source size: 1920, 1080
[obs-zoom-to-mouse.lua] WARNING: Found existing non-relative crop/pad filter (Crop/Pad).
[obs-zoom-to-mouse.lua] This will cause issues with zooming. Convert to relative settings instead.
 

jenks_

New Member
Okay I was able to get it working by unselecting "relative" -- I still needed to add padding to the source, so I did that by setting the crop/pad filter width and height to 2320x1480 (i.e., 1920x1080 + 400).

The only issue now is that this padding shows up when zooming in, so there is this black space around the perimeter of the canvas.

Also, zooming on my second monitor doesn't seem to be behaving correctly. I assume the solution might be duplicating the script with different manual position for the second monitor?
 
Okay I was able to get it working by unselecting "relative" -- I still needed to add padding to the source, so I did that by setting the crop/pad filter width and height to 2320x1480 (i.e., 1920x1080 + 400).

The only issue now is that this padding shows up when zooming in, so there is this black space around the perimeter of the canvas.
It looks like the error message in the script is backwards, its warning you about non-relative crop/pad filter, when really that's the kind of filter it actually wants. Sorry about that, I need to swap the wording.

For the padding showing up, I expect this is an existing issue that I haven't managed to fix yet, where it cannot calculate the zoom crop offset automatically. The workaround for this is to edit the script slightly for your specific scenario. If you open the obs-zoom-to-mouse.lua file in a text editor (notepad will work), and then edit the values for the crop.x and crop.y calculations around line 789 :

Lua:
crop.x = math.floor(clamp(0, (zoom.source_size.width - new_size.width), crop.x))
crop.y = math.floor(clamp(0, (zoom.source_size.height - new_size.height), crop.y))

You'll want to change the 0s (for the left/top amount) and a value after the new_size_width/height (for the right/bottom). Something like this might work for you (to add 200 to each side assuming your padding is centered):

Lua:
crop.x = math.floor(clamp(200, (zoom.source_size.width - new_size.width - 200), crop.x))
crop.y = math.floor(clamp(200, (zoom.source_size.height - new_size.height - 200), crop.y))

That should prevent the zoom from showing the padding outside of the area. Though you may need to play around with the numbers. Let me know if that works, if so, I think I will just add some new settings to the script to let people customize these values without needing to edit the file all the time.

Also, zooming on my second monitor doesn't seem to be behaving correctly. I assume the solution might be duplicating the script with different manual position for the second monitor?
I suspect so, yes. I had an idea for letting people select multiple different zoom sources each with their own set of positions/crops/zoom/speeds by using a custom filter that you applied to the sources that you wanted to zoom, rather than having a single set of settings you put in the script window. But I had some issues with OBS crashing when I created those magic filters from lua, so I put in on hold. The current workaround is to duplicate the script and rename it.
 

jenks_

New Member
For the padding showing up, I expect this is an existing issue that I haven't managed to fix yet, where it cannot calculate the zoom crop offset automatically. The workaround for this is to edit the script slightly for your specific scenario. If you open the obs-zoom-to-mouse.lua file in a text editor (notepad will work), and then edit the values for the crop.x and crop.y calculations around line 789 :
Thank you for this reply! I tried editing the script, but it didn't seem to do anything. I actually worked around the issue though -- it turns out that I didn't need the crop/pad filter anymore, so I just disabled it. (I was using it because usually sources need padding to properly display a drop-shadow, but the source already has some padding, maybe because the bounding box is set to "scale to inner bounds," I'm not sure.

I suspect so, yes. I had an idea for letting people select multiple different zoom sources each with their own set of positions/crops/zoom/speeds by using a custom filter that you applied to the sources that you wanted to zoom, rather than having a single set of settings you put in the script window. But I had some issues with OBS crashing when I created those magic filters from lua, so I put in on hold. The current workaround is to duplicate the script and rename it.

Okay, that worked, I just duplicated the script, and I'm able to activate them with the same shortcut. So now, when I zoom in, it doesn't matter which monitor I'm using. The only small issue I notice is that since it's activating both zooms simultaneously, if my mouse is on my secondary display, the screen will zoom in and then "jump" to where my mouse is. Works normally after that little "jump." Not sure how to explain it, I may take a video later. Either way, it's not a big deal.

Thanks again!
 

jenks_

New Member
Update: The easiest fix to the “jumping” was just to use two separate hotkeys. And I was able to turn that into one button on my stream deck by using streamer.bot with conditional logic to check which monitor is visible and then toggle the appropriate hotkey. Win.
 
yes still not working, re apply the script also not working
Could you enable debug logging, reload the script via the button in OBS, and then send me the script log?

I don't know why it would do absolutely nothing, maybe there is a script exception happening. The log should help. Thanks
 

svOzt

New Member
oh sorry, i think i made a mistake because the source of Display capture or my Any source is on a folder.they need to be on outside of that to be work.
but i still can't made its works when i put them on my Nested Scene :/

==============
forget to put the script log.

[obs-zoom-to-mouse 2.lua] Scene changed
[obs-zoom-to-mouse 2.lua] Zoom crop filter removed
[obs-zoom-to-mouse 2.lua] Transform info reset back to original
[obs-zoom-to-mouse 2.lua] Transform crop reset back to original
[obs-zoom-to-mouse 2.lua] Finding sceneitem for Zoom Source 'Web Browser'
[obs-zoom-to-mouse 2.lua] Looking in scene 'Scene Lands Camera'
[obs-zoom-to-mouse 2.lua] Looking in scene '[ N ] Audio'
[obs-zoom-to-mouse 2.lua] WARNING: Source not part of the current scene hierarchy.
[obs-zoom-to-mouse 2.lua] Try selecting a different zoom source or switching scenes.
 
Last edited:
oh sorry, i think i made a mistake because the source of Display capture or my Any source is on a folder.they need to be on outside of that to be work.
but i still can't made its works when i put them on my Nested Scene :/

==============
forget to put the script log.

[obs-zoom-to-mouse 2.lua] Scene changed
[obs-zoom-to-mouse 2.lua] Zoom crop filter removed
[obs-zoom-to-mouse 2.lua] Transform info reset back to original
[obs-zoom-to-mouse 2.lua] Transform crop reset back to original
[obs-zoom-to-mouse 2.lua] Finding sceneitem for Zoom Source 'Web Browser'
[obs-zoom-to-mouse 2.lua] Looking in scene 'Scene Lands Camera'
[obs-zoom-to-mouse 2.lua] Looking in scene '[ N ] Audio'
[obs-zoom-to-mouse 2.lua] WARNING: Source not part of the current scene hierarchy.
[obs-zoom-to-mouse 2.lua] Try selecting a different zoom source or switching scenes.
It's failing to find the source that you selected. What does your scene hierarchy look like that contains the web browser source? Is it like: Scene Lands Camera (scene) -> [N] Audio scene (scene) -> Web Browser (source)?
 

svOzt

New Member
It's failing to find the source that you selected. What does your scene hierarchy look like that contains the web browser source? Is it like: Scene Lands Camera (scene) -> [N] Audio scene (scene) -> Web Browser (source)?
Yess,
the script source i want to zoom is "web browser", its on my Nested scene called [ N ] Main Display.
and that log on top is when i use my Scene " Scene Lands Camera "
and i just realize, the script try to read Scene, like my nested Audio there. but its not try to reading my Nested scene, because they are on Source Clone.

btw sorry if hard to understand my word. english is not my 1st language
1706074172146.png
 
Yess,
the script source i want to zoom is "web browser", its on my Nested scene called [ N ] Main Display.
and that log on top is when i use my Scene " Scene Lands Camera "
and i just realize, the script try to read Scene, like my nested Audio there. but its not try to reading my Nested scene, because they are on Source Clone.

btw sorry if hard to understand my word. english is not my 1st language
Ok, the problem is that the clone isn't actually an OBS scene. When you use that plugin to clone a scene it doesn't create a real scene with children, instead it just creates a video buffer with everything added together and displays it.

It isn't possible for the script to look into a cloned scene and find the actual web browser source that you want to zoom on because it's not really there, it's just a video of it combined with whatever else is in that clone.

The closest you can get, is to set the 'Zoom Source' in the script to be the clone source (which I think from your screenshots is called 'Game Source'). That will allow you to zoom in when you have 'Scene Lands Camera' scene selected. But it won't be able to restrict it to just the web browser part of the cloned scene.

Sorry.
 

svOzt

New Member
Ok, the problem is that the clone isn't actually an OBS scene. When you use that plugin to clone a scene it doesn't create a real scene with children, instead it just creates a video buffer with everything added together and displays it.

It isn't possible for the script to look into a cloned scene and find the actual web browser source that you want to zoom on because it's not really there, it's just a video of it combined with whatever else is in that clone.

The closest you can get, is to set the 'Zoom Source' in the script to be the clone source (which I think from your screenshots is called 'Game Source'). That will allow you to zoom in when you have 'Scene Lands Camera' scene selected. But it won't be able to restrict it to just the web browser part of the cloned scene.

Sorry.
ahh i see, ok im gonna try this
 

svOzt

New Member
Ok, the problem is that the clone isn't actually an OBS scene. When you use that plugin to clone a scene it doesn't create a real scene with children, instead it just creates a video buffer with everything added together and displays it.

It isn't possible for the script to look into a cloned scene and find the actual web browser source that you want to zoom on because it's not really there, it's just a video of it combined with whatever else is in that clone.

The closest you can get, is to set the 'Zoom Source' in the script to be the clone source (which I think from your screenshots is called 'Game Source'). That will allow you to zoom in when you have 'Scene Lands Camera' scene selected. But it won't be able to restrict it to just the web browser part of the cloned scene.

Sorry.
just for info, if anyone got some problem like me,
if you guys gonna use Source Clone plugin, use the Zoom Source like he say.
its works smooth~
thanks for the awesome script!
 

albertocv

Member
This script saved me, thanks!

I only have a problem. I started getting the error "starting the output failed"
I implemented every possible solution, but it still randomly appears. I don't know if it's the scripts fault, but it's the only recent change in my OBS setup.
Any idea?
 
This script saved me, thanks!

I only have a problem. I started getting the error "starting the output failed"
I implemented every possible solution, but it still randomly appears. I don't know if it's the scripts fault, but it's the only recent change in my OBS setup.
Any idea?
I don't think that issue is caused by the script, it doesn't do anything with the output it only adds and updates a crop filter.

More likely it is some change to the OBS output settings or maybe some drivers got updated on your machine.
 

albertocv

Member
I don't think that issue is caused by the script, it doesn't do anything with the output it only adds and updates a crop filter.

More likely it is some change to the OBS output settings or maybe some drivers got updated on your machine.
Thanks. Yes I updated the driver in the first place.

It may be something related to my multiple monitor setup. Pressing Alt+Tab seems to trigger the error message
 
Top