1
$\begingroup$

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
$\endgroup$

1 Answer 1

4
$\begingroup$

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
   
```
$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .