# GreasePencil(ID)

base classes — `bpy_struct`, `ID`

class `bpy.types.``GreasePencil`(ID)

  Freehand annotation sketchbook

  `after_color`

    Base color for ghosts after the active frame

    Type: | float array of 3 items in [0, 1], default (0.12549, 0.082353, 0.529412)

  `animation_data`

    Animation data for this data-block

    Type: | `AnimData`, (readonly)

  `before_color`

    Base color for ghosts before the active frame

    Type: | float array of 3 items in [0, 1], default (0.145098, 0.419608, 0.137255)

  `edit_line_color`

    Color for editing line

    Type: | float array of 4 items in [0, 1], default (0.6, 0.6, 0.6, 0.5)

  `ghost_after_range`

    Maximum number of frames to show after current frame (0 = don’t show any frames after current)

    Type: | int in [0, 120], default 1

  `ghost_before_range`

    Maximum number of frames to show before current frame (0 = don’t show any frames before current)

    Type: | int in [0, 120], default 1

  `grid`

    Settings for grid and canvas in the 3D viewport

    Type: | `GreasePencilGrid`, (readonly, never None)

  `is_annotation`

    Current datablock is an annotation

    Type: | boolean, default False, (readonly)

  `is_stroke_paint_mode`

    Draw Grease Pencil strokes on click/drag

    Type: | boolean, default False, (readonly)

  `is_stroke_sculpt_mode`

    Sculpt Grease Pencil strokes instead of viewport data

    Type: | boolean, default False, (readonly)

  `is_stroke_weight_mode`

    Grease Pencil weight paint

    Type: | boolean, default False, (readonly)

  `layers`

    Type: | `GreasePencilLayers` `bpy_prop_collection` of `GPencilLayer`, (readonly)

  `materials`

    Type: | `IDMaterials` `bpy_prop_collection` of `Material`, (readonly)

  `onion_factor`

    Change fade opacity of displayed onion frames

    Type: | float in [0, 1], default 0.5

  `onion_keyframe_type`

    Type of keyframe (for filtering)

    - `ALL` All Types, Include all Keyframe types.
    - `KEYFRAME` Keyframe, Normal keyframe - e.g. for key poses.
    - `BREAKDOWN` Breakdown, A breakdown pose - e.g. for transitions between key poses.
    - `MOVING_HOLD` Moving Hold, A keyframe that is part of a moving hold.
    - `EXTREME` Extreme, An ‘extreme’ pose, or some other purpose as needed.
    - `JITTER` Jitter, A filler or baked keyframe for keying on ones, or some other purpose as needed.

    Type: | enum in [‘ALL’, ‘KEYFRAME’, ‘BREAKDOWN’, ‘MOVING_HOLD’, ‘EXTREME’, ‘JITTER’], default ‘KEYFRAME’

  `onion_mode`

    Mode to display frames

    - `ABSOLUTE` Frames, Frames in absolute range of the scene frame.
    - `RELATIVE` Keyframes, Frames in relative range of the Grease Pencil keyframes.
    - `SELECTED` Selected, Only selected keyframes.

    Type: | enum in [‘ABSOLUTE’, ‘RELATIVE’, ‘SELECTED’], default ‘ABSOLUTE’

  `pixel_factor`

    Scale conversion factor for pixel size (use larger values for thicker lines)

    Type: | float in [0.1, 30], default 0.0

  `show_stroke_direction`

    Show stroke drawing direction with a bigger green dot (start) and smaller red dot (end) points

    Type: | boolean, default False

  `stroke_depth_order`

    Defines how the strokes are ordered in 3D space

    - `2D` 2D Layers, Display strokes using grease pencil layers to define order.
    - `3D` 3D Location, Display strokes using real 3D position in 3D space.

    Type: | enum in [‘2D’, ‘3D’], default ‘2D’

  `stroke_thickness_space`

    Set stroke thickness in screen space or world space

    - `WORLDSPACE` World Space, Set stroke thickness relative to the world space.
    - `SCREENSPACE` Screen Space, Set stroke thickness relative to the screen space.

    Type: | enum in [‘WORLDSPACE’, ‘SCREENSPACE’], default ‘WORLDSPACE’

  `use_adaptive_uv`

    Automatic UVs are calculated depending of the stroke size

    Type: | boolean, default False

  `use_autolock_layers`

    Lock automatically all layers except active one to avoid accidental changes

    Type: | boolean, default False

  `use_force_fill_recalc`

    Force recalc of fill data after use deformation modifiers (reduce FPS)

    Type: | boolean, default False

  `use_ghost_custom_colors`

    Use custom colors for ghost frames

    Type: | boolean, default False

  `use_ghosts_always`

    Ghosts are shown in renders and animation playback. Useful for special effects (e.g. motion blur)

    Type: | boolean, default False

  `use_multiedit`

    Edit strokes from multiple grease pencil keyframes at the same time (keyframes must be selected to be included)

    Type: | boolean, default False

  `use_onion_fade`

    Display onion keyframes with a fade in color transparency

    Type: | boolean, default False

  `use_onion_loop`

    Display first onion keyframes using next frame color to show indication of loop start frame

    Type: | boolean, default False

  `use_onion_skinning`

    Show ghosts of the keyframes before and after the current frame

    Type: | boolean, default True

  `use_stroke_edit_mode`

    Edit Grease Pencil strokes instead of viewport data

    Type: | boolean, default False

  `zdepth_offset`

    Offset amount when drawing in surface mode

    Type: | float in [0, 1], default 0.0

  `clear`()

    Remove all the Grease Pencil data

  classmethod `bl_rna_get_subclass`(id, default=None)

    Parameters: | id (string) – The RNA type identifier.
    Returns: | The RNA type or default when not found.
    Return type: | `bpy.types.Struct` subclass

  classmethod `bl_rna_get_subclass_py`(id, default=None)

    Parameters: | id (string) – The RNA type identifier.
    Returns: | The class or default when not found.
    Return type: | type

Inherited Properties

`bpy_struct.id_data` `ID.name` `ID.name_full` `ID.is_evaluated` `ID.original` `ID.users` | `ID.use_fake_user` `ID.tag` `ID.is_library_indirect` `ID.library` `ID.override_library` `ID.preview`

Inherited Functions

`bpy_struct.as_pointer` `bpy_struct.driver_add` `bpy_struct.driver_remove` `bpy_struct.get` `bpy_struct.is_property_hidden` `bpy_struct.is_property_overridable_library` `bpy_struct.is_property_readonly` `bpy_struct.is_property_set` `bpy_struct.items` `bpy_struct.keyframe_delete` `bpy_struct.keyframe_insert` `bpy_struct.keys` `bpy_struct.path_from_id` `bpy_struct.path_resolve` `bpy_struct.pop` | `bpy_struct.property_overridable_library_set` `bpy_struct.property_unset` `bpy_struct.type_recast` `bpy_struct.values` `ID.evaluated_get` `ID.copy` `ID.override_create` `ID.user_clear` `ID.user_remap` `ID.make_local` `ID.user_of_id` `ID.animation_data_create` `ID.animation_data_clear` `ID.update_tag`

References

`bpy.context.annotation_data` `bpy.context.gpencil` `bpy.context.gpencil_data` `BlendData.grease_pencils` `BlendDataGreasePencils.new` `BlendDataGreasePencils.remove` | `MovieClip.grease_pencil` `MovieTrackingTrack.grease_pencil` `NodeTree.grease_pencil` `Scene.grease_pencil` `SpaceImageEditor.grease_pencil` `SpaceSequenceEditor.grease_pencil`