Uv Operators

bpy.ops.uv.align(axis='ALIGN_AUTO')

Align selected UV vertices to an axis

Parameters:axis (enum in ['ALIGN_S', 'ALIGN_T', 'ALIGN_U', 'ALIGN_AUTO', 'ALIGN_X', 'ALIGN_Y'], (optional)) –

Axis, Axis to align UV locations on

  • ALIGN_S Straighten, Align UVs along the line defined by the endpoints.
  • ALIGN_T Straighten X, Align UVs along the line defined by the endpoints along the X axis.
  • ALIGN_U Straighten Y, Align UVs along the line defined by the endpoints along the Y axis.
  • ALIGN_AUTO Align Auto, Automatically choose the axis on which there is most alignment already.
  • ALIGN_X Align X, Align UVs on X axis.
  • ALIGN_Y Align Y, Align UVs on Y axis.
bpy.ops.uv.average_islands_scale()

Average the size of separate UV islands, based on their area in 3D space

bpy.ops.uv.cube_project(cube_size=1.0, correct_aspect=True, clip_to_bounds=False, scale_to_bounds=False)

Project the UV vertices of the mesh over the six faces of a cube

Parameters:
  • cube_size (float in [0, inf], (optional)) – Cube Size, Size of the cube to project on
  • correct_aspect (boolean, (optional)) – Correct Aspect, Map UVs taking image aspect ratio into account
  • clip_to_bounds (boolean, (optional)) – Clip to Bounds, Clip UV coordinates to bounds after unwrapping
  • scale_to_bounds (boolean, (optional)) – Scale to Bounds, Scale UV coordinates to bounds after unwrapping
bpy.ops.uv.cursor_set(location=(0.0, 0.0))

Set 2D cursor location

Parameters:location (float array of 2 items in [-inf, inf], (optional)) – Location, Cursor location in normalized (0.0-1.0) coordinates
bpy.ops.uv.cylinder_project(direction='VIEW_ON_EQUATOR', align='POLAR_ZX', radius=1.0, correct_aspect=True, clip_to_bounds=False, scale_to_bounds=False)

Project the UV vertices of the mesh over the curved wall of a cylinder

Parameters:
  • direction (enum in ['VIEW_ON_EQUATOR', 'VIEW_ON_POLES', 'ALIGN_TO_OBJECT'], (optional)) –

    Direction, Direction of the sphere or cylinder

    • VIEW_ON_EQUATOR View on Equator, 3D view is on the equator.
    • VIEW_ON_POLES View on Poles, 3D view is on the poles.
    • ALIGN_TO_OBJECT Align to Object, Align according to object transform.
  • align (enum in ['POLAR_ZX', 'POLAR_ZY'], (optional)) –

    Align, How to determine rotation around the pole

    • POLAR_ZX Polar ZX, Polar 0 is X.
    • POLAR_ZY Polar ZY, Polar 0 is Y.
  • radius (float in [0, inf], (optional)) – Radius, Radius of the sphere or cylinder
  • correct_aspect (boolean, (optional)) – Correct Aspect, Map UVs taking image aspect ratio into account
  • clip_to_bounds (boolean, (optional)) – Clip to Bounds, Clip UV coordinates to bounds after unwrapping
  • scale_to_bounds (boolean, (optional)) – Scale to Bounds, Scale UV coordinates to bounds after unwrapping
bpy.ops.uv.export_layout(filepath="", export_all=False, modified=False, mode='PNG', size=(1024, 1024), opacity=0.25)

Export UV layout to file

Parameters:
  • filepath (string, (optional, never None)) – filepath
  • export_all (boolean, (optional)) – All UVs, Export all UVs in this mesh (not just visible ones)
  • modified (boolean, (optional)) – Modified, Exports UVs from the modified mesh
  • mode (enum in ['SVG', 'EPS', 'PNG'], (optional)) –

    Format, File format to export the UV layout to

    • SVG Scalable Vector Graphic (.svg), Export the UV layout to a vector SVG file.
    • EPS Encapsulate PostScript (.eps), Export the UV layout to a vector EPS file.
    • PNG PNG Image (.png), Export the UV layout to a bitmap image.
  • size (int array of 2 items in [8, 32768], (optional)) – size, Dimensions of the exported file
  • opacity (float in [0, 1], (optional)) – Fill Opacity, Set amount of opacity for exported UV layout
File:

addons/io_mesh_uv_layout/__init__.py:131

bpy.ops.uv.follow_active_quads(mode='LENGTH_AVERAGE')

Follow UVs from active quads along continuous face loops

Parameters:mode (enum in ['EVEN', 'LENGTH', 'LENGTH_AVERAGE'], (optional)) –

Edge Length Mode, Method to space UV edge loops

  • EVEN Even, Space all UVs evenly.
  • LENGTH Length, Average space UVs edge length of each loop.
  • LENGTH_AVERAGE Length Average, Average space UVs edge length of each loop.
File:startup/bl_operators/uvcalc_follow_active.py:271
bpy.ops.uv.hide(unselected=False)

Hide (un)selected UV vertices

Parameters:unselected (boolean, (optional)) – Unselected, Hide unselected rather than selected
bpy.ops.uv.lightmap_pack(PREF_CONTEXT='SEL_FACES', PREF_PACK_IN_ONE=True, PREF_NEW_UVLAYER=False, PREF_APPLY_IMAGE=False, PREF_IMG_PX_SIZE=512, PREF_BOX_DIV=12, PREF_MARGIN_DIV=0.1)

Pack each faces UV’s into the UV bounds

Parameters:
  • PREF_CONTEXT (enum in ['SEL_FACES', 'ALL_FACES'], (optional)) –

    Selection

    • SEL_FACES Selected Faces, Space all UVs evenly.
    • ALL_FACES All Faces, Average space UVs edge length of each loop.
  • PREF_PACK_IN_ONE (boolean, (optional)) – Share Tex Space, Objects Share texture space, map all objects into 1 uvmap
  • PREF_NEW_UVLAYER (boolean, (optional)) – New UV Map, Create a new UV map for every mesh packed
  • PREF_APPLY_IMAGE (boolean, (optional)) – New Image, Assign new images for every mesh (only one if shared tex space enabled)
  • PREF_IMG_PX_SIZE (int in [64, 5000], (optional)) – Image Size, Width and Height for the new image
  • PREF_BOX_DIV (int in [1, 48], (optional)) – Pack Quality, Pre Packing before the complex boxpack
  • PREF_MARGIN_DIV (float in [0.001, 1], (optional)) – Margin, Size of the margin as a division of the UV
File:

startup/bl_operators/uvcalc_lightmap.py:671

bpy.ops.uv.mark_seam(clear=False)

Mark selected UV edges as seams

Parameters:clear (boolean, (optional)) – Clear Seams, Clear instead of marking seams
bpy.ops.uv.minimize_stretch(fill_holes=True, blend=0.0, iterations=0)

Reduce UV stretching by relaxing angles

Parameters:
  • fill_holes (boolean, (optional)) – Fill Holes, Virtual fill holes in mesh before unwrapping, to better avoid overlaps and preserve symmetry
  • blend (float in [0, 1], (optional)) – Blend, Blend factor between stretch minimized and original
  • iterations (int in [0, inf], (optional)) – Iterations, Number of iterations to run, 0 is unlimited when run interactively
bpy.ops.uv.pack_islands(rotate=True, margin=0.001)

Transform all islands so that they fill up the UV space as much as possible

Parameters:
  • rotate (boolean, (optional)) – Rotate, Rotate islands for best fit
  • margin (float in [0, 1], (optional)) – Margin, Space between islands
bpy.ops.uv.pin(clear=False)

Set/clear selected UV vertices as anchored between multiple unwrap operations

Parameters:clear (boolean, (optional)) – Clear, Clear pinning for the selection instead of setting it
bpy.ops.uv.project_from_view(orthographic=False, camera_bounds=True, correct_aspect=True, clip_to_bounds=False, scale_to_bounds=False)

Project the UV vertices of the mesh as seen in current 3D view

Parameters:
  • orthographic (boolean, (optional)) – Orthographic, Use orthographic projection
  • camera_bounds (boolean, (optional)) – Camera Bounds, Map UVs to the camera region taking resolution and aspect into account
  • correct_aspect (boolean, (optional)) – Correct Aspect, Map UVs taking image aspect ratio into account
  • clip_to_bounds (boolean, (optional)) – Clip to Bounds, Clip UV coordinates to bounds after unwrapping
  • scale_to_bounds (boolean, (optional)) – Scale to Bounds, Scale UV coordinates to bounds after unwrapping
bpy.ops.uv.remove_doubles(threshold=0.02, use_unselected=False)

Selected UV vertices that are within a radius of each other are welded together

Parameters:
  • threshold (float in [0, 10], (optional)) – Merge Distance, Maximum distance between welded vertices
  • use_unselected (boolean, (optional)) – Unselected, Merge selected to other unselected vertices
bpy.ops.uv.reset()

Reset UV projection

bpy.ops.uv.reveal(select=True)

Reveal all hidden UV vertices

Parameters:select (boolean, (optional)) – Select
bpy.ops.uv.seams_from_islands(mark_seams=True, mark_sharp=False)

Set mesh seams according to island setup in the UV editor

Parameters:
  • mark_seams (boolean, (optional)) – Mark Seams, Mark boundary edges as seams
  • mark_sharp (boolean, (optional)) – Mark Sharp, Mark boundary edges as sharp
bpy.ops.uv.select(extend=False, deselect_all=False, location=(0.0, 0.0))

Select UV vertices

Parameters:
  • extend (boolean, (optional)) – Extend, Extend selection rather than clearing the existing selection
  • deselect_all (boolean, (optional)) – Deselect On Nothing, Deselect all when nothing under the cursor
  • location (float array of 2 items in [-inf, inf], (optional)) – Location, Mouse location in normalized coordinates, 0.0 to 1.0 is within the image bounds
bpy.ops.uv.select_all(action='TOGGLE')

Change selection of all UV vertices

Parameters:action (enum in ['TOGGLE', 'SELECT', 'DESELECT', 'INVERT'], (optional)) –

Action, Selection action to execute

  • TOGGLE Toggle, Toggle selection for all elements.
  • SELECT Select, Select all elements.
  • DESELECT Deselect, Deselect all elements.
  • INVERT Invert, Invert selection of all elements.
bpy.ops.uv.select_box(pinned=False, xmin=0, xmax=0, ymin=0, ymax=0, wait_for_input=True, mode='SET')

Select UV vertices using box selection

Parameters:
  • pinned (boolean, (optional)) – Pinned, Border select pinned UVs only
  • xmin (int in [-inf, inf], (optional)) – X Min
  • xmax (int in [-inf, inf], (optional)) – X Max
  • ymin (int in [-inf, inf], (optional)) – Y Min
  • ymax (int in [-inf, inf], (optional)) – Y Max
  • wait_for_input (boolean, (optional)) – Wait for Input
  • mode (enum in ['SET', 'ADD', 'SUB'], (optional)) –

    Mode

    • SET Set, Set a new selection.
    • ADD Extend, Extend existing selection.
    • SUB Subtract, Subtract existing selection.
bpy.ops.uv.select_circle(x=0, y=0, radius=25, wait_for_input=True, mode='SET')

Select UV vertices using circle selection

Parameters:
  • x (int in [-inf, inf], (optional)) – X
  • y (int in [-inf, inf], (optional)) – Y
  • radius (int in [1, inf], (optional)) – Radius
  • wait_for_input (boolean, (optional)) – Wait for Input
  • mode (enum in ['SET', 'ADD', 'SUB'], (optional)) –

    Mode

    • SET Set, Set a new selection.
    • ADD Extend, Extend existing selection.
    • SUB Subtract, Subtract existing selection.
bpy.ops.uv.select_lasso(path=None, mode='SET')

Select UVs using lasso selection

Parameters:
  • path (bpy_prop_collection of OperatorMousePath, (optional)) – Path
  • mode (enum in ['SET', 'ADD', 'SUB'], (optional)) –

    Mode

    • SET Set, Set a new selection.
    • ADD Extend, Extend existing selection.
    • SUB Subtract, Subtract existing selection.
bpy.ops.uv.select_less()

Deselect UV vertices at the boundary of each selection region

bpy.ops.uv.select_linked()

Select all UV vertices linked to the active UV map

bpy.ops.uv.select_linked_pick(extend=False, deselect=False, location=(0.0, 0.0))

Select all UV vertices linked under the mouse

Parameters:
  • extend (boolean, (optional)) – Extend, Extend selection rather than clearing the existing selection
  • deselect (boolean, (optional)) – Deselect, Deselect linked UV vertices rather than selecting them
  • location (float array of 2 items in [-inf, inf], (optional)) – Location, Mouse location in normalized coordinates, 0.0 to 1.0 is within the image bounds
bpy.ops.uv.select_loop(extend=False, location=(0.0, 0.0))

Select a loop of connected UV vertices

Parameters:
  • extend (boolean, (optional)) – Extend, Extend selection rather than clearing the existing selection
  • location (float array of 2 items in [-inf, inf], (optional)) – Location, Mouse location in normalized coordinates, 0.0 to 1.0 is within the image bounds
bpy.ops.uv.select_more()

Select more UV vertices connected to initial selection

bpy.ops.uv.select_pinned()

Select all pinned UV vertices

bpy.ops.uv.select_split()

Select only entirely selected faces

bpy.ops.uv.smart_project(angle_limit=66.0, island_margin=0.0, user_area_weight=0.0, use_aspect=True, stretch_to_bounds=True)

This script projection unwraps the selected faces of a mesh (it operates on all selected mesh objects, and can be used to unwrap selected faces, or all faces)

Parameters:
  • angle_limit (float in [1, 89], (optional)) – Angle Limit, Lower for more projection groups, higher for less distortion
  • island_margin (float in [0, 1], (optional)) – Island Margin, Margin to reduce bleed from adjacent islands
  • user_area_weight (float in [0, 1], (optional)) – Area Weight, Weight projections vector by faces with larger areas
  • use_aspect (boolean, (optional)) – Correct Aspect, Map UVs taking image aspect ratio into account
  • stretch_to_bounds (boolean, (optional)) – Stretch to UV Bounds, Stretch the final output to texture bounds
File:

startup/bl_operators/uvcalc_smart_project.py:1026

bpy.ops.uv.snap_cursor(target='PIXELS')

Snap cursor to target type

Parameters:target (enum in ['PIXELS', 'SELECTED'], (optional)) – Target, Target to snap the selected UVs to
bpy.ops.uv.snap_selected(target='PIXELS')

Snap selected UV vertices to target type

Parameters:target (enum in ['PIXELS', 'CURSOR', 'CURSOR_OFFSET', 'ADJACENT_UNSELECTED'], (optional)) – Target, Target to snap the selected UVs to
bpy.ops.uv.sphere_project(direction='VIEW_ON_EQUATOR', align='POLAR_ZX', correct_aspect=True, clip_to_bounds=False, scale_to_bounds=False)

Project the UV vertices of the mesh over the curved surface of a sphere

Parameters:
  • direction (enum in ['VIEW_ON_EQUATOR', 'VIEW_ON_POLES', 'ALIGN_TO_OBJECT'], (optional)) –

    Direction, Direction of the sphere or cylinder

    • VIEW_ON_EQUATOR View on Equator, 3D view is on the equator.
    • VIEW_ON_POLES View on Poles, 3D view is on the poles.
    • ALIGN_TO_OBJECT Align to Object, Align according to object transform.
  • align (enum in ['POLAR_ZX', 'POLAR_ZY'], (optional)) –

    Align, How to determine rotation around the pole

    • POLAR_ZX Polar ZX, Polar 0 is X.
    • POLAR_ZY Polar ZY, Polar 0 is Y.
  • correct_aspect (boolean, (optional)) – Correct Aspect, Map UVs taking image aspect ratio into account
  • clip_to_bounds (boolean, (optional)) – Clip to Bounds, Clip UV coordinates to bounds after unwrapping
  • scale_to_bounds (boolean, (optional)) – Scale to Bounds, Scale UV coordinates to bounds after unwrapping
bpy.ops.uv.stitch(use_limit=False, snap_islands=True, limit=0.01, static_island=0, active_object_index=0, midpoint_snap=False, clear_seams=True, mode='VERTEX', stored_mode='VERTEX', selection=None, objects_selection_count=(0, 0, 0, 0, 0, 0))

Stitch selected UV vertices by proximity

Parameters:
  • use_limit (boolean, (optional)) – Use Limit, Stitch UVs within a specified limit distance
  • snap_islands (boolean, (optional)) – Snap Islands, Snap islands together (on edge stitch mode, rotates the islands too)
  • limit (float in [0, inf], (optional)) – Limit, Limit distance in normalized coordinates
  • static_island (int in [0, inf], (optional)) – Static Island, Island that stays in place when stitching islands
  • active_object_index (int in [0, inf], (optional)) – Active Object, Index of the active object
  • midpoint_snap (boolean, (optional)) – Snap At Midpoint, UVs are stitched at midpoint instead of at static island
  • clear_seams (boolean, (optional)) – Clear Seams, Clear seams of stitched edges
  • mode (enum in ['VERTEX', 'EDGE'], (optional)) – Operation Mode, Use vertex or edge stitching
  • stored_mode (enum in ['VERTEX', 'EDGE'], (optional)) – Stored Operation Mode, Use vertex or edge stitching
  • selection (bpy_prop_collection of SelectedUvElement, (optional)) – Selection
  • objects_selection_count (int array of 6 items in [0, inf], (optional)) – Objects Selection Count
bpy.ops.uv.unwrap(method='ANGLE_BASED', fill_holes=True, correct_aspect=True, use_subsurf_data=False, margin=0.001)

Unwrap the mesh of the object being edited

Parameters:
  • method (enum in ['ANGLE_BASED', 'CONFORMAL'], (optional)) – Method, Unwrapping method (Angle Based usually gives better results than Conformal, while being somewhat slower)
  • fill_holes (boolean, (optional)) – Fill Holes, Virtual fill holes in mesh before unwrapping, to better avoid overlaps and preserve symmetry
  • correct_aspect (boolean, (optional)) – Correct Aspect, Map UVs taking image aspect ratio into account
  • use_subsurf_data (boolean, (optional)) – Use Subsurf Modifier, Map UVs taking vertex position after Subdivision Surface modifier has been applied
  • margin (float in [0, 1], (optional)) – Margin, Space between islands
bpy.ops.uv.weld()

Weld selected UV vertices together