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

Add new Grease Pencil datablock

Unlink active Grease Pencil datablock

bpy.ops.gpencil.draw(mode='DRAW', stroke=None)

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
bpy.ops.gpencil.layer_add()

Add new Grease Pencil layer for the active Grease Pencil datablock

Previous topic

Font Operators

Next topic

Graph Operators