Gpencil Operators

bpy.ops.gpencil.active_frame_delete()

Delete the active frame for the active Grease Pencil Layer

bpy.ops.gpencil.active_frames_delete_all()

Delete the active frame(s) of all editable Grease Pencil layers

bpy.ops.gpencil.annotate(mode='DRAW', arrowstyle_start='NONE', arrowstyle_end='NONE', use_stabilizer=False, stabilizer_factor=0.75, stabilizer_radius=35, stroke=None, wait_for_input=True)

Make annotations on the active data

Parameters
  • mode (enum in ['DRAW', 'DRAW_STRAIGHT', 'DRAW_POLY', 'ERASER'], (optional)) –

    Mode, Way to interpret mouse movements

    • DRAW Draw Freehand, Draw freehand stroke(s).

    • DRAW_STRAIGHT Draw Straight Lines, Draw straight line segment(s).

    • DRAW_POLY Draw Poly Line, Click to place endpoints of straight line segments (connected).

    • ERASER Eraser, Erase Annotation strokes.

  • arrowstyle_start (enum in ['NONE', 'ARROW', 'ARROW_OPEN', 'ARROW_OPEN_INVERTED', 'DIAMOND'], (optional)) –

    Start Arrow Style, Stroke start style

    • NONE None, Don’t use any arrow/style in corner.

    • ARROW Arrow, Use closed arrow style.

    • ARROW_OPEN Open Arrow, Use open arrow style.

    • ARROW_OPEN_INVERTED Segment, Use perpendicular segment style.

    • DIAMOND Square, Use square style.

  • arrowstyle_end (enum in ['NONE', 'ARROW', 'ARROW_OPEN', 'ARROW_OPEN_INVERTED', 'DIAMOND'], (optional)) –

    End Arrow Style, Stroke end style

    • NONE None, Don’t use any arrow/style in corner.

    • ARROW Arrow, Use closed arrow style.

    • ARROW_OPEN Open Arrow, Use open arrow style.

    • ARROW_OPEN_INVERTED Segment, Use perpendicular segment style.

    • DIAMOND Square, Use square style.

  • use_stabilizer (boolean, (optional)) – Stabilize Stroke, Helper to draw smooth and clean lines. Press Shift for an invert effect (even if this option is not active)

  • stabilizer_factor (float in [0, 1], (optional)) – Stabilizer Stroke Factor, Higher values gives a smoother stroke

  • stabilizer_radius (int in [0, 200], (optional)) – Stabilizer Stroke Radius, Minimum distance from last point before stroke continues

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

  • wait_for_input (boolean, (optional)) – Wait for Input, Wait for first click instead of painting immediately

bpy.ops.gpencil.annotation_active_frame_delete()

Delete the active frame for the active Annotation Layer

bpy.ops.gpencil.annotation_add()

Add new Annotation data-block

bpy.ops.gpencil.bake_mesh_animation(target=None, frame_start=1, frame_end=250, step=1, thickness=1, angle=1.22173, offset=0.001, seams=False, faces=True, only_selected=False, frame_target=1, project_type='VIEW')

Bake Mesh Animation to Grease Pencil strokes

Parameters
  • target (Object, (optional)) – Target Object, Target grease pencil object. Leave empty for new object

  • frame_start (int in [1, 100000], (optional)) – Start Frame, The start frame

  • frame_end (int in [1, 100000], (optional)) – End Frame, The end frame of animation

  • step (int in [1, 100], (optional)) – Step, Step between generated frames

  • thickness (int in [1, 100], (optional)) – Thickness

  • angle (float in [0, 3.14159], (optional)) – Threshold Angle, Threshold to determine ends of the strokes

  • offset (float in [0, 100], (optional)) – Stroke Offset, Offset strokes from fill

  • seams (boolean, (optional)) – Only Seam Edges, Convert only seam edges

  • faces (boolean, (optional)) – Export Faces, Export faces as filled strokes

  • only_selected (boolean, (optional)) – Only Selected Keyframes, Convert only selected keyframes

  • frame_target (int in [1, 100000], (optional)) – Target Frame, Destination frame

  • project_type (enum in ['KEEP', 'FRONT', 'SIDE', 'TOP', 'VIEW', 'CURSOR'], (optional)) –

    Projection Type

    • KEEP No Reproject.

    • FRONT Front, Reproject the strokes using the X-Z plane.

    • SIDE Side, Reproject the strokes using the Y-Z plane.

    • TOP Top, Reproject the strokes using the X-Y plane.

    • VIEW View, Reproject the strokes to end up on the same plane, as if drawn from the current viewpoint using ‘Cursor’ Stroke Placement.

    • CURSOR Cursor, Reproject the strokes using the orientation of 3D cursor.

bpy.ops.gpencil.blank_frame_add(all_layers=False)

Insert a blank frame on the current frame (all subsequently existing frames, if any, are shifted right by one frame)

Parameters

all_layers (boolean, (optional)) – All Layers, Create blank frame in all layers, not only active

bpy.ops.gpencil.brush_reset()

Reset Brush to default parameters

bpy.ops.gpencil.brush_reset_all()

Delete all mode brushes and recreate a default set

bpy.ops.gpencil.convert(type='PATH', bevel_depth=0.0, bevel_resolution=0, use_normalize_weights=True, radius_multiplier=1.0, use_link_strokes=False, timing_mode='FULL', frame_range=100, start_frame=1, use_realtime=False, end_frame=250, gap_duration=0.0, gap_randomness=0.0, seed=0, use_timing_data=False)

Convert the active Grease Pencil layer to a new Curve Object

Parameters
  • type (enum in ['PATH', 'CURVE', 'POLY'], (optional)) –

    Type, Which type of curve to convert to

    • PATH Path, Animation path.

    • CURVE Bezier Curve, Smooth Bezier curve.

    • POLY Polygon Curve, Bezier curve with straight-line segments (vector handles).

  • bevel_depth (float in [0, 1000], (optional)) – Bevel Depth

  • bevel_resolution (int in [0, 32], (optional)) – Bevel Resolution, Bevel resolution when depth is non-zero

  • use_normalize_weights (boolean, (optional)) – Normalize Weight, Normalize weight (set from stroke width)

  • radius_multiplier (float in [0, 1000], (optional)) – Radius Factor, Multiplier for the points’ radii (set from stroke width)

  • use_link_strokes (boolean, (optional)) – Link Strokes, Whether to link strokes with zero-radius sections of curves

  • timing_mode (enum in ['NONE', 'LINEAR', 'FULL', 'CUSTOMGAP'], (optional)) –

    Timing Mode, How to use timing data stored in strokes

    • NONE No Timing, Ignore timing.

    • LINEAR Linear, Simple linear timing.

    • FULL Original, Use the original timing, gaps included.

    • CUSTOMGAP Custom Gaps, Use the original timing, but with custom gap lengths (in frames).

  • frame_range (int in [1, 10000], (optional)) – Frame Range, The duration of evaluation of the path control curve

  • start_frame (int in [1, 100000], (optional)) – Start Frame, The start frame of the path control curve

  • use_realtime (boolean, (optional)) – Realtime, Whether the path control curve reproduces the drawing in realtime, starting from Start Frame

  • end_frame (int in [1, 100000], (optional)) – End Frame, The end frame of the path control curve (if Realtime is not set)

  • gap_duration (float in [0, 10000], (optional)) – Gap Duration, Custom Gap mode: (Average) length of gaps, in frames (Note: Realtime value, will be scaled if Realtime is not set)

  • gap_randomness (float in [0, 10000], (optional)) – Gap Randomness, Custom Gap mode: Number of frames that gap lengths can vary

  • seed (int in [0, 1000], (optional)) – Random Seed, Custom Gap mode: Random generator seed

  • use_timing_data (boolean, (optional)) – Has Valid Timing, Whether the converted Grease Pencil layer has valid timing data (internal use)

bpy.ops.gpencil.convert_old_files(annotation=False)

Convert 2.7x grease pencil files to 2.80

Parameters

annotation (boolean, (optional)) – Annotation, Convert to Annotations

bpy.ops.gpencil.copy()

Copy selected Grease Pencil points and strokes

Unlink active Annotation data-block

bpy.ops.gpencil.delete(type='POINTS')

Delete selected Grease Pencil strokes, vertices, or frames

Parameters

type (enum in ['POINTS', 'STROKES', 'FRAME'], (optional)) –

Type, Method used for deleting Grease Pencil data

  • POINTS Points, Delete selected points and split strokes into segments.

  • STROKES Strokes, Delete selected strokes.

  • FRAME Frame, Delete active frame.

bpy.ops.gpencil.dissolve(type='POINTS')

Delete selected points without splitting strokes

Parameters

type (enum in ['POINTS', 'BETWEEN', 'UNSELECT'], (optional)) –

Type, Method used for dissolving Stroke points

  • POINTS Dissolve, Dissolve selected points.

  • BETWEEN Dissolve Between, Dissolve points between selected points.

  • UNSELECT Dissolve Unselect, Dissolve all unselected points.

bpy.ops.gpencil.draw(mode='DRAW', stroke=None, wait_for_input=True, disable_straight=False, disable_fill=False, disable_stabilizer=False, guide_last_angle=0.0)

Draw a new stroke in the active Grease Pencil object

Parameters
  • mode (enum in ['DRAW', 'DRAW_STRAIGHT', 'ERASER'], (optional)) –

    Mode, Way to interpret mouse movements

    • DRAW Draw Freehand, Draw freehand stroke(s).

    • DRAW_STRAIGHT Draw Straight Lines, Draw straight line segment(s).

    • ERASER Eraser, Erase Grease Pencil strokes.

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

  • wait_for_input (boolean, (optional)) – Wait for Input, Wait for first click instead of painting immediately

  • disable_straight (boolean, (optional)) – No Straight lines, Disable key for straight lines

  • disable_fill (boolean, (optional)) – No Fill Areas, Disable fill to use stroke as fill boundary

  • disable_stabilizer (boolean, (optional)) – No Stabilizer

  • guide_last_angle (float in [-10000, 10000], (optional)) – Angle, Speed guide angle

bpy.ops.gpencil.duplicate()

Duplicate the selected Grease Pencil strokes

bpy.ops.gpencil.duplicate_move(GPENCIL_OT_duplicate=None, TRANSFORM_OT_translate=None)

Make copies of the selected Grease Pencil strokes and move them

Parameters
  • GPENCIL_OT_duplicate (GPENCIL_OT_duplicate, (optional)) – Duplicate Strokes, Duplicate the selected Grease Pencil strokes

  • TRANSFORM_OT_translate (TRANSFORM_OT_translate, (optional)) – Move, Move selected items

bpy.ops.gpencil.editmode_toggle(back=False)

Enter/Exit edit mode for Grease Pencil strokes

Parameters

back (boolean, (optional)) – Return to Previous Mode, Return to previous mode

bpy.ops.gpencil.extract_palette_vertex(selected=False, threshold=1)

Extract all colors used in Grease Pencil Vertex and create a Palette

Parameters
  • selected (boolean, (optional)) – Only Selected, Convert only selected strokes

  • threshold (int in [1, 4], (optional)) – Threshold

bpy.ops.gpencil.extrude()

Extrude the selected Grease Pencil points

bpy.ops.gpencil.extrude_move(GPENCIL_OT_extrude=None, TRANSFORM_OT_translate=None)

Extrude selected points and move them

Parameters
  • GPENCIL_OT_extrude (GPENCIL_OT_extrude, (optional)) – Extrude Stroke Points, Extrude the selected Grease Pencil points

  • TRANSFORM_OT_translate (TRANSFORM_OT_translate, (optional)) – Move, Move selected items

bpy.ops.gpencil.fill(on_back=False)

Fill with color the shape formed by strokes

Parameters

on_back (boolean, (optional)) – Draw On Back, Send new stroke to Back

bpy.ops.gpencil.frame_clean_duplicate(type='ALL')

Remove any duplicated frame

Parameters

type (enum in ['ALL', 'SELECTED'], (optional)) – Type

bpy.ops.gpencil.frame_clean_fill(mode='ACTIVE')

Remove ‘no fill’ boundary strokes

Parameters

mode (enum in ['ACTIVE', 'ALL'], (optional)) –

Mode

  • ACTIVE Active Frame Only, Clean active frame only.

  • ALL All Frames, Clean all frames in all layers.

bpy.ops.gpencil.frame_clean_loose(limit=1)

Remove loose points

Parameters

limit (int in [1, inf], (optional)) – Limit, Number of points to consider stroke as loose

bpy.ops.gpencil.frame_duplicate(mode='ACTIVE')

Make a copy of the active Grease Pencil Frame

Parameters

mode (enum in ['ACTIVE', 'ALL'], (optional)) –

Mode

  • ACTIVE Active, Duplicate frame in active layer only.

  • ALL All, Duplicate active frames in all layers.

bpy.ops.gpencil.generate_weights(mode='NAME', armature='DEFAULT', ratio=0.1, decay=0.8)

Generate automatic weights for armatures (requires armature modifier)

Parameters
  • mode (enum in ['NAME', 'AUTO'], (optional)) – Mode

  • armature (enum in ['DEFAULT'], (optional)) – Armature, Armature to use

  • ratio (float in [0, 2], (optional)) – Ratio, Ratio between bone length and influence radius

  • decay (float in [0, 1], (optional)) – Decay, Factor to reduce influence depending of distance to bone axis

bpy.ops.gpencil.guide_rotate(increment=True, angle=0.0)

Rotate guide angle

Parameters
  • increment (boolean, (optional)) – Increment, Increment angle

  • angle (float in [-10000, 10000], (optional)) – Angle, Guide angle

bpy.ops.gpencil.hide(unselected=False)

Hide selected/unselected Grease Pencil layers

Parameters

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

bpy.ops.gpencil.image_to_grease_pencil(size=0.005, mask=False)

Generate a Grease Pencil Object using Image as source

Parameters
  • size (float in [0.0001, 10], (optional)) – Point Size, Size used for grease pencil points

  • mask (boolean, (optional)) – Generate Mask, Create an inverted image for masking using alpha channel

bpy.ops.gpencil.interpolate(shift=0.0)

Interpolate grease pencil strokes between frames

Parameters

shift (float in [-1, 1], (optional)) – Shift, Bias factor for which frame has more influence on the interpolated strokes

bpy.ops.gpencil.interpolate_reverse()

Remove breakdown frames generated by interpolating between two Grease Pencil frames

bpy.ops.gpencil.interpolate_sequence()

Generate ‘in-betweens’ to smoothly interpolate between Grease Pencil frames

bpy.ops.gpencil.layer_active(layer=0)

Active Grease Pencil layer

Parameters

layer (int in [0, inf], (optional)) – Grease Pencil Layer

bpy.ops.gpencil.layer_add()

Add new layer or note for the active data-block

bpy.ops.gpencil.layer_annotation_add()

Add new Annotation layer or note for the active data-block

bpy.ops.gpencil.layer_annotation_move(type='UP')

Move the active Annotation layer up/down in the list

Parameters

type (enum in ['UP', 'DOWN'], (optional)) – Type

bpy.ops.gpencil.layer_annotation_remove()

Remove active Annotation layer

bpy.ops.gpencil.layer_change(layer='DEFAULT')

Change active Grease Pencil layer

Parameters

layer (enum in ['DEFAULT'], (optional)) – Grease Pencil Layer

bpy.ops.gpencil.layer_duplicate()

Make a copy of the active Grease Pencil layer

bpy.ops.gpencil.layer_duplicate_object(object='', mode='ALL')

Make a copy of the active Grease Pencil layer to new object

Parameters
  • object (string, (optional, never None)) – Object, Name of the destination object

  • mode (enum in ['ALL', 'ACTIVE'], (optional)) – Mode

bpy.ops.gpencil.layer_isolate(affect_visibility=False)

Toggle whether the active layer is the only one that can be edited and/or visible

Parameters

affect_visibility (boolean, (optional)) – Affect Visibility, In addition to toggling the editability, also affect the visibility

bpy.ops.gpencil.layer_mask_add(name='')

Add new layer as masking

Parameters

name (string, (optional, never None)) – Layer, Name of the layer

bpy.ops.gpencil.layer_mask_remove()

Remove Layer Mask

bpy.ops.gpencil.layer_merge()

Merge the current layer with the layer below

bpy.ops.gpencil.layer_move(type='UP')

Move the active Grease Pencil layer up/down in the list

Parameters

type (enum in ['UP', 'DOWN'], (optional)) – Type

bpy.ops.gpencil.layer_remove()

Remove active Grease Pencil layer

bpy.ops.gpencil.lock_all()

Lock all Grease Pencil layers to prevent them from being accidentally modified

bpy.ops.gpencil.lock_layer()

Lock and hide any color not used in any layer

bpy.ops.gpencil.material_hide(unselected=False)

Hide selected/unselected Grease Pencil materials

Parameters

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

bpy.ops.gpencil.material_isolate(affect_visibility=False)

Toggle whether the active material is the only one that is editable and/or visible

Parameters

affect_visibility (boolean, (optional)) – Affect Visibility, In addition to toggling the editability, also affect the visibility

bpy.ops.gpencil.material_lock_all()

Lock all Grease Pencil materials to prevent them from being accidentally modified

bpy.ops.gpencil.material_lock_unused()

Lock any material not used in any selected stroke

bpy.ops.gpencil.material_reveal()

Unhide all hidden Grease Pencil materials

bpy.ops.gpencil.material_select(deselect=False)

Select/Deselect all Grease Pencil strokes using current material

Parameters

deselect (boolean, (optional)) – Deselect, Unselect strokes

bpy.ops.gpencil.material_set(slot='DEFAULT')

Set active material

Parameters

slot (enum in ['DEFAULT'], (optional)) – Material Slot

bpy.ops.gpencil.material_to_vertex_color(remove=True, palette=True, selected=False, threshold=3)

Replace materials in strokes with Vertex Color

Parameters
  • remove (boolean, (optional)) – Remove Unused Materials, Remove any unused material after the conversion

  • palette (boolean, (optional)) – Create Palette, Create a new palette with colors

  • selected (boolean, (optional)) – Only Selected, Convert only selected strokes

  • threshold (int in [1, 4], (optional)) – Threshold

bpy.ops.gpencil.material_unlock_all()

Unlock all Grease Pencil materials so that they can be edited

bpy.ops.gpencil.move_to_layer(layer=0)

Move selected strokes to another layer

Parameters

layer (int in [-1, inf], (optional)) – Grease Pencil Layer

bpy.ops.gpencil.paintmode_toggle(back=False)

Enter/Exit paint mode for Grease Pencil strokes

Parameters

back (boolean, (optional)) – Return to Previous Mode, Return to previous mode

bpy.ops.gpencil.paste(type='ACTIVE', paste_back=False)

Paste previously copied strokes to active layer or to original layer

Parameters
  • type (enum in ['ACTIVE', 'LAYER'], (optional)) – Type

  • paste_back (boolean, (optional)) – Paste on Back, Add pasted strokes behind all strokes

bpy.ops.gpencil.primitive_box(subdivision=3, edges=2, type='BOX', wait_for_input=True)

Create predefined grease pencil stroke box shapes

Parameters
  • subdivision (int in [0, 128], (optional)) – Subdivisions, Number of subdivision by edges

  • edges (int in [2, 128], (optional)) – Edges, Number of points by edge

  • type (enum in ['BOX', 'LINE', 'POLYLINE', 'CIRCLE', 'ARC', 'CURVE'], (optional)) – Type, Type of shape

  • wait_for_input (boolean, (optional)) – Wait for Input

bpy.ops.gpencil.primitive_circle(subdivision=94, edges=2, type='CIRCLE', wait_for_input=True)

Create predefined grease pencil stroke circle shapes

Parameters
  • subdivision (int in [0, 128], (optional)) – Subdivisions, Number of subdivision by edges

  • edges (int in [2, 128], (optional)) – Edges, Number of points by edge

  • type (enum in ['BOX', 'LINE', 'POLYLINE', 'CIRCLE', 'ARC', 'CURVE'], (optional)) – Type, Type of shape

  • wait_for_input (boolean, (optional)) – Wait for Input

bpy.ops.gpencil.primitive_curve(subdivision=62, edges=2, type='CURVE', wait_for_input=True)

Create predefined grease pencil stroke curve shapes

Parameters
  • subdivision (int in [0, 128], (optional)) – Subdivisions, Number of subdivision by edges

  • edges (int in [2, 128], (optional)) – Edges, Number of points by edge

  • type (enum in ['BOX', 'LINE', 'POLYLINE', 'CIRCLE', 'ARC', 'CURVE'], (optional)) – Type, Type of shape

  • wait_for_input (boolean, (optional)) – Wait for Input

bpy.ops.gpencil.primitive_line(subdivision=6, edges=2, type='LINE', wait_for_input=True)

Create predefined grease pencil stroke lines

Parameters
  • subdivision (int in [0, 128], (optional)) – Subdivisions, Number of subdivision by edges

  • edges (int in [2, 128], (optional)) – Edges, Number of points by edge

  • type (enum in ['BOX', 'LINE', 'POLYLINE', 'CIRCLE', 'ARC', 'CURVE'], (optional)) – Type, Type of shape

  • wait_for_input (boolean, (optional)) – Wait for Input

bpy.ops.gpencil.primitive_polyline(subdivision=6, edges=2, type='POLYLINE', wait_for_input=True)

Create predefined grease pencil stroke polylines

Parameters
  • subdivision (int in [0, 128], (optional)) – Subdivisions, Number of subdivision by edges

  • edges (int in [2, 128], (optional)) – Edges, Number of points by edge

  • type (enum in ['BOX', 'LINE', 'POLYLINE', 'CIRCLE', 'ARC', 'CURVE'], (optional)) – Type, Type of shape

  • wait_for_input (boolean, (optional)) – Wait for Input

bpy.ops.gpencil.recalc_geometry()

Update all internal geometry data

bpy.ops.gpencil.reproject(type='VIEW', keep_original=False)

Reproject the selected strokes from the current viewpoint as if they had been newly drawn (e.g. to fix problems from accidental 3D cursor movement or accidental viewport changes, or for matching deforming geometry)

Parameters
  • type (enum in ['FRONT', 'SIDE', 'TOP', 'VIEW', 'SURFACE', 'CURSOR'], (optional)) –

    Projection Type

    • FRONT Front, Reproject the strokes using the X-Z plane.

    • SIDE Side, Reproject the strokes using the Y-Z plane.

    • TOP Top, Reproject the strokes using the X-Y plane.

    • VIEW View, Reproject the strokes to end up on the same plane, as if drawn from the current viewpoint using ‘Cursor’ Stroke Placement.

    • SURFACE Surface, Reproject the strokes on to the scene geometry, as if drawn using ‘Surface’ placement.

    • CURSOR Cursor, Reproject the strokes using the orientation of 3D cursor.

  • keep_original (boolean, (optional)) – Keep Original, Keep original strokes and create a copy before reprojecting instead of reproject them

bpy.ops.gpencil.reset_transform_fill(mode='ALL')

Reset any UV transformation and back to default values

Parameters

mode (enum in ['ALL', 'TRANSLATE', 'ROTATE', 'SCALE'], (optional)) – Mode

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

Show all Grease Pencil layers

Parameters

select (boolean, (optional)) – Select

bpy.ops.gpencil.sculpt_paint(stroke=None, wait_for_input=True)

Apply tweaks to strokes by painting over the strokes

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

  • wait_for_input (boolean, (optional)) – Wait for Input, Enter a mini ‘sculpt-mode’ if enabled, otherwise, exit after drawing a single stroke

bpy.ops.gpencil.sculptmode_toggle(back=False)

Enter/Exit sculpt mode for Grease Pencil strokes

Parameters

back (boolean, (optional)) – Return to Previous Mode, Return to previous mode

bpy.ops.gpencil.select(extend=False, deselect=False, toggle=False, deselect_all=False, entire_strokes=False, location=0, 0, use_shift_extend=False)

Select Grease Pencil strokes and/or stroke points

Parameters
  • extend (boolean, (optional)) – Extend, Extend selection instead of deselecting everything first

  • deselect (boolean, (optional)) – Deselect, Remove from selection

  • toggle (boolean, (optional)) – Toggle Selection, Toggle the selection

  • deselect_all (boolean, (optional)) – Deselect On Nothing, Deselect all when nothing under the cursor

  • entire_strokes (boolean, (optional)) – Entire Strokes, Select entire strokes instead of just the nearest stroke vertex

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

  • use_shift_extend (boolean, (optional)) – Extend

bpy.ops.gpencil.select_all(action='TOGGLE')

Change selection of all Grease Pencil strokes currently visible

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.gpencil.select_alternate(unselect_ends=True)

Select alternative points in same strokes as already selected points

Parameters

unselect_ends (boolean, (optional)) – Unselect Ends, Do not select the first and last point of the stroke

bpy.ops.gpencil.select_box(xmin=0, xmax=0, ymin=0, ymax=0, wait_for_input=True, mode='SET')

Select Grease Pencil strokes within a rectangular region

Parameters
  • 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', 'XOR', 'AND'], (optional)) –

    Mode

    • SET Set, Set a new selection.

    • ADD Extend, Extend existing selection.

    • SUB Subtract, Subtract existing selection.

    • XOR Difference, Inverts existing selection.

    • AND Intersect, Intersect existing selection.

bpy.ops.gpencil.select_circle(x=0, y=0, radius=25, wait_for_input=True, mode='SET')

Select Grease Pencil strokes using brush 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.gpencil.select_first(only_selected_strokes=False, extend=False)

Select first point in Grease Pencil strokes

Parameters
  • only_selected_strokes (boolean, (optional)) – Selected Strokes Only, Only select the first point of strokes that already have points selected

  • extend (boolean, (optional)) – Extend, Extend selection instead of deselecting all other selected points

bpy.ops.gpencil.select_grouped(type='LAYER')

Select all strokes with similar characteristics

Parameters

type (enum in ['LAYER', 'MATERIAL'], (optional)) –

Type

  • LAYER Layer, Shared layers.

  • MATERIAL Material, Shared materials.

bpy.ops.gpencil.select_lasso(mode='SET', path=None)

Select Grease Pencil strokes using lasso selection

Parameters
  • mode (enum in ['SET', 'ADD', 'SUB', 'XOR', 'AND'], (optional)) –

    Mode

    • SET Set, Set a new selection.

    • ADD Extend, Extend existing selection.

    • SUB Subtract, Subtract existing selection.

    • XOR Difference, Inverts existing selection.

    • AND Intersect, Intersect existing selection.

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

bpy.ops.gpencil.select_last(only_selected_strokes=False, extend=False)

Select last point in Grease Pencil strokes

Parameters
  • only_selected_strokes (boolean, (optional)) – Selected Strokes Only, Only select the last point of strokes that already have points selected

  • extend (boolean, (optional)) – Extend, Extend selection instead of deselecting all other selected points

bpy.ops.gpencil.select_less()

Shrink sets of selected Grease Pencil points

bpy.ops.gpencil.select_linked()

Select all points in same strokes as already selected points

bpy.ops.gpencil.select_more()

Grow sets of selected Grease Pencil points

bpy.ops.gpencil.select_vertex_color(threshold=0)

Select all points with similar vertex color of current selected

Parameters

threshold (int in [0, 5], (optional)) – Threshold, Tolerance of the selection. Higher values select a wider range of similar colors

bpy.ops.gpencil.selection_opacity_toggle()

Hide/Unhide selected points for Grease Pencil strokes setting alpha factor

bpy.ops.gpencil.selectmode_toggle(mode=0)

Set selection mode for Grease Pencil strokes

Parameters

mode (int in [0, 2], (optional)) – Select mode, Select mode

bpy.ops.gpencil.set_active_material()

Set the selected stroke material as the active material

bpy.ops.gpencil.snap_cursor_to_selected()

Snap cursor to center of selected points

bpy.ops.gpencil.snap_to_cursor(use_offset=True)

Snap selected points/strokes to the cursor

Parameters

use_offset (boolean, (optional)) – With Offset, Offset the entire stroke instead of selected points only

bpy.ops.gpencil.snap_to_grid()

Snap selected points to the nearest grid points

bpy.ops.gpencil.stroke_apply_thickness()

Apply the thickness change of the layer to its strokes

bpy.ops.gpencil.stroke_arrange(direction='UP')

Arrange selected strokes up/down in the drawing order of the active layer

Parameters

direction (enum in ['TOP', 'UP', 'DOWN', 'BOTTOM'], (optional)) – Direction

bpy.ops.gpencil.stroke_caps_set(type='TOGGLE')

Change Stroke caps mode (rounded or flat)

Parameters

type (enum in ['TOGGLE', 'START', 'END', 'TOGGLE'], (optional)) –

Type

  • TOGGLE Both.

  • START Start.

  • END End.

  • TOGGLE Default, Set as default rounded.

bpy.ops.gpencil.stroke_change_color(material='')

Move selected strokes to active material

Parameters

material (string, (optional, never None)) – Material, Name of the material

bpy.ops.gpencil.stroke_cutter(path=None, flat_caps=False)

Select section and cut

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

  • flat_caps (boolean, (optional)) – Flat Caps

bpy.ops.gpencil.stroke_cyclical_set(type='TOGGLE', geometry=False)

Close or open the selected stroke adding an edge from last to first point

Parameters
  • type (enum in ['CLOSE', 'OPEN', 'TOGGLE'], (optional)) – Type

  • geometry (boolean, (optional)) – Create Geometry, Create new geometry for closing stroke

bpy.ops.gpencil.stroke_flip()

Change direction of the points of the selected strokes

bpy.ops.gpencil.stroke_join(type='JOIN', leave_gaps=False)

Join selected strokes (optionally as new stroke)

Parameters
  • type (enum in ['JOIN', 'JOINCOPY'], (optional)) – Type

  • leave_gaps (boolean, (optional)) – Leave Gaps, Leave gaps between joined strokes instead of linking them

bpy.ops.gpencil.stroke_merge(mode='STROKE', back=False, additive=False, cyclic=False, clear_point=False, clear_stroke=False)

Create a new stroke with the selected stroke points

Parameters
  • mode (enum in ['STROKE', 'POINT'], (optional)) – Mode

  • back (boolean, (optional)) – Draw on Back, Draw new stroke below all previous strokes

  • additive (boolean, (optional)) – Additive Drawing, Add to previous drawing

  • cyclic (boolean, (optional)) – Cyclic, Close new stroke

  • clear_point (boolean, (optional)) – Dissolve Points, Dissolve old selected points

  • clear_stroke (boolean, (optional)) – Delete Strokes, Delete old selected strokes

bpy.ops.gpencil.stroke_merge_by_distance(threshold=0.001, use_unselected=False)

Merge points by distance

Parameters
  • threshold (float in [0, 100], (optional)) – Threshold

  • use_unselected (boolean, (optional)) – Unselected, Use whole stroke, not only selected points

bpy.ops.gpencil.stroke_merge_material(hue_threshold=0.001, sat_threshold=0.001, val_threshold=0.001)

Replace materials in strokes merging similar

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

  • sat_threshold (float in [0, 1], (optional)) – Saturation Threshold

  • val_threshold (float in [0, 1], (optional)) – Value Threshold

bpy.ops.gpencil.stroke_sample(length=0.1)

Sample stroke points to predefined segment length

Parameters

length (float in [0, 100], (optional)) – Length

bpy.ops.gpencil.stroke_separate(mode='POINT')

Separate the selected strokes or layer in a new grease pencil object

Parameters

mode (enum in ['POINT', 'STROKE', 'LAYER'], (optional)) –

Mode

  • POINT Selected Points, Separate the selected points.

  • STROKE Selected Strokes, Separate the selected strokes.

  • LAYER Active Layer, Separate the strokes of the current layer.

bpy.ops.gpencil.stroke_simplify(factor=0.0)

Simplify selected stroked reducing number of points

Parameters

factor (float in [0, 100], (optional)) – Factor

bpy.ops.gpencil.stroke_simplify_fixed(step=1)

Simplify selected stroked reducing number of points using fixed algorithm

Parameters

step (int in [1, 100], (optional)) – Steps, Number of simplify steps

bpy.ops.gpencil.stroke_smooth(repeat=1, factor=0.5, only_selected=True, smooth_position=True, smooth_thickness=True, smooth_strength=False, smooth_uv=False)

Smooth selected strokes

Parameters
  • repeat (int in [1, 50], (optional)) – Repeat

  • factor (float in [0, 2], (optional)) – Factor

  • only_selected (boolean, (optional)) – Selected Points, Smooth only selected points in the stroke

  • smooth_position (boolean, (optional)) – Position

  • smooth_thickness (boolean, (optional)) – Thickness

  • smooth_strength (boolean, (optional)) – Strength

  • smooth_uv (boolean, (optional)) – UV

bpy.ops.gpencil.stroke_split()

Split selected points as new stroke on same frame

bpy.ops.gpencil.stroke_subdivide(number_cuts=1, factor=0.0, repeat=1, only_selected=True, smooth_position=True, smooth_thickness=True, smooth_strength=False, smooth_uv=False)

Subdivide between continuous selected points of the stroke adding a point half way between them

Parameters
  • number_cuts (int in [1, 10], (optional)) – Number of Cuts

  • factor (float in [0, 2], (optional)) – Smooth

  • repeat (int in [1, 10], (optional)) – Repeat

  • only_selected (boolean, (optional)) – Selected Points, Smooth only selected points in the stroke

  • smooth_position (boolean, (optional)) – Position

  • smooth_thickness (boolean, (optional)) – Thickness

  • smooth_strength (boolean, (optional)) – Strength

  • smooth_uv (boolean, (optional)) – UV

bpy.ops.gpencil.stroke_trim()

Trim selected stroke to first loop or intersection

bpy.ops.gpencil.tint_flip()

Switch Tint colors

File

startupbl_uiproperties_grease_pencil_common.py:901

bpy.ops.gpencil.transform_fill(mode='ROTATE', location=0.0, 0.0, rotation=0.0, scale=0.0, release_confirm=False)

Transform Grease Pencil Stroke Fill

Parameters
  • mode (enum in ['TRANSLATE', 'ROTATE', 'SCALE'], (optional)) – Mode

  • location (float array of 2 items in [-inf, inf], (optional)) – Location

  • rotation (float in [-6.28319, 6.28319], (optional)) – Rotation

  • scale (float in [0.001, 100], (optional)) – Scale

  • release_confirm (boolean, (optional)) – Confirm on Release

bpy.ops.gpencil.unlock_all()

Unlock all Grease Pencil layers so that they can be edited

bpy.ops.gpencil.vertex_color_brightness_contrast(mode='STROKE', brightness=0.0, contrast=0.0)

Adjust vertex color brightness/contrast

Parameters
  • mode (enum in ['STROKE', 'FILL', 'BOTH'], (optional)) – Mode

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

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

bpy.ops.gpencil.vertex_color_hsv(mode='STROKE', h=0.5, s=1.0, v=1.0)

Adjust vertex color HSV values

Parameters
  • mode (enum in ['STROKE', 'FILL', 'BOTH'], (optional)) – Mode

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

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

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

bpy.ops.gpencil.vertex_color_invert(mode='STROKE')

Invert RGB values

Parameters

mode (enum in ['STROKE', 'FILL', 'BOTH'], (optional)) – Mode

bpy.ops.gpencil.vertex_color_levels(mode='STROKE', offset=0.0, gain=1.0)

Adjust levels of vertex colors

Parameters
  • mode (enum in ['STROKE', 'FILL', 'BOTH'], (optional)) – Mode

  • 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.gpencil.vertex_color_set(mode='STROKE', factor=1.0)

Set active color to all selected vertex

Parameters
  • mode (enum in ['STROKE', 'FILL', 'BOTH'], (optional)) – Mode

  • factor (float in [0.001, 1], (optional)) – Factor, Mix Factor

bpy.ops.gpencil.vertex_group_assign()

Assign the selected vertices to the active vertex group

bpy.ops.gpencil.vertex_group_deselect()

Deselect all selected vertices assigned to the active vertex group

bpy.ops.gpencil.vertex_group_invert()

Invert weights to the active vertex group

bpy.ops.gpencil.vertex_group_normalize()

Normalize weights to the active vertex group

bpy.ops.gpencil.vertex_group_normalize_all(lock_active=True)

Normalize all weights of all vertex groups, so that for each vertex, the sum of all weights is 1.0

Parameters

lock_active (boolean, (optional)) – Lock Active, Keep the values of the active group while normalizing others

bpy.ops.gpencil.vertex_group_remove_from()

Remove the selected vertices from active or all vertex group(s)

bpy.ops.gpencil.vertex_group_select()

Select all the vertices assigned to the active vertex group

bpy.ops.gpencil.vertex_group_smooth(factor=0.5, repeat=1)

Smooth weights to the active vertex group

Parameters
  • factor (float in [0, 1], (optional)) – Factor

  • repeat (int in [1, 10000], (optional)) – Iterations

bpy.ops.gpencil.vertex_paint(stroke=None, wait_for_input=True)

Paint stroke points with a color

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

  • wait_for_input (boolean, (optional)) – Wait for Input

bpy.ops.gpencil.vertexmode_toggle(back=False)

Enter/Exit vertex paint mode for Grease Pencil strokes

Parameters

back (boolean, (optional)) – Return to Previous Mode, Return to previous mode

bpy.ops.gpencil.weight_paint(stroke=None, wait_for_input=True)

Paint stroke points with a color

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

  • wait_for_input (boolean, (optional)) – Wait for Input

bpy.ops.gpencil.weightmode_toggle(back=False)

Enter/Exit weight paint mode for Grease Pencil strokes

Parameters

back (boolean, (optional)) – Return to Previous Mode, Return to previous mode