user: What is Grease Pencil Operators and how is it used in Blender Python scripting?

assistant: n**,* *(**optional**)*) – Only Active, Append only active material, uncheck to append all materials

bpy.ops.grease_pencil.material_hide(*\**, *invert=False*)
:   Hide active/inactive Grease Pencil material(s)

    Parameters:
    :   **invert** (*boolean**,* *(**optional**)*) – Invert, Hide inactive materials instead of the active one

bpy.ops.grease_pencil.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.grease_pencil.material_lock_all()
:   Lock all Grease Pencil materials to prevent them from being accidentally modified

bpy.ops.grease_pencil.material_lock_unselected()
:   Lock any material not used in any selected stroke

bpy.ops.grease_pencil.material_lock_unused()
:   Lock and hide any material not used

bpy.ops.grease_pencil.material_reveal()
:   Unhide all hidden Grease Pencil materials

bpy.ops.grease_pencil.material_select(*\**, *deselect=False*)
:   Select/Deselect all Grease Pencil strokes using current material

    Parameters:
    :   **deselect** (*boolean**,* *(**optional**)*) – Deselect, Unselect strokes

bpy.ops.grease_pencil.material_unlock_all()
:   Unlock all Grease Pencil materials so that they can be edited

bpy.ops.grease_pencil.move_to_layer(*\**, *target_layer_name=''*, *add_new_layer=False*)
:   Move selected strokes to another layer

    Parameters:
    :   - **target_layer_name** (*string**,* *(**optional**,* *never None**)*) – Name, Target Grease Pencil Layer
        - **add_new_layer** (*boolean**,* *(**optional**)*) – New Layer, Move selection to a new layer

bpy.ops.grease_pencil.outline(*\**, *type='VIEW'*, *radius=0.01*, *offset_factor=-1.0*, *corner_subdivisions=2*)
:   Convert selected strokes to perimeter

    Parameters:
    :   - **type** (enum in [`'VIEW'`, `'FRONT'`, `'SIDE'`, `'TOP'`, `'CURSOR'`, `'CAMERA'`], (optional)) – Projection Mode
        - **radius** (*float in* *[**0**,* *10**]**,* *(**optional**)*) – Radius
        - **offset_factor** (*float in* *[**-1**,* *1**]**,* *(**optional**)*) – Offset Factor
        - **corner_subdivisions** (*int in* *[**0**,* *10**]**,* *(**optional**)*) – Corner Subdivisions

bpy.ops.grease_pencil.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.grease_pencil.paste(*\**, *type='ACTIVE'*, *paste_back=False*, *keep_world_transform=False*)
:   Paste Grease Pencil points or strokes from the internal clipboard to the active layer

    Parameters:
    :   - **type** (enum in [`'ACTIVE'`, `'LAYER'`], (optional)) – Type
        - **paste_back** (*boolean**,* *(**optional**)*) – Paste on Back, Add pasted strokes behind all strokes
        - **keep_world_transform** (*boolean**,* *(**optional**)*) – Keep World Transform, Keep the world transform of strokes from the clipboard unchanged

bpy.ops.grease_pencil.pen(*\**, *extend=False*, *deselect=False*, *toggle=False*, *deselect_all=False*, *select_passthrough=False*, *extrude_point=False*, *extrude_handle='VECTOR'*, *delete_point=False*, *insert_point=False*, *move_segment=False*, *select_point=False*, *move_point=False*, *cycle_handle_type=False*, *size=0.01*)
:   Construct and edit splines

    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
        - **select_passthrough** (*boolean**,* *(**optional**)*) – Only Select Unselected, Ignore the select action when the element is already selected
        - **extrude_point** (*boolean**,* *(**optional**)*) – Extrude Point, Add a point connected to the last selected point
        - **extrude_handle** (enum in [`'AUTO'`, `'VECTOR'`], (optional)) – Extrude Handle Type, Type of the extruded handle
        - **delete_point** (*boolean**,* *(**optional**)*) – Delete Point, Delete an existing point
        - **insert_point** (*boolean**,* *(**optional**)*) – Insert Point, Insert Point into a curve segment
        - **move_segment** (*boolean**,* *(**optional**)*) – Move Segment, Delete an existing point
        - **select_point** (*boolean**,* *(**optional**)*) – Select Point, Select a point or its handles
        - **move_point** (*boolean**,* *(**optional**)*) – Move Point, Move a point or its handles
        - **cycle_handle_type** (*boolean**,* *(**optional**)*) – Cycle Handle Type, Cycle between all four handle types
        - **size** (*float in* *[**0**,* *inf**]**,* *(**optional**)*) – Size, Diameter of new points

bpy.ops.grease_pencil.primitive_arc(*\**, *subdivision=62*, *type='ARC'*)
:   Create predefined Grease Pencil stroke arcs

    Parameters:
    :   - **subdivision** (*int in* *[**0**,* *inf**]**,* *(**optional**)*) – Subdivisions, Number of subdivisions per segment
        - **type** (enum in [`'BOX'`, `'LINE'`, `'POLYLINE'`, `'CIRCLE'`, `'ARC'`, `'CURVE'`], (optional)) – Type, Type of shape

bpy.ops.grease_pencil.primitive_box(*\**, *subdivision=3*, *type='BOX'*)
:   Create predefined Grease Pencil stroke boxes

    Parameters:
    :   - **subdivision** (*int in* *[**0**,* *inf**]**,* *(**optional**)*) – Subdivisions, Number of subdivisions per segment
        - **type** (enum in [`'BOX'`, `'LINE'`, `'POLYLINE'`, `'CIRCLE'`, `'ARC'`, `'CURVE'`], (optional)) – Type, Type of shape

bpy.ops.grease_pencil.primitive_circle(*\**, *subdivision=94*, *type='CIRCLE'*)
:   Create predefined Grease Pencil stroke circles

    Parameters:
    :   - **subdivision** (*int in* *[**0**,* *inf**]**,* *(**optional**)*) – Subdivisions, Number of subdivisions per segment
        - **type** (enum in [`'BOX'`, `'LINE'`, `'POLYLINE'`, `'CIRCLE'`, `'ARC'`, `'CURVE'`], (optional)) – Type, Type of shape

bpy.ops.grease_pencil.primitive_curve(*\**, *subdivision=62*, *type='CURVE'*)
:   Create predefined Grease Pencil stroke curve shapes

    Parameters:
    :   - **subdivision** (*int in* *[**0**,* *inf**]**,* *(**optional**)*) – Subdivisions, Number of subdivisions per segment
        - **type** (enum in [`'BOX'`, `'LINE'`, `'POLYLINE'`, `'CIRCLE'`, `'ARC'`, `'CURVE'`], (optional)) – Type, Type of shape

bpy.ops.grease_pencil.primitive_line(*\**, *subdivision=6*, *type='LINE'*)
:   Create predefined Grease Pencil stroke lines

    Parameters:
    :   - **subdivision** (*int in* *[**0**,* *inf**]**,* *(**optional**)*) – Subdivisions, Number of subdivisions per segment
        - **type** (enum in [`'BOX'`, `'LINE'`, `'POLYLINE'`, `'CIRCLE'`, `'ARC'`, `'CURVE'`], (optional)) – Type, Type of shape

bpy.ops.grease_pencil.primitive_polyline(*\**, *subdivision=6*, *type='POLYLINE'*)
:   Create predefined Grease Pencil stroke polylines

    Parameters:
    :   - **subdivision** (*int in* *[**0**,* *inf**]**,* *(**optional**)*) – Subdivisions, Number of subdivisions per segment
        - **type** (enum in [`'BOX'`, `'LINE'`, `'POLYLINE'`, `'CIRCLE'`, `'ARC'`, `'CURVE'`], (optional)) – Type, Type of shape

bpy.ops.grease_pencil.relative_layer_mask_add(*\**, *mode='ABOVE'*)
:   Mask active layer with layer above or below

    Parameters:
    :   **mode** (enum in [`'ABOVE'`, `'BELOW'`], (optional)) – Mode, Which relative layer (above or below) to use as a mask

    File:
    :   [startup/bl_operators/grease_pencil.py:39](https://projects.blender.org/blender/blender/src/branch/main/scripts/startup/bl_operators/grease_pencil.py#L39)

bpy.ops.grease_pencil.remove_fill_guides(*\**, *mode='ALL_FRAMES'*)
:   Remove all the strokes that were created from the fill tool as guides

    Parameters:
    :   **mode** (enum in [`'ACTIVE_FRAME'`, `'ALL_FRAMES'`], (optional)) – Mode

bpy.ops.grease_pencil.reorder(*\**, *direction='TOP'*)
:   Change the display order of the selected strokes

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

bpy.ops.grease_pencil.reproject(*\**, *type='VIEW'*, *keep_original=False*, *offset=0.0*)
:   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
        - **offset** (*float in* *[**0**,* *10**]**,* *(**optional**)*) – Surface Offset

bpy.ops.grease_pencil.reset_uvs()
:   Reset UV transformation to default values

bpy.ops.grease_pencil.sculpt_paint(*\**, *stroke=None*, *mode='NORMAL'*, *pen_flip=False*)
:   Sculpt strokes in the active Grease Pencil object

    Parameters:
    :   - **stroke** (`bpy_prop_collection` of `OperatorStrokeElement`, (optional)) – Stroke
        - **mode** (enum in [`'NORMAL'`, `'INVERT'`, `'SMOOTH'`, `'ERASE'`], (optional)) –

          Stroke Mode, Action taken when a paint stroke is made

          - `NORMAL`
            Regular – Apply brush normally.
          - `INVERT`
            Invert – Invert action of brush for duration of stroke.
          - `SMOOTH`
            Smooth – Switch brush to smooth mode for duration of stroke.
          - `ERASE`
            Erase – Switch brush to erase mode for duration of stroke.
        - **pen_flip** (*boolean**,* *(**optional**)*) – Pen Flip, Whether a tablet’s eraser mode is being used

bpy.ops.grease_pencil.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.grease_pencil.select_all(*\**, *action='TOGGLE'*)
:   (De)select all visible strokes

    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.grease_pencil.select_alternate(*\**, *deselect_ends=False*)
:   Select alternated points in strokes with already selected points

    Parameters:
    :   **deselect_ends** (*boolean**,* *(**optional**)*) – Deselect Ends, (De)select the first and last point of each stroke

bpy.ops.grease_pencil.select_ends(*\**, *amount_start=0*, *amount_end=1*)
:   Select end points of strokes

    Parameters:
    :   - **amount_start** (*int in* *[**0**,* *inf**]**,* *(**optional**)*) – Amount Start, Number of points to select from the start
        - **amount_end** (*int in* *[**0**,* *inf**]**,* *(**optional**)*) – Amount End, Number of points to select from the end

bpy.ops.grease_pencil.select_less()
:   Shrink the selection by one point

bpy.ops.grease_pencil.select_linked()
:   Select all points in curves with any point selection

bpy.ops.grease_pencil.select_more()
:   Grow the selection by one point

bpy.ops.grease_pencil.select_random(*\**, *ratio=0.5*, *seed=0*, *action='SELECT'*)
:   Selects random points from the current strokes selection

    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

          - `SELECT`
            Select – Select all elements.
          - `DESELECT`
            Deselect – Deselect all elements.

bpy.ops.grease_pencil.select_similar(*\**, *mode='LAYER'*, *threshold=0.1*)
:   Select all strokes with similar characteristics

    Parameters:
    :   - **mode** (enum in [`'LAYER'`, `'MATERIAL'`, `'VERTEX_COLOR'`, `'RADIUS'`, `'OPACITY'`], (optional)) – Mode
        - **threshold** (*float in* *[**0**,* *inf**]**,* *(**optional**)*) – Threshold

bpy.ops.grease_pencil.separate(*\**, *mode='SELECTED'*)
:   Separate the selected geometry into a new Grease Pencil object

    Parameters:
    :   **mode** (enum in [`'SELECTED'`, `'MATERIAL'`, `'LAYER'`], (optional)) –

        Mode

        - `SELECTED`
          Selection – Separate selected geometry.
        - `MATERIAL`
          By Material – Separate by material.
        - `LAYER`
          By Layer – Separate by layer.

bpy.ops.grease_pencil.set_active_material()
:   Set the selected stroke material as the active material

bpy.ops.grease_pencil.set_corner_type(*\**, *corner_type='SHARP'*, *miter_angle=0.785398*)
:   Set the corner type of the selected points

    Parameters:
    :   - **corner_type** (enum in [`'ROUND'`, `'FLAT'`, `'SHARP'`], (optional)) – Corner Type
        - **miter_angle** (*float in* *[**0**,* *3.14159**]**,* *(**optional**)*) – Miter Cut Angle, All corners sharper than the Miter angle will be cut flat

bpy.ops.grease_pencil.set_curve_resolution(*\**, *resolution=12*)
:   Set resolution of selected curves

    Parameters:
    :   **resolution** (*int in* *[**0**,* *10000**]**,* *(**optional**)*) – Resolution, The resolution to use for each curve segment

bpy.ops.grease_pencil.set_curve_type(*\**, *type='POLY'*, *use_handles=False*)
:   Set type of selected curves

    Parameters:
    :   - **type** (enum in [Curves Type Items](bpy_types_enum_items/curves_type_items.html#rna-enum-curves-type-items), (optional)) – Type, Curve type
        - **use_handles** (*boolean**,* *(**optional**)*) – Handles, Take handle information into account in the conversion

bpy.ops.grease_pencil.set_handle_type(*\**, *type='AUTO'*)
:   Set the handle type for Bézier curves

    Parameters:
    :   **type** (enum in [`'AUTO'`, `'VECTOR'`, `'ALIGN'`, `'FREE_ALIGN'`, `'TOGGLE_FREE_ALIGN'`], (optional)) –

        Type

        - `AUTO`
          Auto – The location is automatically calculated to be smooth.
        - `VECTOR`
          Vector – The location is calculated to point to the next/previous control point.
        - `ALIGN`
          Align – The location is constrained to point in the opposite direction as the other handle.
        - `FREE_ALIGN`
          Free – The handle can be moved anywhere, and does not influence the point’s other handle.
        - `TOGGLE_FREE_ALIGN`
          Toggle Free/Align – Replace Free handles with Align, and all Align with Free handles.

bpy.ops.grease_pencil.set_material(*\**, *slot='DEFAULT'*)
:   Set active material

    Parameters:
    :   **slot** (enum in [`'DEFAULT'`], (optional)) – Material Slot

bpy.ops.grease_pencil.set_selection_mode(*\**, *mode='POINT'*)
:   Change the selection mode for Grease Pencil strokes

    Parameters:
    :   **mode** (enum in [Grease Pencil Selectmode Items](bpy_types_enum_items/grease_pencil_selectmode_items.html#rna-enum-grease-pencil-selectmode-items), (optional)) – Mode

bpy.ops.grease_pencil.set_start_point()
:   Select which point is the beginning of the curve

bpy.ops.grease_pencil.set_uniform_opacity(*\**, *opacity_stroke=1.0*, *opacity_fill=0.5*)
:   Set all stroke points to same opacity

    Parameters:
    :   - **opacity_stroke** (*float in* *[**0**,* *1**]**,* *(**optional**)*) – Stroke Opacity
        - **opacity_fill** (*float in* *[**0**,* *1**]**,* *(**optional**)*) – Fill Opacity

bpy.ops.grease_pencil.set_uniform_thickness(*\**, *thickness=0.1*)
:   Set all stroke points to same thickness

    Parameters:
    :   **thickness** (*float in* *[**0**,* *1000**]**,* *(**optional**)*) – Thickness, Thickness

bpy.ops.grease_pencil.snap_cursor_to_selected()
:   Snap cursor to center of selected points

bpy.ops.grease_pencil.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.grease_pencil.snap_to_grid()
:   Snap selected points to the nearest grid points

bpy.ops.grease_pencil.stroke_material_set(*\**, *material=''*)
:   Assign the active material slot to the selected strokes

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

bpy.ops.grease_pencil.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.grease_pencil.stroke_reset_vertex_color(*\**, *mode='BOTH'*)
: