TransWikia.com

Make the movemouse event back to left when get to the edge of right

Blender Asked by atticus lv on December 9, 2020

Just like we are using the middle mouse button to navigate the 3dview.
When we get to the right of the 3dview, it gets back to the left

Is there an easy way to do it?
Or we can just use the simple ‘if else’ to check when the mouse get to right and reset it to left

This is how I handle the mouse move envent in the modal, and it can only go to the edge of the window

radius: bpy.props.FloatProperty()

def modal(self, context, event): 
    if event.type == 'MOUSEMOVE':
        delta = self.first_mouse_x - event.mouse_region_x
        obj.Rad = self.radius - delta * 0.01

One Answer

I got it... add this bl_option to the operator class can make it

bl_options = {'REGISTER', 'GRAB_CURSOR', 'BLOCKING', 'UNDO'} 
# GRAB_CURSOR + BLOCKING enables wrap-around mouse feature.

and then fix the mouse event by using mouse_x

if event.type == 'MOUSEMOVE':
    self.mouseDX = self.mouseDX - event.mouse_x
    multiplier = 0.005 if event.shift else 0.02
    # multi offset
    offset = self.mouseDX
    obj.Rad -=  offset * multiplier
    # reset
    self.mouseDX = event.mouse_x
   
```

Answered by atticus lv on December 9, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP