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:
authorzeffii <tetha.z@gmail.com>2017-02-17 11:17:07 +0300
committerzeffii <tetha.z@gmail.com>2017-02-17 11:17:07 +0300
commitff8ef5cb121e590ef1a5f3e5f57b9bf99c46559d (patch)
treedbf7846b3494c678f54825c9429ddda8b6655f4c /mesh_tiny_cad/XALL.py
parentdd5e311b73b699aed0bae43936e5968c639713f5 (diff)
fix major xall bug and bump version
Diffstat (limited to 'mesh_tiny_cad/XALL.py')
-rw-r--r--mesh_tiny_cad/XALL.py43
1 files changed, 19 insertions, 24 deletions
diff --git a/mesh_tiny_cad/XALL.py b/mesh_tiny_cad/XALL.py
index 8cd25a5c..83ecdb52 100644
--- a/mesh_tiny_cad/XALL.py
+++ b/mesh_tiny_cad/XALL.py
@@ -108,37 +108,30 @@ def get_intersection_dictionary(bm, edge_indices):
return d
-def update_mesh(obj, d):
+def update_mesh(bm, d):
''' Make new geometry (delete old first) '''
- bpy.ops.mesh.delete(type='EDGE')
- bpy.ops.object.editmode_toggle()
-
- oe = obj.data.edges
- ov = obj.data.vertices
- vert_count = len(ov)
- edge_count = len(oe)
+ oe = bm.edges
+ ov = bm.verts
+ new_verts = []
+ collect = new_verts.extend
for old_edge, point_list in d.items():
- num_points = len(point_list)
- num_edges_to_add = num_points - 1
-
+ num_edges_to_add = len(point_list)-1
for i in range(num_edges_to_add):
- oe.add(1)
- ov.add(2)
+ a = ov.new(point_list[i])
+ b = ov.new(point_list[i+1])
+ oe.new((a, b))
+ bm.normal_update()
+ collect([a, b])
- ov[vert_count].co = point_list[i]
- ov[vert_count + 1].co = point_list[i + 1]
+ bmesh.ops.delete(bm, geom=[edge for edge in bm.edges if edge.select], context=2) # 2 = edges
- oe[edge_count].vertices = [vert_count, vert_count + 1]
- vert_count = len(ov)
- edge_count = len(oe)
+ #bpy.ops.mesh.remove_doubles(
+ # threshold=cm.CAD_prefs.VTX_DOUBLES_THRSHLD,
+ # use_unselected=False)
- # set edit mode
- bpy.ops.object.editmode_toggle()
- bpy.ops.mesh.remove_doubles(
- threshold=cm.CAD_prefs.VTX_DOUBLES_THRSHLD,
- use_unselected=False)
+ bmesh.ops.remove_doubles(bm, verts=new_verts, dist=cm.CAD_prefs.VTX_DOUBLES_THRSHLD)
def unselect_nonintersecting(bm, d_edges, edge_indices):
@@ -174,7 +167,9 @@ class TCIntersectAllEdges(bpy.types.Operator):
d = get_intersection_dictionary(bm, edge_indices)
unselect_nonintersecting(bm, d.keys(), edge_indices)
- update_mesh(obj, d)
+ update_mesh(bm, d)
+
+ bmesh.update_edit_mesh(obj.data)
else:
print('must be in edit mode')