1
$\begingroup$

Can texture paint brushes be removed through Python ? I wanted to remove a brush of a specific name for example "Brush57". Removing it by shift clicking the x button usually sets it's user to 0 so it still remains in the memory. How am i to remove the brush from the memory/datablock ?

$\endgroup$

1 Answer 1

2
$\begingroup$

The brushes collection is available thru bpy.data.brushes Like most (maybe all) ID object collections in blender, items can be removed with collection.remove(obj).

import bpy
# get the brush
brush = bpy.data.brushes.get("Brush67")

# if brush is None well make a new one for example

if brush is None:
    brush = bpy.data.brushes.new("Brush67")

# remove the brush

bpy.data.brushes.remove(brush)
$\endgroup$
1
  • $\begingroup$ I see it worked but I wasn't clear in my question, I have edited it. Removing it usually sets the user of the brush in the data block to 0 so it still stays in the memory, I was asking how to remove it completely from the memory through Python. $\endgroup$
    – Retrax
    Commented Aug 2, 2017 at 16:54

You must log in to answer this question.

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