how to add "unlink" operator ?

properties_material.py (Material Properties) & space_image.py (UV/Image editor) not have unlink operator like space_text.py (text editor)… how to add unlink operator for Material Properties & UV/Image editor ?

Attachments


In UI, an unlink-button is available although there isn’t an unlink-operator. Unlinking materials can be problematic, you can do:

bpy.data.materials.remove(mat)

but you need to users_clear() that material before. But this can make blender crash afterwards, you actually need to remove all references to this material before clearing users.

maybe ask the devs why the unlink-button isn’t an operator.

thanks for replied.

maybe ask the devs why the unlink-button isn’t an operator.

oke,