From 17e1fef85aa45f95d2e7c872901ca1c6140fad73 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Fri, 6 Mar 2020 11:27:29 +0100 Subject: Cleanup: Library: Move to IDTypeInfo, and remove unused BKE API. --- source/blender/blenkernel/intern/library.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to 'source/blender/blenkernel/intern/library.c') diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index 376d5aacbf5..e3ed21aa536 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -34,6 +34,9 @@ #include "BLI_blenlib.h" +#include "BLT_translation.h" + +#include "BKE_idtype.h" #include "BKE_lib_id.h" #include "BKE_library.h" #include "BKE_main.h" @@ -42,13 +45,30 @@ /* Unused currently. */ // static CLG_LogRef LOG = {.identifier = "bke.library"}; -void BKE_library_free(Library *lib) +static void library_free_data(ID *id) { - if (lib->packedfile) { - BKE_packedfile_free(lib->packedfile); + Library *library = (Library *)id; + if (library->packedfile) { + BKE_packedfile_free(library->packedfile); } } +IDTypeInfo IDType_ID_LI = { + .id_code = ID_LI, + .id_filter = 0, + .main_listbase_index = INDEX_ID_LI, + .struct_size = sizeof(Library), + .name = "Library", + .name_plural = "libraries", + .translation_context = BLT_I18NCONTEXT_ID_LIBRARY, + .flags = IDTYPE_FLAGS_NO_COPY | IDTYPE_FLAGS_NO_LIBLINKING | IDTYPE_FLAGS_NO_MAKELOCAL, + + .init_data = NULL, + .copy_data = NULL, + .free_data = library_free_data, + .make_local = NULL, +}; + void BKE_library_filepath_set(Main *bmain, Library *lib, const char *filepath) { /* in some cases this is used to update the absolute path from the -- cgit v1.2.3