user: How do I use GreasePencilLayer(GreasePencilTreeNode) in Blender? Include parameters, examples, warnings and best practices.

assistant: # GreasePencilLayer(GreasePencilTreeNode)

base classes — [`bpy_struct`](bpy.types.bpy_struct.html#bpy.types.bpy_struct "bpy.types.bpy_struct"), [`GreasePencilTreeNode`](bpy.types.GreasePencilTreeNode.html#bpy.types.GreasePencilTreeNode "bpy.types.GreasePencilTreeNode")

*class* bpy.types.GreasePencilLayer(*GreasePencilTreeNode*)
:   Collection of related drawings

    blend_mode
    :   Blend mode

        Type:
        :   enum in [`'REGULAR'`, `'HARDLIGHT'`, `'ADD'`, `'SUBTRACT'`, `'MULTIPLY'`, `'DIVIDE'`], default `'REGULAR'`

    frames
    :   Grease Pencil frames

        Type:
        :   [`GreasePencilFrames`](bpy.types.GreasePencilFrames.html#bpy.types.GreasePencilFrames "bpy.types.GreasePencilFrames") [`bpy_prop_collection`](bpy.types.bpy_prop_collection.html#bpy.types.bpy_prop_collection "bpy.types.bpy_prop_collection") of [`GreasePencilFrame`](bpy.types.GreasePencilFrame.html#bpy.types.GreasePencilFrame "bpy.types.GreasePencilFrame"), (readonly)

    ignore_locked_materials
    :   Allow editing strokes even if they use locked materials

        Type:
        :   boolean, default False

    lock_frame
    :   Lock current frame displayed by layer

        Type:
        :   boolean, default False

    mask_layers
    :   List of Masking Layers

        Type:
        :   [`GreasePencilLayerMasks`](bpy.types.GreasePencilLayerMasks.html#bpy.types.GreasePencilLayerMasks "bpy.types.GreasePencilLayerMasks") [`bpy_prop_collection`](bpy.types.bpy_prop_collection.html#bpy.types.bpy_prop_collection "bpy.types.bpy_prop_collection") of [`GreasePencilLayerMask`](bpy.types.GreasePencilLayerMask.html#bpy.types.GreasePencilLayerMask "bpy.types.GreasePencilLayerMask"), (readonly)

    matrix_local
    :   Local transformation matrix of the layer

        Type:
        :   [`mathutils.Matrix`](mathutils.html#mathutils.Matrix "mathutils.Matrix") of 4 \* 4 items in [-inf, inf], default ((0.0, 0.0, 0.0, 0.0), (0.0, 0.0, 0.0, 0.0), (0.0, 0.0, 0.0, 0.0), (0.0, 0.0, 0.0, 0.0)), (readonly)

    matrix_parent_inverse
    :   Inverse of layer’s parent transformation matrix

        Type:
        :   [`mathutils.Matrix`](mathutils.html#mathutils.Matrix "mathutils.Matrix") of 4 \* 4 items in [-inf, inf], default ((0.0, 0.0, 0.0, 0.0), (0.0, 0.0, 0.0, 0.0), (0.0, 0.0, 0.0, 0.0), (0.0, 0.0, 0.0, 0.0)), (readonly)

    opacity
    :   Layer Opacity

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

    parent
    :   Parent object

        Type:
        :   [`Object`](bpy.types.Object.html#bpy.types.Object "bpy.types.Object")

    parent_bone
    :   Name of parent bone. Only used when the parent object is an armature.

        Type:
        :   string, default “”, (never None)

    pass_index
    :   Index number for the “Layer Index” pass

        Type:
        :   int in [0, inf], default 0

    radius_offset
    :   Radius change to apply to current strokes

        Type:
        :   float in [-inf, inf], default 0.0

    rotation
    :   Euler rotation of the layer

        Type:
        :   [`mathutils.Euler`](mathutils.html#mathutils.Euler "mathutils.Euler") rotation of 3 items in [-inf, inf], default (0.0, 0.0, 0.0)

    scale
    :   Scale of the layer

        Type:
        :   [`mathutils.Vector`](mathutils.html#mathutils.Vector "mathutils.Vector") of 3 items in [-inf, inf], default (1.0, 1.0, 1.0)

    tint_color
    :   Color for tinting stroke colors

        Type:
        :   [`mathutils.Color`](mathutils.html#mathutils.Color "mathutils.Color") of 3 items in [0, 1], default (0.0, 0.0, 0.0)

    tint_factor
    :   Factor of tinting color

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

    translation
    :   Translation of the layer

        Type:
        :   [`mathutils.Vector`](mathutils.html#mathutils.Vector "mathutils.Vector") of 3 items in [-inf, inf], default (0.0, 0.0, 0.0)

    use_lights
    :   Enable the use of lights on stroke and fill materials

        Type:
        :   boolean, default False

    use_viewlayer_masks
    :   Include the mask layers when rendering the view-layer

        Type:
        :   boolean, default False

    viewlayer_render
    :   Only include Layer in this View Layer render output (leave blank to include always)

        Type:
        :   string, default “”, (never None)

    get_frame_at(*frame_number*)
    :   Get the frame at given frame number

        Parameters:
        :   **frame_number** (*int in* *[**-1048574**,* *1048574**]*) – Frame Number

        Returns:
        :   Frame

        Return type:
        :   [`GreasePencilFrame`](bpy.types.GreasePencilFrame.html#bpy.types.GreasePencilFrame "bpy.types.GreasePencilFrame")

    current_frame()
    :   The Grease Pencil frame at the current scene time on this layer

        Return type:
        :   [`GreasePencilFrame`](bpy.types.GreasePencilFrame.html#bpy.types.GreasePencilFrame "bpy.types.GreasePencilFrame")

    *classmethod* bl_rna_get_subclass(*id*, *default=None*, */*)
    :   Parameters:
        :   **id** (*str*) – The RNA type identifier.

        Returns:
        :   The RNA type or default when not found.

        Return type:
        :   [`bpy.types.Struct`](bpy.types.Struct.html#bpy.types.Struct "bpy.types.Struct") subclass

    *classmethod* bl_rna_get_subclass_py(*id*, *default=None*, */*)
    :   Parameters:
        :   **id** (*str*) – The RNA type identifier.

        Returns:
        :   The class or default when not found.

        Return type:
        :   type