Paint Operators

bpy.ops.paint.add_simple_uvs()

Add cube map uvs on mesh

bpy.ops.paint.add_texture_paint_slot(type='BASE_COLOR', name='Untitled', width=1024, height=1024, color=0.0, 0.0, 0.0, 1.0, alpha=True, generated_type='BLANK', float=False)

Add a texture paint slot

Parameters
  • type (enum in ['BASE_COLOR', 'SPECULAR', 'ROUGHNESS', 'METALLIC', 'NORMAL', 'BUMP', 'DISPLACEMENT'], (optional)) – Type, Merge method to use

  • name (string, (optional, never None)) – Name, Image data-block name

  • width (int in [1, inf], (optional)) – Width, Image width

  • height (int in [1, inf], (optional)) – Height, Image height

  • color (float array of 4 items in [0, inf], (optional)) – Color, Default fill color

  • alpha (boolean, (optional)) – Alpha, Create an image with an alpha channel

  • generated_type (enum in ['BLANK', 'UV_GRID', 'COLOR_GRID'], (optional)) –

    Generated Type, Fill the image with a grid for UV map testing

    • BLANK Blank, Generate a blank image.

    • UV_GRID UV Grid, Generated grid to test UV mappings.

    • COLOR_GRID Color Grid, Generated improved UV grid to test UV mappings.

  • float (boolean, (optional)) – 32 bit Float, Create image with 32 bit floating point bit depth

bpy.ops.paint.brush_colors_flip()

Swap primary and secondary brush colors

bpy.ops.paint.brush_select(sculpt_tool='DRAW', vertex_tool='DRAW', weight_tool='DRAW', image_tool='DRAW', gpencil_tool='DRAW', gpencil_vertex_tool='DRAW', gpencil_sculpt_tool='SMOOTH', gpencil_weight_tool='WEIGHT', toggle=False, create_missing=False)

Select a paint mode’s brush by tool type

Parameters
  • sculpt_tool (enum in ['DRAW', 'DRAW_SHARP', 'CLAY', 'CLAY_STRIPS', 'CLAY_THUMB', 'LAYER', 'INFLATE', 'BLOB', 'CREASE', 'SMOOTH', 'FLATTEN', 'FILL', 'SCRAPE', 'MULTIPLANE_SCRAPE', 'PINCH', 'GRAB', 'ELASTIC_DEFORM', 'SNAKE_HOOK', 'THUMB', 'POSE', 'NUDGE', 'ROTATE', 'TOPOLOGY', 'CLOTH', 'SIMPLIFY', 'MASK', 'PAINT', 'SMEAR', 'DRAW_FACE_SETS'], (optional)) – sculpt_tool

  • vertex_tool (enum in ['DRAW', 'BLUR', 'AVERAGE', 'SMEAR'], (optional)) – vertex_tool

  • weight_tool (enum in ['DRAW', 'BLUR', 'AVERAGE', 'SMEAR'], (optional)) – weight_tool

  • image_tool (enum in ['DRAW', 'SOFTEN', 'SMEAR', 'CLONE', 'FILL', 'MASK'], (optional)) – image_tool

  • gpencil_tool (enum in ['DRAW', 'FILL', 'ERASE', 'TINT'], (optional)) –

    gpencil_tool

    • DRAW Draw, The brush is of type used for drawing strokes.

    • FILL Fill, The brush is of type used for filling areas.

    • ERASE Erase, The brush is used for erasing strokes.

    • TINT Tint, The brush is of type used for tinting strokes.

  • gpencil_vertex_tool (enum in ['DRAW', 'BLUR', 'AVERAGE', 'SMEAR', 'REPLACE'], (optional)) – gpencil_vertex_tool

  • gpencil_sculpt_tool (enum in ['SMOOTH', 'THICKNESS', 'STRENGTH', 'RANDOMIZE', 'GRAB', 'PUSH', 'TWIST', 'PINCH', 'CLONE'], (optional)) –

    gpencil_sculpt_tool

    • SMOOTH Smooth, Smooth stroke points.

    • THICKNESS Thickness, Adjust thickness of strokes.

    • STRENGTH Strength, Adjust color strength of strokes.

    • RANDOMIZE Randomize, Introduce jitter/randomness into strokes.

    • GRAB Grab, Translate the set of points initially within the brush circle.

    • PUSH Push, Move points out of the way, as if combing them.

    • TWIST Twist, Rotate points around the midpoint of the brush.

    • PINCH Pinch, Pull points towards the midpoint of the brush.

    • CLONE Clone, Paste copies of the strokes stored on the clipboard.

  • gpencil_weight_tool (enum in ['WEIGHT'], (optional)) –

    gpencil_weight_tool

    • WEIGHT Weight, Weight Paint for Vertex Groups.

  • toggle (boolean, (optional)) – Toggle, Toggle between two brushes rather than cycling

  • create_missing (boolean, (optional)) – Create Missing, If the requested brush type does not exist, create a new brush

bpy.ops.paint.face_select_all(action='TOGGLE')

Change selection for all faces

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.paint.face_select_hide(unselected=False)

Hide selected faces

Parameters

unselected (boolean, (optional)) – Unselected, Hide unselected rather than selected objects

bpy.ops.paint.face_select_linked()

Select linked faces

bpy.ops.paint.face_select_linked_pick(deselect=False)

Select linked faces under the cursor

Parameters

deselect (boolean, (optional)) – Deselect, Deselect rather than select items

bpy.ops.paint.face_select_reveal(select=True)

Reveal hidden faces

Parameters

select (boolean, (optional)) – Select

bpy.ops.paint.grab_clone(delta=0.0, 0.0)

Move the clone source image

Parameters

delta (float array of 2 items in [-inf, inf], (optional)) – Delta, Delta offset of clone image in 0.0..1.0 coordinates

bpy.ops.paint.hide_show(action='HIDE', area='INSIDE', xmin=0, xmax=0, ymin=0, ymax=0, wait_for_input=True)

Hide/show some vertices

Parameters
  • action (enum in ['HIDE', 'SHOW'], (optional)) –

    Action, Whether to hide or show vertices

    • HIDE Hide, Hide vertices.

    • SHOW Show, Show vertices.

  • area (enum in ['OUTSIDE', 'INSIDE', 'ALL', 'MASKED'], (optional)) –

    Area, Which vertices to hide or show

    • OUTSIDE Outside, Hide or show vertices outside the selection.

    • INSIDE Inside, Hide or show vertices inside the selection.

    • ALL All, Hide or show all vertices.

    • MASKED Masked, Hide or show vertices that are masked (minimum mask value of 0.5).

  • 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

bpy.ops.paint.image_from_view(filepath='')

Make an image from biggest 3D view for re-projection

Parameters

filepath (string, (optional, never None)) – File Path, Name of the file

bpy.ops.paint.image_paint(stroke=None, mode='NORMAL')

Paint a stroke into the image

Parameters
  • stroke (bpy_prop_collection of OperatorStrokeElement, (optional)) – Stroke

  • mode (enum in ['NORMAL', 'INVERT', 'SMOOTH'], (optional)) –

    Stroke Mode, Action taken when a paint stroke is made

    • NORMAL Regular, Apply brush normally.

    • INVERT Invert, Invert action of brush for duration of stroke.

    • SMOOTH Smooth, Switch brush to smooth mode for duration of stroke.

bpy.ops.paint.mask_flood_fill(mode='VALUE', value=0.0)

Fill the whole mask with a given value, or invert its values

Parameters
  • mode (enum in ['VALUE', 'VALUE_INVERSE', 'INVERT'], (optional)) –

    Mode

    • VALUE Value, Set mask to the level specified by the ‘value’ property.

    • VALUE_INVERSE Value Inverted, Set mask to the level specified by the inverted ‘value’ property.

    • INVERT Invert, Invert the mask.

  • value (float in [0, 1], (optional)) – Value, Mask level to use when mode is ‘Value’; zero means no masking and one is fully masked

bpy.ops.paint.mask_lasso_gesture(path=None, mode='VALUE', value=1.0)

Add mask within the lasso as you move the brush

Parameters
  • path (bpy_prop_collection of OperatorMousePath, (optional)) – Path

  • mode (enum in ['VALUE', 'VALUE_INVERSE', 'INVERT'], (optional)) –

    Mode

    • VALUE Value, Set mask to the level specified by the ‘value’ property.

    • VALUE_INVERSE Value Inverted, Set mask to the level specified by the inverted ‘value’ property.

    • INVERT Invert, Invert the mask.

  • value (float in [0, 1], (optional)) – Value, Mask level to use when mode is ‘Value’; zero means no masking and one is fully masked

bpy.ops.paint.project_image(image='')

Project an edited render from the active camera back onto the object

Parameters

image (enum in [], (optional)) – Image

bpy.ops.paint.sample_color(location=0, 0, merged=False, palette=False)

Use the mouse to sample a color in the image

Parameters
  • location (int array of 2 items in [0, inf], (optional)) – Location

  • merged (boolean, (optional)) – Sample Merged, Sample the output display color

  • palette (boolean, (optional)) – Add to Palette

bpy.ops.paint.texture_paint_toggle()

Toggle texture paint mode in 3D view

bpy.ops.paint.vert_select_all(action='TOGGLE')

Change selection for all 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.paint.vert_select_ungrouped(extend=False)

Select vertices without a group

Parameters

extend (boolean, (optional)) – Extend, Extend the selection

bpy.ops.paint.vertex_color_brightness_contrast(brightness=0.0, contrast=0.0)

Adjust vertex color brightness/contrast

Parameters
  • brightness (float in [-100, 100], (optional)) – Brightness

  • contrast (float in [-100, 100], (optional)) – Contrast

bpy.ops.paint.vertex_color_dirt(blur_strength=1.0, blur_iterations=1, clean_angle=3.14159, dirt_angle=0.0, dirt_only=False, normalize=True)

Generate a dirt map gradient based on cavity

Parameters
  • blur_strength (float in [0.01, 1], (optional)) – Blur Strength, Blur strength per iteration

  • blur_iterations (int in [0, 40], (optional)) – Blur Iterations, Number of times to blur the colors (higher blurs more)

  • clean_angle (float in [0, 3.14159], (optional)) – Highlight Angle, Less than 90 limits the angle used in the tonal range

  • dirt_angle (float in [0, 3.14159], (optional)) – Dirt Angle, Less than 90 limits the angle used in the tonal range

  • dirt_only (boolean, (optional)) – Dirt Only, Don’t calculate cleans for convex areas

  • normalize (boolean, (optional)) – Normalize, Normalize the colors, increasing the contrast

File

startup/bl_operators/vertexpaint_dirt.py:199

bpy.ops.paint.vertex_color_from_weight()

Convert active weight into gray scale vertex colors

bpy.ops.paint.vertex_color_hsv(h=0.5, s=1.0, v=1.0)

Adjust vertex color HSV values

Parameters
  • h (float in [0, 1], (optional)) – Hue

  • s (float in [0, 2], (optional)) – Saturation

  • v (float in [0, 2], (optional)) – Value

bpy.ops.paint.vertex_color_invert()

Invert RGB values

bpy.ops.paint.vertex_color_levels(offset=0.0, gain=1.0)

Adjust levels of vertex colors

Parameters
  • offset (float in [-1, 1], (optional)) – Offset, Value to add to colors

  • gain (float in [0, inf], (optional)) – Gain, Value to multiply colors by

bpy.ops.paint.vertex_color_set()

Fill the active vertex color layer with the current paint color

bpy.ops.paint.vertex_color_smooth()

Smooth colors across vertices

bpy.ops.paint.vertex_paint(stroke=None, mode='NORMAL')

Paint a stroke in the active vertex color layer

Parameters
  • stroke (bpy_prop_collection of OperatorStrokeElement, (optional)) – Stroke

  • mode (enum in ['NORMAL', 'INVERT', 'SMOOTH'], (optional)) –

    Stroke Mode, Action taken when a paint stroke is made

    • NORMAL Regular, Apply brush normally.

    • INVERT Invert, Invert action of brush for duration of stroke.

    • SMOOTH Smooth, Switch brush to smooth mode for duration of stroke.

bpy.ops.paint.vertex_paint_toggle()

Toggle the vertex paint mode in 3D view

bpy.ops.paint.weight_from_bones(type='AUTOMATIC')

Set the weights of the groups matching the attached armature’s selected bones, using the distance between the vertices and the bones

Parameters

type (enum in ['AUTOMATIC', 'ENVELOPES'], (optional)) –

Type, Method to use for assigning weights

  • AUTOMATIC Automatic, Automatic weights from bones.

  • ENVELOPES From Envelopes, Weights from envelopes with user defined radius.

bpy.ops.paint.weight_gradient(type='LINEAR', xstart=0, xend=0, ystart=0, yend=0, cursor=5)

Draw a line to apply a weight gradient to selected vertices

Parameters
  • type (enum in ['LINEAR', 'RADIAL'], (optional)) – Type

  • xstart (int in [-inf, inf], (optional)) – X Start

  • xend (int in [-inf, inf], (optional)) – X End

  • ystart (int in [-inf, inf], (optional)) – Y Start

  • yend (int in [-inf, inf], (optional)) – Y End

  • cursor (int in [0, inf], (optional)) – Cursor, Mouse cursor style to use during the modal operator

bpy.ops.paint.weight_paint(stroke=None, mode='NORMAL')

Paint a stroke in the current vertex group’s weights

Parameters
  • stroke (bpy_prop_collection of OperatorStrokeElement, (optional)) – Stroke

  • mode (enum in ['NORMAL', 'INVERT', 'SMOOTH'], (optional)) –

    Stroke Mode, Action taken when a paint stroke is made

    • NORMAL Regular, Apply brush normally.

    • INVERT Invert, Invert action of brush for duration of stroke.

    • SMOOTH Smooth, Switch brush to smooth mode for duration of stroke.

bpy.ops.paint.weight_paint_toggle()

Toggle weight paint mode in 3D view

bpy.ops.paint.weight_sample()

Use the mouse to sample a weight in the 3D view

bpy.ops.paint.weight_sample_group(group='DEFAULT')

Select one of the vertex groups available under current mouse position

Parameters

group (enum in ['DEFAULT'], (optional)) – Keying Set, The Keying Set to use

bpy.ops.paint.weight_set()

Fill the active vertex group with the current paint weight