"""Check whether the currently selected object has UV"""
bl_idname="ballance.no_uv_checker"
bl_label="Check UV"
bl_options={'UNDO'}
@classmethod
defpoll(self,context):
returncheck_valid_target()
defexecute(self,context):
check_target()
return{'FINISHED'}
# ====================== method
defcheck_valid_target():
return(len(bpy.context.selected_objects)>0)
defcheck_target():
noUVObject=[]
invalidObjectCount=0
forobjinbpy.context.selected_objects:
ifobj.type!='MESH':
invalidObjectCount+=1
continue
ifobj.mode!='OBJECT':
invalidObjectCount+=1
continue
ifobj.data.uv_layers.activeisNone:
noUVObject.append(obj.name)
result=("All objects: {}, Skipped: {}, No UV Count: {}. Following object don't have UV: ".format(len(bpy.context.selected_objects),invalidObjectCount,len(noUVObject))+
", ".join(noUVObject[:4])+
(". Too much objects don't have UV. Please open terminal to browse them."iflen(noUVObject)>4else""))