Snap Utilities Line: FIx inverted rotation.

And cleanup.
This commit is contained in:
Germano Cavalcante 2018-11-05 09:43:53 -02:00
parent f7f65ffa7e
commit 4207e249e5
1 changed files with 4 additions and 8 deletions

View File

@ -427,10 +427,6 @@ class MousePointWidgetGroup(bpy.types.GizmoGroup):
bl_region_type = 'WINDOW'
bl_options = {'3D'}
__slots__ = (
"snap_widget",
)
def setup(self, context):
snap_widget = self.gizmos.new(MousePointWidget.bl_idname)
props = snap_widget.target_set_operator("mesh.make_line")
@ -442,16 +438,16 @@ class VIEW3D_OT_rotate_custom_pivot(bpy.types.Operator):
bl_label = "Rotate the view"
bl_options = {'BLOCKING', 'GRAB_CURSOR'}
pivot = bpy.props.FloatVectorProperty("Pivot", subtype='XYZ')
g_up_axis = bpy.props.FloatVectorProperty("up_axis", default=(0.0, 0.0, 1.0), subtype='XYZ')
sensitivity = bpy.props.FloatProperty("sensitivity", default=0.007)
pivot: bpy.props.FloatVectorProperty("Pivot", subtype='XYZ')
g_up_axis: bpy.props.FloatVectorProperty("up_axis", default=(0.0, 0.0, 1.0), subtype='XYZ')
sensitivity: bpy.props.FloatProperty("sensitivity", default=0.007)
def modal(self, context, event):
from mathutils import Matrix
if event.value == 'PRESS' and event.type in {'MOUSEMOVE', 'INBETWEEN_MOUSEMOVE'}:
dx = self.init_coord[0] - event.mouse_region_x
dy = self.init_coord[1] - event.mouse_region_y
rot_ver = Matrix.Rotation(dx * self.sensitivity, 3, self.g_up_axis)
rot_ver = Matrix.Rotation(-dx * self.sensitivity, 3, self.g_up_axis)
rot_hor = Matrix.Rotation(dy * self.sensitivity, 3, self.view_rot[0])
rot_mat = rot_hor @ rot_ver
view_matrix = self.view_rot @ rot_mat