user: Show practical ways to work with GreasePencilOpacityModifier(Modifier) in a Blender add-on or script – include code.

assistant: # GreasePencilOpacityModifier(Modifier)

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

*class* bpy.types.GreasePencilOpacityModifier(*Modifier*)
:   color_factor
    :   Factor of opacity

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

    color_mode
    :   Attributes to modify

        - `BOTH`
          Stroke & Fill – Modify fill and stroke colors.
        - `STROKE`
          Stroke – Modify stroke color only.
        - `FILL`
          Fill – Modify fill color only.
        - `HARDNESS`
          Hardness – Modify stroke hardness.

        Type:
        :   enum in [`'BOTH'`, `'STROKE'`, `'FILL'`, `'HARDNESS'`], default `'BOTH'`

    custom_curve
    :   Custom curve to apply effect

        Type:
        :   [`CurveMapping`](bpy.types.CurveMapping.html#bpy.types.CurveMapping "bpy.types.CurveMapping"), (readonly)

    hardness_factor
    :   Factor of stroke hardness

        Type:
        :   float in [0, inf], default 1.0

    invert_layer_filter
    :   Invert layer filter

        Type:
        :   boolean, default False

    invert_layer_pass_filter
    :   Invert layer pass filter

        Type:
        :   boolean, default False

    invert_material_filter
    :   Invert material filter

        Type:
        :   boolean, default False

    invert_material_pass_filter
    :   Invert material pass filter

        Type:
        :   boolean, default False

    invert_vertex_group
    :   Invert vertex group weights

        Type:
        :   boolean, default False

    layer_pass_filter
    :   Layer pass filter

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

    material_filter
    :   Material used for filtering

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

    material_pass_filter
    :   Material pass

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

    open_influence_panel
    :   Type:
        :   boolean, default False

    tree_node_filter
    :   Layer name

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

    use_custom_curve
    :   Use a custom curve to define a factor along the strokes

        Type:
        :   boolean, default False

    use_layer_group_filter
    :   Filter by layer group name

        Type:
        :   boolean, default False

    use_layer_pass_filter
    :   Use layer pass filter

        Type:
        :   boolean, default False

    use_material_pass_filter
    :   Use material pass filter

        Type:
        :   boolean, default False

    use_uniform_opacity
    :   Replace the stroke opacity instead of modulating each point

        Type:
        :   boolean, default False

    use_weight_as_factor
    :   Use vertex group weight as factor instead of influence

        Type:
        :   boolean, default False

    vertex_group_name
    :   Vertex group name for modulating the deform

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

    *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