[Bf-extensions-cvs] [8168062] master: Update for changes to ray_cast
Germano Cavalcante mano-wii
noreply at git.blender.org
Wed Dec 2 14:35:04 CET 2015
Commit: 8168062e91b9eb75b825c44f5e555185181210ec
Author: Germano Cavalcante (mano-wii)
Date: Wed Dec 2 10:32:58 2015 -0300
Branches: master
https://developer.blender.org/rBAC8168062e91b9eb75b825c44f5e555185181210ec
Update for changes to ray_cast
===================================================================
M mesh_snap_utilities_line.py
===================================================================
diff --git a/mesh_snap_utilities_line.py b/mesh_snap_utilities_line.py
index b493f11..0169701 100644
--- a/mesh_snap_utilities_line.py
+++ b/mesh_snap_utilities_line.py
@@ -22,7 +22,7 @@
bl_info = {
"name": "Snap_Utilities_Line",
"author": "Germano Cavalcante",
- "version": (5, 2),
+ "version": (5, 6),
"blender": (2, 75, 0),
"location": "View3D > TOOLS > Snap Utilities > snap utilities",
"description": "Extends Blender Snap controls",
@@ -252,28 +252,18 @@ def snap_utilities(self,
self.type = 'OUT'
orig, view_vector = region_2d_to_orig_and_view_vector(region, rv3d, mcursor)
- end = orig + view_vector * 1000
- if not outer_verts or self.out_obj == None:
- result, self.out_obj, self.out_mat, self.location, normal = context.scene.ray_cast(orig, end)
+ if outer_verts:
+ result, self.location, normal, face_index, self.out_obj, self.out_mat = context.scene.ray_cast(orig, view_vector)
self.out_mat_inv = self.out_mat.inverted()
- #print(self.location)
if self.out_obj and self.out_obj != ignore_obj:
self.type = 'FACE'
if outer_verts:
- # get the ray relative to the self.out_obj
- ray_origin_obj = self.out_mat_inv * orig
- ray_target_obj = self.out_mat_inv * end
- location, normal, face_index = self.out_obj.ray_cast(ray_origin_obj, ray_target_obj)
- if face_index == -1:
- self.out_obj = None
- else:
- self.location = self.out_mat*location
+ if face_index != -1:
try:
verts = self.out_obj.data.polygons[face_index].vertices
v_dist = 100
-
for i in verts:
v_co = self.out_mat*self.out_obj.data.vertices[i].co
v_2d = location_3d_to_region_2d(region, rv3d, v_co)
@@ -291,7 +281,7 @@ def snap_utilities(self,
self.location = intersect_point_line(self.preloc, constrain[0], constrain[1])[0]
else:
if constrain:
- self.location = intersect_line_line(constrain[0], constrain[1], orig, end)[0]
+ self.location = intersect_line_line(constrain[0], constrain[1], orig, orig+view_vector)[0]
else:
self.location = out_Location(rv3d, region, orig, view_vector)
@@ -474,6 +464,12 @@ class SnapUtilitiesLine(bpy.types.Operator):
'LEFT_SHIFT': 'shift',
}
+ @classmethod
+ def poll(cls, context):
+ return (context.mode in {'EDIT_MESH', 'OBJECT'} and
+ context.object is not None and
+ context.object.type == 'MESH')
+
def modal_navigation(self, context, event):
#TO DO:
#'View Orbit', 'View Pan', 'NDOF Orbit View', 'NDOF Pan View'
@@ -845,7 +841,8 @@ class PanelSnapUtilities(bpy.types.Panel) :
@classmethod
def poll(cls, context):
- return (context.object is not None and
+ return (context.mode in {'EDIT_MESH', 'OBJECT'} and
+ context.object is not None and
context.object.type == 'MESH')
def draw(self, context):
More information about the Bf-extensions-cvs
mailing list