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
DRAWDraw Freehand – Draw freehand stroke(s).DRAW_STRAIGHTDraw Straight Lines – Draw straight line segment(s).DRAW_POLYDraw Poly Line – Click to place endpoints of straight line segments (connected).ERASEREraser – Erase Annotation strokes.
arrowstyle_start (enum in ['NONE', 'ARROW', 'ARROW_OPEN', 'ARROW_OPEN_INVERTED', 'DIAMOND'], (optional)) –
Start Arrow Style, Stroke start style
NONENone – Don’t use any arrow/style in corner.ARROWArrow – Use closed arrow style.ARROW_OPENOpen Arrow – Use open arrow style.ARROW_OPEN_INVERTEDSegment – Use perpendicular segment style.DIAMONDSquare – Use square style.
arrowstyle_end (enum in ['NONE', 'ARROW', 'ARROW_OPEN', 'ARROW_OPEN_INVERTED', 'DIAMOND'], (optional)) –
End Arrow Style, Stroke end style
NONENone – Don’t use any arrow/style in corner.ARROWArrow – Use closed arrow style.ARROW_OPENOpen Arrow – Use open arrow style.ARROW_OPEN_INVERTEDSegment – Use perpendicular segment style.DIAMONDSquare – 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_collectionofOperatorStrokeElement, (optional)) – Strokewait_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_grease_pencil_animation(frame_start=1, frame_end=250, step=1, only_selected=False, frame_target=1, project_type='KEEP')
Bake grease pencil object transform to grease pencil keyframes
- Parameters
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
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
KEEPNo Reproject.FRONTFront – Reproject the strokes using the X-Z plane.SIDESide – Reproject the strokes using the Y-Z plane.TOPTop – Reproject the strokes using the X-Y plane.VIEWView – Reproject the strokes to end up on the same plane, as if drawn from the current viewpoint using ‘Cursor’ Stroke Placement.CURSORCursor – Reproject the strokes using the orientation of 3D cursor.
- bpy.ops.gpencil.bake_mesh_animation(target='NEW', 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 (enum in ['NEW', 'SELECTED'], (optional)) – Target Object, Target grease pencil
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
KEEPNo Reproject.FRONTFront – Reproject the strokes using the X-Z plane.SIDESide – Reproject the strokes using the Y-Z plane.TOPTop – Reproject the strokes using the X-Y plane.VIEWView – Reproject the strokes to end up on the same plane, as if drawn from the current viewpoint using ‘Cursor’ Stroke Placement.CURSORCursor – 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
PATHPath – Animation path.CURVEBezier Curve – Smooth Bezier curve.POLYPolygon 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
NONENo Timing – Ignore timing.LINEARLinear – Simple linear timing.FULLOriginal – Use the original timing, gaps included.CUSTOMGAPCustom 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
- bpy.ops.gpencil.data_unlink()
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
POINTSPoints – Delete selected points and split strokes into segments.STROKESStrokes – Delete selected strokes.FRAMEFrame – 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
POINTSDissolve – Dissolve selected points.BETWEENDissolve Between – Dissolve points between selected points.UNSELECTDissolve 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
DRAWDraw Freehand – Draw freehand stroke(s).DRAW_STRAIGHTDraw Straight Lines – Draw straight line segment(s).ERASEREraser – Erase Grease Pencil strokes.
stroke (
bpy_prop_collectionofOperatorStrokeElement, (optional)) – Strokewait_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 strokesTRANSFORM_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 pointsTRANSFORM_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
ACTIVEActive Frame Only – Clean active frame only.ALLAll 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
ACTIVEActive – Duplicate frame in active layer only.ALLAll – 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, layers='ACTIVE', interpolate_selected_only=False, flip='AUTO', smooth_steps=1, smooth_factor=0.0, release_confirm=False)
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
layers (enum in ['ACTIVE', 'ALL'], (optional)) – Layer, Layers included in the interpolation
interpolate_selected_only (boolean, (optional)) – Only Selected, Interpolate only selected strokes
flip (enum in ['NOFLIP', 'FLIP', 'AUTO'], (optional)) – Flip Mode, Invert destination stroke to match start and end with source stroke
smooth_steps (int in [1, 3], (optional)) – Iterations, Number of times to smooth newly created strokes
smooth_factor (float in [0, 2], (optional)) – Smooth, Amount of smoothing to apply to interpolated strokes, to reduce jitter/noise
release_confirm (boolean, (optional)) – Confirm on Release
- bpy.ops.gpencil.interpolate_reverse()
Remove breakdown frames generated by interpolating between two Grease Pencil frames
- bpy.ops.gpencil.interpolate_sequence(step=1, layers='ACTIVE', interpolate_selected_only=False, flip='AUTO', smooth_steps=1, smooth_factor=0.0, type='LINEAR', easing='AUTO', back=1.702, amplitude=0.15, period=0.15)
Generate ‘in-betweens’ to smoothly interpolate between Grease Pencil frames
- Parameters
step (int in [1, 1048574], (optional)) – Step, Number of frames between generated interpolated frames
layers (enum in ['ACTIVE', 'ALL'], (optional)) – Layer, Layers included in the interpolation
interpolate_selected_only (boolean, (optional)) – Only Selected, Interpolate only selected strokes
flip (enum in ['NOFLIP', 'FLIP', 'AUTO'], (optional)) – Flip Mode, Invert destination stroke to match start and end with source stroke
smooth_steps (int in [1, 3], (optional)) – Iterations, Number of times to smooth newly created strokes
smooth_factor (float in [0, 2], (optional)) – Smooth, Amount of smoothing to apply to interpolated strokes, to reduce jitter/noise
type (enum in ['LINEAR', 'CUSTOM', 'SINE', 'QUAD', 'CUBIC', 'QUART', 'QUINT', 'EXPO', 'CIRC', 'BACK', 'BOUNCE', 'ELASTIC'], (optional)) –
Type, Interpolation method to use the next time ‘Interpolate Sequence’ is run
LINEARLinear – Straight-line interpolation between A and B (i.e. no ease in/out).CUSTOMCustom – Custom interpolation defined using a curve map.SINESinusoidal – Sinusoidal easing (weakest, almost linear but with a slight curvature).QUADQuadratic – Quadratic easing.CUBICCubic – Cubic easing.QUARTQuartic – Quartic easing.QUINTQuintic – Quintic easing.EXPOExponential – Exponential easing (dramatic).CIRCCircular – Circular easing (strongest and most dynamic).BACKBack – Cubic easing with overshoot and settle.BOUNCEBounce – Exponentially decaying parabolic bounce, like when objects collide.ELASTICElastic – Exponentially decaying sine wave, like an elastic band.
easing (enum in ['AUTO', 'EASE_IN', 'EASE_OUT', 'EASE_IN_OUT'], (optional)) –
Easing, Which ends of the segment between the preceding and following grease pencil frames easing interpolation is applied to
AUTOAutomatic Easing – Easing type is chosen automatically based on what the type of interpolation used (e.g. ‘Ease In’ for transitional types, and ‘Ease Out’ for dynamic effects).EASE_INEase In – Only on the end closest to the next keyframe.EASE_OUTEase Out – Only on the end closest to the first keyframe.EASE_IN_OUTEase In and Out – Segment between both keyframes.
back (float in [0, inf], (optional)) – Back, Amount of overshoot for ‘back’ easing
amplitude (float in [0, inf], (optional)) – Amplitude, Amount to boost elastic bounces for ‘elastic’ easing
period (float in [-inf, inf], (optional)) – Period, Time between bounces for elastic easing
- 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(mode='ALL')
Make a copy of the active Grease Pencil layer
- Parameters
mode (enum in ['ALL', 'EMPTY'], (optional)) – Mode
- bpy.ops.gpencil.layer_duplicate_object(mode='ALL', only_active=True)
Make a copy of the active Grease Pencil layer to selected object
- Parameters
mode (enum in ['ALL', 'ACTIVE'], (optional)) – Mode
only_active (boolean, (optional)) – Only Active, Copy only active Layer, uncheck to append all layers
- 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_move(type='UP')
Move the active Grease Pencil mask layer up/down in the list
- Parameters
type (enum in ['UP', 'DOWN'], (optional)) – Type
- bpy.ops.gpencil.layer_mask_remove()
Remove Layer Mask
- bpy.ops.gpencil.layer_merge(mode='ACTIVE')
Combine Layers
- Parameters
mode (enum in ['ACTIVE', 'ALL'], (optional)) –
Mode
ACTIVEActive – Combine active layer into the layer below.ALLAll – Combine all layers into the active 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.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.materials_copy_to_object(only_active=True)
Append Materials of the active Grease Pencil to other object
- Parameters
only_active (boolean, (optional)) – Only Active, Append only active material, uncheck to append all materials
- 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
FRONTFront – Reproject the strokes using the X-Z plane.SIDESide – Reproject the strokes using the Y-Z plane.TOPTop – Reproject the strokes using the X-Y plane.VIEWView – Reproject the strokes to end up on the same plane, as if drawn from the current viewpoint using ‘Cursor’ Stroke Placement.SURFACESurface – Reproject the strokes on to the scene geometry, as if drawn using ‘Surface’ placement.CURSORCursor – 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_collectionofOperatorStrokeElement, (optional)) – Strokewait_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.segment_add(modifier='')
Add a segment to the dash modifier
- Parameters
modifier (string, (optional, never None)) – Modifier, Name of the modifier to edit
- bpy.ops.gpencil.segment_move(modifier='', type='UP')
Move the active dash segment up or down
- Parameters
modifier (string, (optional, never None)) – Modifier, Name of the modifier to edit
type (enum in ['UP', 'DOWN'], (optional)) – Type
- bpy.ops.gpencil.segment_remove(modifier='', index=0)
Remove the active segment from the dash modifier
- Parameters
modifier (string, (optional, never None)) – Modifier, Name of the modifier to edit
index (int in [0, inf], (optional)) – Index, Index of the segment to remove
- 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
TOGGLEToggle – Toggle selection for all elements.SELECTSelect – Select all elements.DESELECTDeselect – Deselect all elements.INVERTInvert – Invert selection of all elements.
- bpy.ops.gpencil.select_alternate(unselect_ends=False)
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
SETSet – Set a new selection.ADDExtend – Extend existing selection.SUBSubtract – Subtract existing selection.XORDifference – Inverts existing selection.ANDIntersect – 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
SETSet – Set a new selection.ADDExtend – Extend existing selection.SUBSubtract – 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
LAYERLayer – Shared layers.MATERIALMaterial – 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
SETSet – Set a new selection.ADDExtend – Extend existing selection.SUBSubtract – Subtract existing selection.XORDifference – Inverts existing selection.ANDIntersect – Intersect existing selection.
path (
bpy_prop_collectionofOperatorMousePath, (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_random(ratio=0.5, seed=0, action='SELECT', unselect_ends=False)
Select random points for non selected strokes
- Parameters
ratio (float in [0, 1], (optional)) – Ratio, Portion of items to select randomly
seed (int in [0, inf], (optional)) – Random Seed, Seed for the random number generator
action (enum in ['SELECT', 'DESELECT'], (optional)) –
Action, Selection action to execute
SELECTSelect – Select all elements.DESELECTDeselect – Deselect all elements.
unselect_ends (boolean, (optional)) – Unselect Ends, Do not select the first and last point of the stroke
- 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 display 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', 'DEFAULT'], (optional)) –
Type
TOGGLEBoth.STARTStart.ENDEnd.DEFAULTDefault – 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_collectionofOperatorMousePath, (optional)) – Pathflat_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_editcurve_set_handle_type(type='AUTOMATIC')
Set the type of a edit curve handle
- Parameters
type (enum in ['FREE', 'AUTOMATIC', 'VECTOR', 'ALIGNED'], (optional)) – Type, Spline type
- bpy.ops.gpencil.stroke_enter_editcurve_mode(error_threshold=0.1)
Called to transform a stroke into a curve
- Parameters
error_threshold (float in [1.17549e-38, 100], (optional)) – Error Threshold, Threshold on the maximum deviation from the actual 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_normalize(mode='THICKNESS', factor=1.0, value=10)
Normalize stroke attributes
- Parameters
mode (enum in ['THICKNESS', 'OPACITY'], (optional)) –
Mode, Attribute to be normalized
THICKNESSThickness – Normalizes the stroke thickness by making all points use the same thickness value.OPACITYOpacity – Normalizes the stroke opacity by making all points use the same opacity value.
factor (float in [0, 1], (optional)) – Factor
value (int in [0, 1000], (optional)) – Value, Value
- bpy.ops.gpencil.stroke_reset_vertex_color(mode='BOTH')
Reset vertex color for all or selected strokes
- Parameters
mode (enum in ['STROKE', 'FILL', 'BOTH'], (optional)) –
Mode
STROKEStroke – Reset Vertex Color to Stroke only.FILLFill – Reset Vertex Color to Fill only.BOTHStroke & Fill – Reset Vertex Color to Stroke and Fill.
- 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
POINTSelected Points – Separate the selected points.STROKESelected Strokes – Separate the selected strokes.LAYERActive 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
- 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='BOTH', 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='BOTH', 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='BOTH')
Invert RGB values
- Parameters
mode (enum in ['STROKE', 'FILL', 'BOTH'], (optional)) – Mode
- bpy.ops.gpencil.vertex_color_levels(mode='BOTH', 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='BOTH', 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_collectionofOperatorStrokeElement, (optional)) – Strokewait_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_collectionofOperatorStrokeElement, (optional)) – Strokewait_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