Skip to content
Snippets Groups Projects
Commit f0e2d0e6 authored by mano-wii's avatar mano-wii
Browse files

mesh_snap_utilitie_line: Don't always pass the active object mesh as the main mesh.

parent a5aec7f5
No related branches found
No related tags found
No related merge requests found
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
bl_info = { bl_info = {
"name": "Snap_Utilities_Line", "name": "Snap_Utilities_Line",
"author": "Germano Cavalcante", "author": "Germano Cavalcante",
"version": (5, 9, 3), "version": (5, 9, 4),
"blender": (2, 80, 0), "blender": (2, 80, 0),
"location": "View3D > TOOLS > Line Tool", "location": "View3D > TOOLS > Line Tool",
"description": "Extends Blender Snap controls", "description": "Extends Blender Snap controls",
......
...@@ -311,7 +311,7 @@ class SnapUtilities: ...@@ -311,7 +311,7 @@ class SnapUtilities:
if SnapUtilities.snapwidgets: if SnapUtilities.snapwidgets:
widget = SnapUtilities.snapwidgets[-1] widget = SnapUtilities.snapwidgets[-1]
self.snap_obj = widget.snap_obj self.obj = widget.snap_obj.data[0] if widget.snap_obj else context.active_object
self.bm = widget.bm self.bm = widget.bm
self.geom = widget.geom self.geom = widget.geom
self.type = widget.type self.type = widget.type
...@@ -325,7 +325,7 @@ class SnapUtilities: ...@@ -325,7 +325,7 @@ class SnapUtilities:
else: else:
#init these variables to avoid errors #init these variables to avoid errors
self.snap_obj = None self.obj = context.active_object
self.bm = None self.bm = None
self.geom = None self.geom = None
self.type = 'OUT' self.type = 'OUT'
......
...@@ -233,11 +233,11 @@ class SnapUtilitiesLine(SnapUtilities, bpy.types.Operator): ...@@ -233,11 +233,11 @@ class SnapUtilitiesLine(SnapUtilities, bpy.types.Operator):
self.vector_constrain = () self.vector_constrain = ()
self.len = 0 self.len = 0
active_object = context.active_object self.main_snap_obj = self.snap_obj = self.sctx._get_snap_obj_by_obj(self.obj)
mesh = active_object.data if self.bm == None:
self.bm = bmesh.from_edit_mesh(self.obj.data)
self.main_snap_obj = self.snap_obj = self.sctx._get_snap_obj_by_obj(active_object) self.main_bm = self.bm
self.main_bm = self.bm = bmesh.from_edit_mesh(mesh)
def modal(self, context, event): def modal(self, context, event):
if self.navigation_ops.run(context, event, self.prevloc if self.vector_constrain else self.location): if self.navigation_ops.run(context, event, self.prevloc if self.vector_constrain else self.location):
...@@ -435,7 +435,7 @@ class SnapUtilitiesLine(SnapUtilities, bpy.types.Operator): ...@@ -435,7 +435,7 @@ class SnapUtilitiesLine(SnapUtilities, bpy.types.Operator):
context.window_manager.modal_handler_add(self) context.window_manager.modal_handler_add(self)
if not self.wait_for_input: if not self.wait_for_input:
mat_inv = context.object.matrix_world.inverted_safe() mat_inv = self.obj.matrix_world.inverted_safe()
point = mat_inv @ self.location point = mat_inv @ self.location
self.list_verts_co = make_line(self, self.geom, point) self.list_verts_co = make_line(self, self.geom, point)
......
...@@ -49,7 +49,6 @@ class SnapWidgetCommon(SnapUtilities): ...@@ -49,7 +49,6 @@ class SnapWidgetCommon(SnapUtilities):
else: else:
self.bm = None self.bm = None
self.geom = None self.geom = None
self.sctx.update_all()
self.draw_cache.draw(self.type, self.location, None, None, None) self.draw_cache.draw(self.type, self.location, None, None, None)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment