Created
June 9, 2018 03:26
-
-
Save thendrix/a1db221bc652d9bc2ab02769de236104 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# @file This blender script finds all meshes without UVs and unwraps them. | |
# @author Terry Hendrix II github/thendrix | |
import bpy | |
# Unselect objects | |
for obj in bpy.context.selected_objects: | |
obj.select = False | |
# Find and process meshes without UVs | |
for obj in bpy.context.scene.objects: | |
if not obj.type == 'MESH' or obj.data.uv_layers: | |
print("Skipping: ", obj.type, obj.name) | |
else: | |
print("Unwrapping:", obj.name) | |
# Select mesh, select all mesh faces, and unwrap | |
obj.select = True | |
bpy.ops.uv.smart_project() | |
# Unselect obj to avoid grouping selections | |
obj.select = False | |
# Select all with UVs | |
for obj in bpy.context.scene.objects: | |
if obj.type == 'MESH' and obj.data.uv_layers: | |
obj.select = True | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment