[Bf-extensions-cvs] [071aa3e] master: add new tool: Select Doubles. Search and select doubles verts
Eugenio Pignataro
noreply at git.blender.org
Mon Jan 9 16:32:35 CET 2017
Commit: 071aa3e5450991563a5ffe25d442ba06344bdcf6
Author: Eugenio Pignataro
Date: Mon Jan 9 12:32:27 2017 -0300
Branches: master
https://developer.blender.org/rBA071aa3e5450991563a5ffe25d442ba06344bdcf6
add new tool: Select Doubles. Search and select doubles verts
===================================================================
M oscurart_tools/__init__.py
M oscurart_tools/oscurart_meshes.py
===================================================================
diff --git a/oscurart_tools/__init__.py b/oscurart_tools/__init__.py
index 15321f0..5708218 100644
--- a/oscurart_tools/__init__.py
+++ b/oscurart_tools/__init__.py
@@ -172,6 +172,7 @@ class OscPanelMesh(Panel):
col.operator("mesh.object_to_mesh_osc", icon="MESH_MONKEY")
col.operator("mesh.select_side_osc", icon="VERTEXSEL")
+ col.operator("mesh.select_doubles", icon="VERTEXSEL")
colrow = col.row(align=1)
colrow.operator("mesh.resym_save_map", icon="UV_SYNC_SELECT")
colrow = col.row(align=1)
diff --git a/oscurart_tools/oscurart_meshes.py b/oscurart_tools/oscurart_meshes.py
index 07088df..ae221ff 100644
--- a/oscurart_tools/oscurart_meshes.py
+++ b/oscurart_tools/oscurart_meshes.py
@@ -466,3 +466,42 @@ class ModalIndexOperator(Operator):
else:
self.report({"WARNING"}, "Is not a 3D Space")
return {'CANCELLED'}
+
+# -------------------------- SELECT DOUBLES
+
+def SelDoubles(self, context):
+ bm = bmesh.from_edit_mesh(bpy.context.object.data)
+
+ for v in bm.verts:
+ v.select = 0
+
+ dictloc = {}
+
+ rd = lambda x: (round(x[0],4),round(x[1],4),round(x[2],4))
+
+ for vert in bm.verts:
+ dictloc.setdefault(rd(vert.co),[]).append(vert.index)
+
+ for loc, ind in dictloc.items():
+ if len(ind) > 1:
+ for v in ind:
+ bm.verts[v].select = 1
+
+ bpy.context.scene.objects.active = bpy.context.scene.objects.active
+
+
+class SelectDoubles(Operator):
+ bl_idname = "mesh.select_doubles"
+ bl_label = "Select Doubles"
+ bl_options = {"REGISTER", "UNDO"}
+
+ @classmethod
+ def poll(cls, context):
+ return (context.active_object is not None and
+ context.active_object.type == 'MESH' and
+ context.active_object.mode == "EDIT")
+
+
+ def execute(self, context):
+ SelDoubles(self, context)
+ return {'FINISHED'}
\ No newline at end of file
More information about the Bf-extensions-cvs
mailing list