Page MenuHome

Deleting Linked Libraries with Python
ClosedPublic

Authored by Simone Barbieri (s.barbieri) on Jun 11 2020, 3:55 PM.

Details

Summary

At the moment, the only way to delete a linked library is with an outliner operation, which can be executed only if the library is selected in the outliner. There is no way to delete a linked library with Python.

I've created a function to delete linked libraries with Python. I couldn't name it delete so I named it remove.

Its behaviour is similar to the reload operation. For example, supposing to have a linked library C:/library.blend, to delete it with python you would need to use the following code:

bpy.data.libraries['C:/library.blend'].remove()

Diff Detail

Repository
rB Blender

Event Timeline

Simone Barbieri (s.barbieri) requested review of this revision.Jun 11 2020, 3:55 PM
Simone Barbieri (s.barbieri) created this revision.
Bastien Montagne (mont29) requested changes to this revision.Jun 11 2020, 4:54 PM

There is no reason to add a new function for that, just use rna_Main_ID_remove like for all other ID types?

This revision now requires changes to proceed.Jun 11 2020, 4:54 PM

You are right! Thanks for the suggestion! Indeed it makes more sense! I've updated the diff.

thanks, was missing indeed. Will commit soon.

This revision is now accepted and ready to land.Jun 11 2020, 5:36 PM