0
$\begingroup$

Up until Blender 4.2 I could change my brush like this:

my_brush = D.brushes['my_brush']

C.tool_settings.image_paint.brush = my_brush

Now in Blender 4.3 with the advent of the asset browser also in Brushes, I can't figure out how to change the Brush.

Any ideas? Do I have to use the bpy.ops.brush.asset_activate() operator?

To test this, do the following.

In Object mode:

enter image description here

Now set the Context object to Texture Paint mode:

enter image description here

Check the image_paint.brush:

enter image description here

$\endgroup$
1
  • $\begingroup$ I've updated my answer according to new info you've provided. $\endgroup$
    – Yaroslav
    Commented Nov 25 at 14:49

1 Answer 1

2
$\begingroup$

The problem is not related to Blender's version.

You did right actions but in the wrong order.

It should be:

  1. bpy.ops.object.mode_set(mode='TEXTURE_PAINT')
  2. my_brush = D.brushes.new("My Brush")
  3. C.tool_settings.image_paint.brush = my_brush

To summarize: you just cannot set current brush outside from Texture Paint mode.

Meantime you can create new brush from any mode you like.

Hence (1) and (2) can be swapped. But (3) ALWAYS should be the last.

$\endgroup$
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .