Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormano-wii <germano.costa@ig.com.br>2019-06-28 16:31:11 +0300
committermano-wii <germano.costa@ig.com.br>2019-06-28 16:31:48 +0300
commit026bd3ea750362ecab0ad4f3c19d978632768d9b (patch)
tree0a74f717c9ffe69d9797f3ecbf7bb2d8304d82d9 /mesh_snap_utilities_line
parent7d785fb156826a54ff58764988b30659ac1f5ba2 (diff)
mesh_snap_utilities_line: Fix local contrain
Diffstat (limited to 'mesh_snap_utilities_line')
-rw-r--r--mesh_snap_utilities_line/__init__.py2
-rw-r--r--mesh_snap_utilities_line/common_classes.py21
2 files changed, 13 insertions, 10 deletions
diff --git a/mesh_snap_utilities_line/__init__.py b/mesh_snap_utilities_line/__init__.py
index 59a22be1..c78489d3 100644
--- a/mesh_snap_utilities_line/__init__.py
+++ b/mesh_snap_utilities_line/__init__.py
@@ -21,7 +21,7 @@
bl_info = {
"name": "Snap_Utilities_Line",
"author": "Germano Cavalcante",
- "version": (5, 9, 17),
+ "version": (5, 9, 18),
"blender": (2, 80, 0),
"location": "View3D > TOOLS > Line Tool",
"description": "Extends Blender Snap controls",
diff --git a/mesh_snap_utilities_line/common_classes.py b/mesh_snap_utilities_line/common_classes.py
index 7be2fa97..611b07da 100644
--- a/mesh_snap_utilities_line/common_classes.py
+++ b/mesh_snap_utilities_line/common_classes.py
@@ -230,6 +230,7 @@ class Constrain:
self.orientation[1] = obj.matrix_world.to_3x3().transposed()
self.orientation_id = 0
+ self.center = Vector((0.0, 0.0, 0.0))
self.center_2d = Vector((0.0, 0.0))
self.projected_vecs = Matrix(([0.0, 0.0], [0.0, 0.0], [0.0, 0.0]))
@@ -300,16 +301,19 @@ class Constrain:
else:
self.preferences.auto_constrain = True
- def update(self, region, rv3d, mcursor, location):
- if rv3d.view_matrix != self.rotMat:
+ def update(self, region, rv3d, mcursor, center):
+ if rv3d.view_matrix != self.rotMat or self.center != center:
self.rotMat = rv3d.view_matrix.copy()
- self.center_2d = location_3d_to_region_2d(region, rv3d, location)
+ self.center = center.copy()
+ self.center_2d = location_3d_to_region_2d(region, rv3d, self.center)
- orig = location_3d_to_region_2d(region, rv3d, Vector())
- self.projected_vecs[0] = location_3d_to_region_2d(region, rv3d, self.orientation[self.orientation_id][0]) - orig
- self.projected_vecs[1] = location_3d_to_region_2d(region, rv3d, self.orientation[self.orientation_id][1]) - orig
- self.projected_vecs[2] = location_3d_to_region_2d(region, rv3d, self.orientation[self.orientation_id][2]) - orig
+ vec = self.center + self.orientation[self.orientation_id][0]
+ self.projected_vecs[0] = location_3d_to_region_2d(region, rv3d, vec) - self.center_2d
+ vec = self.center + self.orientation[self.orientation_id][1]
+ self.projected_vecs[1] = location_3d_to_region_2d(region, rv3d, vec) - self.center_2d
+ vec = self.center + self.orientation[self.orientation_id][2]
+ self.projected_vecs[2] = location_3d_to_region_2d(region, rv3d, vec) - self.center_2d
self.projected_vecs[0].normalize()
self.projected_vecs[1].normalize()
@@ -478,8 +482,7 @@ class SnapUtilities:
preferences.constrain_shift_color,
tuple(context.preferences.themes[0].user_interface.axis_x) + (1.0,),
tuple(context.preferences.themes[0].user_interface.axis_y) + (1.0,),
- tuple(context.preferences.themes[0].user_interface.axis_z) + (1.0,)
- )
+ tuple(context.preferences.themes[0].user_interface.axis_z) + (1.0,))
self.snap_vert = self.snap_edge = snap_edge_and_vert