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

assistant: # Brush(ID)

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

*class* bpy.types.Brush(*ID*)
:   Brush data-block for storing brush settings for painting and sculpting

    area_radius_factor
    :   Ratio between the brush radius and the radius that is going to be used to sample the area center

        Type:
        :   float in [0, 2], default 0.5

    auto_smooth_factor
    :   Amount of smoothing to automatically apply to each stroke

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

    automasking_boundary_edges_propagation_steps
    :   Distance where boundary edge automasking is going to protect vertices from the fully masked edge

        Type:
        :   int in [1, 20], default 1

    automasking_cavity_blur_steps
    :   The number of times the cavity mask is blurred

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

    automasking_cavity_curve
    :   Curve used for the sensitivity

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

    automasking_cavity_factor
    :   The contrast of the cavity mask

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

    automasking_start_normal_falloff
    :   Extend the angular range with a falloff gradient

        Type:
        :   float in [0.0001, 1], default 0.25

    automasking_start_normal_limit
    :   The range of angles that will be affected

        Type:
        :   float in [0.0001, 3.14159], default 0.349066

    automasking_view_normal_falloff
    :   Extend the angular range with a falloff gradient

        Type:
        :   float in [0.0001, 1], default 0.25

    automasking_view_normal_limit
    :   The range of angles that will be affected

        Type:
        :   float in [0.0001, 3.14159], default 1.5708

    blend
    :   Brush blending mode

        - `MIX`
          Mix – Use Mix blending mode while painting.
        - `DARKEN`
          Darken – Use Darken blending mode while painting.
        - `MUL`
          Multiply – Use Multiply blending mode while painting.
        - `COLORBURN`
          Color Burn – Use Color Burn blending mode while painting.
        - `LINEARBURN`
          Linear Burn – Use Linear Burn blending mode while painting.
        - `LIGHTEN`
          Lighten – Use Lighten blending mode while painting.
        - `SCREEN`
          Screen – Use Screen blending mode while painting.
        - `COLORDODGE`
          Color Dodge – Use Color Dodge blending mode while painting.
        - `ADD`
          Add – Use Add blending mode while painting.
        - `OVERLAY`
          Overlay – Use Overlay blending mode while painting.
        - `SOFTLIGHT`
          Soft Light – Use Soft Light blending mode while painting.
        - `HARDLIGHT`
          Hard Light – Use Hard Light blending mode while painting.
        - `VIVIDLIGHT`
          Vivid Light – Use Vivid Light blending mode while painting.
        - `LINEARLIGHT`
          Linear Light – Use Linear Light blending mode while painting.
        - `PINLIGHT`
          Pin Light – Use Pin Light blending mode while painting.
        - `DIFFERENCE`
          Difference – Use Difference blending mode while painting.
        - `EXCLUSION`
          Exclusion – Use Exclusion blending mode while painting.
        - `SUB`
          Subtract – Use Subtract blending mode while painting.
        - `HUE`
          Hue – Use Hue blending mode while painting.
        - `SATURATION`
          Saturation – Use Saturation blending mode while painting.
        - `COLOR`
          Color – Use Color blending mode while painting.
        - `LUMINOSITY`
          Value – Use Value blending mode while painting.
        - `ERASE_ALPHA`
          Erase Alpha – Erase alpha while painting.
        - `ADD_ALPHA`
          Add Alpha – Add alpha while painting.

        Type:
        :   enum in [`'MIX'`, `'DARKEN'`, `'MUL'`, `'COLORBURN'`, `'LINEARBURN'`, `'LIGHTEN'`, `'SCREEN'`, `'COLORDODGE'`, `'ADD'`, `'OVERLAY'`, `'SOFTLIGHT'`, `'HARDLIGHT'`, `'VIVIDLIGHT'`, `'LINEARLIGHT'`, `'PINLIGHT'`, `'DIFFERENCE'`, `'EXCLUSION'`, `'SUB'`, `'HUE'`, `'SATURATION'`, `'COLOR'`, `'LUMINOSITY'`, `'ERASE_ALPHA'`, `'ADD_ALPHA'`], default `'MIX'`

    blur_kernel_radius
    :   Radius of kernel used for soften and sharpen in pixels

        Type:
        :   int in [1, 10000], default 2

    blur_mode
    :   Type:
        :   enum in [`'BOX'`, `'GAUSSIAN'`], default `'GAUSSIAN'`

    boundary_deform_type
    :   Deformation type that is used in the brush

        Type:
        :   enum in [`'BEND'`, `'EXPAND'`, `'INFLATE'`, `'GRAB'`, `'TWIST'`, `'SMOOTH'`], default `'BEND'`

    boundary_falloff_type
    :   How the brush falloff is applied across the boundary

        - `CONSTANT`
          Constant – Applies the same deformation in the entire boundary.
        - `RADIUS`
          Brush Radius – Applies the deformation in a localized area limited by the brush radius.
        - `LOOP`
          Loop – Applies the brush falloff in a loop pattern.
        - `LOOP_INVERT`
          Loop and Invert – Applies the falloff radius in a loop pattern, inverting the displacement direction in each pattern repetition.

        Type:
        :   enum in [`'CONSTANT'`, `'RADIUS'`, `'LOOP'`, `'LOOP_INVERT'`], default `'CONSTANT'`

    boundary_offset
    :   Offset of the boundary origin in relation to the brush radius

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

    brush_capabilities
    :   Brush’s capabilities

        Type:
        :   [`BrushCapabilities`](bpy.types.BrushCapabilities.html#bpy.types.BrushCapabilities "bpy.types.BrushCapabilities"), (readonly, never None)

    cloth_constraint_softbody_strength
    :   How much the cloth preserves the original shape, acting as a soft body

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

    cloth_damping
    :   How much the applied forces are propagated through the cloth

        Type:
        :   float in [0.01, 1], default 0.01

    cloth_deform_type
    :   Deformation type that is used in the brush

        Type:
        :   enum in [`'DRAG'`, `'PUSH'`, `'PINCH_POINT'`, `'PINCH_PERPENDICULAR'`, `'INFLATE'`, `'GRAB'`, `'EXPAND'`, `'SNAKE_HOOK'`], default `'DRAG'`

    cloth_force_falloff_type
    :   Shape used in the brush to apply force to the cloth

        Type:
        :   enum in [`'RADIAL'`, `'PLANE'`], default `'RADIAL'`

    cloth_mass
    :   Mass of each simulation particle

        Type:
        :   float in [0.01, 2], default 1.0

    cloth_sim_falloff
    :   Area to apply deformation falloff to the effects of the simulation

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

    cloth_sim_limit
    :   Factor added relative to the size of the radius to limit the cloth simulation effects

        Type:
        :   float in [0.1, 10], default 2.5

    cloth_simulation_area_type
    :   Part of the mesh that is going to be simulated when the stroke is active

        - `LOCAL`
          Local – Simulates only a specific area around the brush limited by a fixed radius.
        - `GLOBAL`
          Global – Simulates the entire mesh.
        - `DYNAMIC`
          Dynamic – The active simulation area moves with the brush.

        Type:
        :   enum in [`'LOCAL'`, `'GLOBAL'`, `'DYNAMIC'`], default `'LOCAL'`

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

    color_type
    :   Use single color or gradient when painting

        - `COLOR`
          Color – Paint with a single color.
        - `GRADIENT`
          Gradient – Paint with a gradient.

        Type:
        :   enum in [`'COLOR'`, `'GRADIENT'`], default `'COLOR'`

    crease_pinch_factor
    :   How much the crease brush pinches

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

    cursor_color_add
    :   Color of cursor when adding

        Type:
        :   float array of 4 items in [0, inf], default (1.0, 0.39, 0.39, 0.9)

    cursor_color_subtract
    :   Color of cursor when subtracting

        Type:
        :   float array of 4 items in [0, inf], default (0.39, 0.39, 1.0, 0.9)

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

    curve_distance_falloff
    :   Editable falloff curve

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

    curve_distance_falloff_preset
    :   Type:
        :   enum in [Brush Curve Preset Items](bpy_types_enum_items/brush_curve_preset_items.html#rna-enum-brush-curve-preset-items), default `'CUSTOM'`

    curve_jitter
    :   Curve used to map pressure to brush jitter

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

    curve_random_hue
    :   Curve used for modulating effect

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

    curve_random_saturation
    :   Curve used for modulating effect

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

    curve_random_value
    :   Curve used for modulating effect

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

    curve_size
    :   Curve used to map pressure to brush size

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

    curve_strength
    :   Curve used to map pressure to brush strength

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

    curves_sculpt_brush_type
    :   Type:
        :   enum in [Brush Curves Sculpt Brush Type Items](bpy_types_enum_items/brush_curves_sculpt_brush_type_items.html#rna-enum-brush-curves-sculpt-brush-type-items), default `'COMB'`

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

    dash_ratio
    :   Ratio of samples in a cycle that the brush is enabled

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

    dash_samples
    :   Length of a dash cycle measured in stroke samples

        Type:
        :   int in [1, 10000], default 20

    deform_target
    :   How the deformation of the brush will affect the object

        - `GEOMETRY`
          Geometry – Brush deformation displaces the vertices of the mesh.
        - `CLOTH_SIM`
          Cloth Simulation – Brush deforms the mesh by deforming the constraints of a cloth simulation.

        Type:
        :   enum in [`'GEOMETRY'`, `'CLOTH_SIM'`], default `'GEOMETRY'`

    density
    :   Amount of random elements that are going to be affected by the brush

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

    direction
    :   - `ADD`
          Add – Add effect of brush.
        - `SUBTRACT`
          Subtract – Subtract effect of brush.

        Type:
        :   enum in [`'ADD'`, `'SUBTRACT'`], default `'ADD'`

    disconnected_distance_max
    :   Maximum distance to search for disconnected loose parts in the mesh

        Type:
        :   float in [0, 10], default 0.1

    elastic_deform_type
    :   Deformation type that is used in the brush

        Type:
        :   enum in [`'GRAB'`, `'GRAB_BISCALE'`, `'GRAB_TRISCALE'`, `'SCALE'`, `'TWIST'`], default `'GRAB'`

    elastic_deform_volume_preservation
    :   Poisson ratio for elastic deformation. Higher values preserve volume more, but also lead to more bulging.

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

    falloff_angle
    :   Paint most on faces pointing towards the view according to this angle

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

    falloff_shape
    :   Use projected or spherical falloff

        - `SPHERE`
          Sphere – Apply brush influence in a Sphere, outwards from the center.
        - `PROJECTED`
          Projected – Apply brush influence in a 2D circle, projected from the view.

        Type:
        :   enum in [`'SPHERE'`, `'PROJECTED'`], default `'SPHERE'`

    fill_threshold
    :   Threshold above which filling is not propagated

        Type:
        :   float in [0, 100], default 0.2

    flow
    :   Amount of paint that is applied per stroke sample

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

    gpencil_brush_type
    :   Type:
        :   enum in [Brush Gpencil Types Items](bpy_types_enum_items/brush_gpencil_types_items.html#rna-enum-brush-gpencil-types-items), default `'DRAW'`

    gpencil_sculpt_brush_type
    :   Type:
        :   enum in [Brush Gpencil Sculpt Types Items](bpy_types_enum_items/brush_gpencil_sculpt_types_items.html#rna-enum-brush-gpencil-sculpt-types-items), default `'SMOOTH'`

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

    gpencil_vertex_brush_type
    :   Type:
        :   enum in [Brush Gpencil Vertex Types Items](bpy_types_enum_items/brush_gpencil_vertex_types_items.html#rna-enum-brush-gpencil-vertex-types-items), default `'DRAW'`

    gpencil_weight_brush_type
    :   Type:
        :   enum in [Brush Gpencil Weight Types Items](bpy_types_enum_items/brush_gpencil_weight_types_items.html#rna-enum-brush-gpencil-weight-types-items), default `'WEIGHT'`

    grad_spacing
    :   Spacing before brush gradient goes full circle

        Type:
        :   int in [1, 10000], default 0

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

    gradient_fill_mode
    :   Type:
        :   enum in [`'LINEAR'`, `'RADIAL'`], default `'LINEAR'`

    gradient_stroke_mode
    :   Type:
        :   enum in [`'PRESSURE'`, `'SPACING_REPEAT'`, `'SPACING_CLAMP'`], default `'PRESSURE'`

    hardness
    :   How close the brush falloff starts from the edge of the brush

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

    has_unsaved_changes
    :   Indicates that there are any user visible changes since the brush has been imported or read from the file

        Type:
        :   boolean, default False, (readonly)

    height
    :   Affectable height of brush (i.e. the layer height for the layer tool)

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

    hue_jitter
    :   Color jitter effect on hue

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

    image_brush_type
    :   Type:
        :   enum in [Brush Image Brush Type Items](bpy_types_enum_items/brush_image_brush_type_items.html#rna-enum-brush-image-brush-type-items), default `'DRAW'`

    image_paint_capabilities
    :   Type:
        :   [`BrushCapabilitiesImagePaint`](bpy.types.BrushCapabilitiesImagePaint.html#bpy.types.BrushCapabilitiesImagePaint "bpy.types.BrushCapabilitiesImagePaint"), (readonly, never None)

    input_samples
    :   Number of input samples to average together to smooth the brush stroke

        Type:
        :   int in [1, 64], default 1

    invert_density_pressure
    :   Invert the modulation of pressure in density

        Type:
        :   boolean, default False

    invert_flow_pressure
    :   Invert the modulation of pressure in flow

        Type:
        :   boolean, default False

    invert_hardness_pressure
    :   Invert the modulation of pressure in hardness

        Type:
        :   boolean, default False

    invert_to_scrape_fill
    :   Use Scrape or Fill brush when inverting this brush instead of inverting its displacement direction

        Type:
        :   boolean, default False

    invert_wet_mix_pressure
    :   Invert the modulation of pressure in wet mix

        Type:
        :   boolean, default False

    invert_wet_persistence_pressure
    :   Invert the modulation of pressure in wet persistence

        Type:
        :   boolean, default False

    jitter
    :   Jitter the position of the brush while painting

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

    jitter_absolute
    :   Jitter the position of the brush in pixels while painting

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

    jitter_unit
    :   Jitter in screen space or relative to brush size

        - `VIEW`
          View – Jittering happens in screen space, in pixels.
        - `BRUSH`
          Brush – Jittering happens relative to the brush size.

        Type:
        :   enum in [`'VIEW'`, `'BRUSH'`], default `'VIEW'`

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

    mask_stencil_dimension
    :   Dimensions of mask stencil in viewport

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

    mask_stencil_pos
    :   Position of mask stencil in viewport

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

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

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

    mask_tool
    :   Type:
        :   enum in [`'DRAW'`, `'SMOOTH'`], default `'DRAW'`

    multiplane_scrape_angle
    :   Angle between the planes of the crease

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

    normal_