Skip to content

Commit

Permalink
fix scale offset
Browse files Browse the repository at this point in the history
  • Loading branch information
upgradeQ committed Jul 22, 2020
1 parent f32d168 commit ad8ca1f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@ Selected source will follow mouse pointer.
Using [`obs_sceneitem_set_pos`](https://obsproject.com/docs/reference-scenes.html#c.obs_sceneitem_set_pos)
# Installation
- Make sure your OBS Studio supports [scripting](https://obsproject.com/docs/scripting.html)
- Download [here](https://github.com/upgradeQ/OBS-Studio-Cursor-skin/releases/tag/0.2.0)
- Download and extract source code from [here](https://github.com/upgradeQ/OBS-Studio-Cursor-skin/releases/tag/0.2.1)
- You will need to install mouse package from [pypi](https://pypi.org/project/mouse/):
`python -m pip install mouse`
# Limitations
- Multilpe monitors setup will not work .
# Usage
- Create _source_ with desired cursor(e.g Image source or Media source).
- In scripts select _that_ source name.
- Test it: press Start, press Stop, tweak refresh rate.
# Crop auto update
Shape of higlight , shape of zoom etc...
For zoom or higlight.
- Create 2 display captures.
- Create crop filter with this name: `cropXY`.
- Check relative.
Expand All @@ -25,8 +27,8 @@ They all have some level of transparency.
![img](https://i.imgur.com/ruzF9HN.png)
- red circle
![img](https://i.imgur.com/8qoRU3i.png)
- spotlight circle
![img](https://i.imgur.com/XRvwuSf.png)
- green circle
![Imgur](https://i.imgur.com/s3jvZP5.png)
# Contribute
[Forks](https://help.github.com/articles/fork-a-repo) are a great way to contribute to a repository.
After forking a repository, you can send the original author a [pull request](https://help.github.com/articles/using-pull-requests)
After forking a repository, you can send the original author a [pull request](https://help.github.com/articles/using-pull-requests)
13 changes: 12 additions & 1 deletion mouse_skin_obs.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
import obspython as obs
from mouse import get_position # python -m pip install mouse

__version__ = "0.2.0"
__version__ = "0.2.1"
REFRESH_RATE = 15
FLAG = True


def apply_scale(x, y, width, height):
width = round(width * x)
height = round(height * y)
return width, height


class CursorAsSource:
def __init__(self, source_name=None):
self.source_name = source_name
Expand All @@ -21,6 +27,11 @@ def update_cursor(self):
scene = obs.obs_scene_from_source(scene_source)
scene_item = obs.obs_scene_find_source(scene, self.source_name)
if scene_item:
scale = obs.vec2()
obs.obs_sceneitem_get_scale(scene_item, scale)
scene_width, scene_height = apply_scale(
scale.x, scale.y, scene_width, scene_height
)
next_pos = obs.vec2()
next_pos.x, next_pos.y = get_position()
next_pos.x -= scene_width / 2
Expand Down

0 comments on commit ad8ca1f

Please sign in to comment.