Hello, as the title describes, how would I write a script to perform a “Smart UV Unwrap” for EVERY object that is in the current selection? Thanks!
Hi,
Here is small script that you can run in Text editor from Blender
import bpy
bpy.ops.object.mode_set(mode = 'OBJECT')
for obj in bpy.context.selected_objects:
bpy.context.scene.objects.active = obj
#Just to be sure that is everything deselected
bpy.ops.object.mode_set(mode = 'EDIT')
bpy.ops.mesh.select_all(action= 'DESELECT')
bpy.ops.object.mode_set(mode = 'OBJECT')
bpy.ops.uv.smart_project()
1 Like
This is a modified script of InvisibleParrot, it does “smart unwrap” on every object in the first layer (stretches the UV to the hole texture coordinates of each object), the problem with the selection is that smart project stretches the UV with the other selected objects…
import bpy
bpy.ops.object.mode_set(mode = 'OBJECT')
for obj in bpy.data.objects:
bpy.ops.object.select_all(action= 'DESELECT')
if obj.layers[0] == True:
bpy.context.scene.objects.active = obj
obj.select = True
else:
continue
#Just to be sure that is everything deselected
bpy.ops.object.mode_set(mode = 'EDIT')
bpy.ops.mesh.select_all(action= 'DESELECT')
bpy.ops.object.mode_set(mode = 'OBJECT')
bpy.ops.uv.smart_project()