Hi everyone.
I just created a script to select the overlapping polygons in the UV channel, the problem is that it does not work if I select multiple objects. I think the problem is because of the command line:
bpy.ops.uv.select_overlap () performs a global operation and not the selected object.
Is there a way that the overlapping polygons of the selected object can be recognized?
Try to do: obj_sel.data.uv.select_overlap (), but it does not work
Can anybody help me.
Thanks a lot
code:
import bpy
import bmesh
import os
os.system("cls")
obj_overlap = []
sel_obj = bpy.context.selected_objects
for item in sel_obj:
if(bpy.ops.object.mode_set(mode='EDIT')):
bpy.ops.object.mode_set(mode='OBJECT')
bool_over=False
item.select_set(True)
bpy.ops.object.editmode_toggle()
dataItem = item.data
bm = bmesh.from_edit_mesh(dataItem)
dataItem.uv_layers.active_index = 0
#print(uv_layer.name)
bpy.context.scene.tool_settings.use_uv_select_sync = True
for i,face in enumerate(bm.faces):
face.select=False
#dataItem.polygons[i].select=False
bpy.ops.uv.select_overlap()
for face in bm.faces:
if(face.select==True):
bool_over=True
if bool_over:
print("%s OVEERRLAAAPPPP!!!!"%item.name)
obj_overlap.append(item)
else:
print("%s NOT OVERLAAAPPP!!"%item.name)
bpy.ops.object.editmode_toggle()
item.select_set(False)
print("\n Obj_OVERLAPPING List: \n", obj_overlap)