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.
brush_add
()¶ Add new Grease Pencil drawing brush for the active Grease Pencil data-block
-
bpy.ops.gpencil.
brush_change
(brush='DEFAULT')¶ Change active Grease Pencil drawing brush
Parameters: brush (enum in ['DEFAULT'], (optional)) – Grease Pencil Brush
-
bpy.ops.gpencil.
brush_copy
()¶ Copy current Grease Pencil drawing brush
-
bpy.ops.gpencil.
brush_move
(type='UP')¶ Move the active Grease Pencil drawing brush up/down in the list
Parameters: type (enum in ['UP', 'DOWN'], (optional)) – Type
-
bpy.ops.gpencil.
brush_paint
(stroke=None, wait_for_input=True)¶ Apply tweaks to strokes by painting over the strokes
Parameters: - stroke (
bpy_prop_collection
ofOperatorStrokeElement
, (optional)) – Stroke - wait_for_input (boolean, (optional)) – Wait for Input, Enter a mini ‘sculpt-mode’ if enabled, otherwise, exit after drawing a single stroke
- stroke (
-
bpy.ops.gpencil.
brush_presets_create
()¶ Create a set of predefined Grease Pencil drawing brushes
-
bpy.ops.gpencil.
brush_remove
()¶ Remove active Grease Pencil drawing brush
-
bpy.ops.gpencil.
brush_select
(index=0)¶ Select a Grease Pencil drawing brush
Parameters: index (int in [0, inf], (optional)) – Index, Index of Drawing Brush
-
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
PATH
Path, Animation path.CURVE
Bezier Curve, Smooth Bezier curve.POLY
Polygon Curve, Bezier curve with straight-line segments (vector handles).
- 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)
- type (enum in ['PATH', 'CURVE', 'POLY'], (optional)) –
-
bpy.ops.gpencil.
copy
()¶ Copy selected Grease Pencil points and strokes
-
bpy.ops.gpencil.
data_add
()¶ Add new Grease Pencil data-block
-
bpy.ops.gpencil.
data_unlink
()¶ Unlink active Grease Pencil 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
()¶ 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
ofOperatorStrokeElement
, (optional)) – Stroke - wait_for_input (boolean, (optional)) – Wait for Input, Wait for first click instead of painting immediately
- mode (enum in ['DRAW', 'DRAW_STRAIGHT', 'DRAW_POLY', 'ERASER'], (optional)) –
-
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
- GPENCIL_OT_duplicate (
-
bpy.ops.gpencil.
editmode_toggle
()¶ Enter/Exit edit mode for Grease Pencil strokes
-
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.
interpolate
(shift=0.0)¶ Interpolate grease pencil strokes between frames
Parameters: shift (float in [-1, 1], (optional)) – Shift, Displacement factor for the interpolate operation
-
bpy.ops.gpencil.
interpolate_sequence
()¶ Interpolate full grease pencil strokes sequence between frames
-
bpy.ops.gpencil.
layer_add
()¶ Add new Grease Pencil layer for the active Grease Pencil data-block
-
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_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_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.
move_to_layer
(layer='DEFAULT')¶ Move selected strokes to another layer
Parameters: layer (enum in ['DEFAULT'], (optional)) – Grease Pencil Layer
-
bpy.ops.gpencil.
palette_add
()¶ Add new Grease Pencil palette for the active Grease Pencil data-block
-
bpy.ops.gpencil.
palette_change
(palette='DEFAULT')¶ Change active Grease Pencil palette
Parameters: palette (enum in ['DEFAULT'], (optional)) – Grease Pencil Palette
-
bpy.ops.gpencil.
palette_lock_layer
()¶ Lock and hide any color not used in any layer
-
bpy.ops.gpencil.
palette_remove
()¶ Remove active Grease Pencil palette
-
bpy.ops.gpencil.
palettecolor_add
()¶ Add new Grease Pencil palette color for the active Grease Pencil data-block
-
bpy.ops.gpencil.
palettecolor_copy
()¶ Copy current Grease Pencil palette color
-
bpy.ops.gpencil.
palettecolor_hide
(unselected=False)¶ Hide selected/unselected Grease Pencil colors
Parameters: unselected (boolean, (optional)) – Unselected, Hide unselected rather than selected colors
-
bpy.ops.gpencil.
palettecolor_isolate
(affect_visibility=False)¶ Toggle whether the active color 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.
palettecolor_lock_all
()¶ Lock all Grease Pencil colors to prevent them from being accidentally modified
-
bpy.ops.gpencil.
palettecolor_move
(direction='UP')¶ Move the active Grease Pencil palette color up/down in the list
Parameters: direction (enum in ['UP', 'DOWN'], (optional)) – Direction
-
bpy.ops.gpencil.
palettecolor_remove
()¶ Remove active Grease Pencil palette color
-
bpy.ops.gpencil.
palettecolor_reveal
()¶ Unhide all hidden Grease Pencil palette colors
-
bpy.ops.gpencil.
palettecolor_select
()¶ Select all Grease Pencil strokes using current color
-
bpy.ops.gpencil.
palettecolor_unlock_all
()¶ Unlock all Grease Pencil colors so that they can be edited
-
bpy.ops.gpencil.
paste
(type='COPY')¶ Paste previously copied strokes or copy and merge in active layer
Parameters: type (enum in ['COPY', 'MERGE'], (optional)) – Type
-
bpy.ops.gpencil.
reproject
()¶ Reproject the selected strokes from the current viewpoint to get all points on the same plane again (e.g. to fix problems from accidental 3D cursor movement, or viewport changes)
-
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_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', 'COLOR'], (optional)) – Type
LAYER
Layer, Shared layers.COLOR
Color, Shared colors.
-
bpy.ops.gpencil.
select_lasso
(path=None, deselect=False, extend=True)¶ Select Grease Pencil strokes using lasso selection
Parameters: - path (
bpy_prop_collection
ofOperatorMousePath
, (optional)) – Path - deselect (boolean, (optional)) – Deselect, Deselect rather than select items
- extend (boolean, (optional)) – Extend, Extend selection instead of deselecting everything first
- 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.
selection_opacity_toggle
()¶ Hide/Unhide selected points for Grease Pencil strokes setting alpha factor
-
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 ['UP', 'DOWN', 'TOP', 'BOTTOM'], (optional)) – Direction
-
bpy.ops.gpencil.
stroke_change_color
()¶ Move selected strokes to active color
-
bpy.ops.gpencil.
stroke_cyclical_set
(type='TOGGLE')¶ Close or open the selected stroke adding an edge from last to first point
Parameters: type (enum in ['CLOSE', 'OPEN', 'TOGGLE'], (optional)) – Type
-
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_lock_color
()¶ Lock any color not used in any selected stroke
-
bpy.ops.gpencil.
stroke_subdivide
(number_cuts=1)¶ 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
-
bpy.ops.gpencil.
unlock_all
()¶ Unlock all Grease Pencil layers so that they can be edited