Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Blender UV unwrap from view all selected Meshes
#UV unwrap from view all selected Meshes
import bpy
def unwrap_from_view(TARGET): =[TARGET] = TARGET
bpy.ops.object.mode_set(mode = 'EDIT')
bpy.ops.mesh.select_all(action = 'SELECT')
for oWindow in
oScreen = oWindow.screen
for oArea in oScreen.areas:
if oArea.type == 'VIEW_3D':
for oRegion in oArea.regions:
if oRegion.type == 'WINDOW':
override = {'window': oWindow, 'screen': oScreen, 'area': oArea, 'region': oRegion, 'scene': bpy.context.scene, 'edit_object': bpy.context.edit_object, 'active_object': bpy.context.active_object, 'selected_objects': bpy.context.selected_objects}
bpy.ops.uv.project_from_view(override , camera_bounds=True, correct_aspect=False, scale_to_bounds=False)
bpy.ops.object.mode_set(mode = 'OBJECT')
for obj in bpy.context.selected_objects:
if obj.type == 'MESH':
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.