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$
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)
| improve this answer | |
$\endgroup$
  • $\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 Aug 2 '17 at 16:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.