Gpencil Operators

bpy.ops.gpencil.active_frame_delete()

Delete the active frame for the active Grease Pencil datablock

bpy.ops.gpencil.convert(type='PATH', use_normalize_weights=True, radius_multiplier=1.0, use_link_strokes=True, 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
  • use_normalize_weights (boolean, (optional)) – Normalize Weight, Normalize weight (set from stroke width)
  • radius_multiplier (float in [0, 1000], (optional)) – Radius Fac, 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.copy()

Copy selected Grease Pencil points and strokes

bpy.ops.gpencil.data_add()

Add new Grease Pencil datablock

Unlink active Grease Pencil datablock

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()

Delete selected points without splitting strokes

bpy.ops.gpencil.draw(mode='DRAW', 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 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
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)) – Translate, Translate (move) selected items
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.layer_add()

Add new Grease Pencil layer for the active Grease Pencil datablock

bpy.ops.gpencil.layer_duplicate()

Make a copy of the active Grease Pencil layer

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.paste()

Paste previously copied strokes into active layer

bpy.ops.gpencil.reveal()

Show all Grease Pencil layers

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

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
  • 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
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_border(gesture_mode=0, xmin=0, xmax=0, ymin=0, ymax=0, extend=True)

Select Grease Pencil strokes within a rectangular region

Parameters:
  • gesture_mode (int in [-inf, inf], (optional)) – Gesture Mode
  • 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
  • extend (boolean, (optional)) – Extend, Extend selection instead of deselecting everything first
bpy.ops.gpencil.select_circle(x=0, y=0, radius=1, gesture_mode=0)

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
  • gesture_mode (int in [-inf, inf], (optional)) – Gesture Mode
bpy.ops.gpencil.select_lasso(path=None, deselect=False, extend=True)

Select Grease Pencil strokes using lasso selection

Parameters:
  • path (bpy_prop_collection of OperatorMousePath, (optional)) – Path
  • deselect (boolean, (optional)) – Deselect, Deselect rather than select items
  • extend (boolean, (optional)) – Extend, Extend selection instead of deselecting everything first
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