Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <b.mont29@gmail.com>2020-03-06 13:27:29 +0300
committerBastien Montagne <b.mont29@gmail.com>2020-03-06 13:27:54 +0300
commit17e1fef85aa45f95d2e7c872901ca1c6140fad73 (patch)
tree7a5e4ef8df279ff660012000be19631ccebb941c /source/blender/blenkernel
parentc25f6e998bd98533c4a818310dbf5f24f01d221b (diff)
Cleanup: Library: Move to IDTypeInfo, and remove unused BKE API.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/BKE_idtype.h1
-rw-r--r--source/blender/blenkernel/BKE_library.h2
-rw-r--r--source/blender/blenkernel/intern/idtype.c1
-rw-r--r--source/blender/blenkernel/intern/lib_id_delete.c2
-rw-r--r--source/blender/blenkernel/intern/library.c26
5 files changed, 26 insertions, 6 deletions
diff --git a/source/blender/blenkernel/BKE_idtype.h b/source/blender/blenkernel/BKE_idtype.h
index 84412942e9a..2e8b39c938c 100644
--- a/source/blender/blenkernel/BKE_idtype.h
+++ b/source/blender/blenkernel/BKE_idtype.h
@@ -125,6 +125,7 @@ typedef struct IDTypeInfo {
/* Those are defined in the respective BKE files. */
extern IDTypeInfo IDType_ID_SCE;
+extern IDTypeInfo IDType_ID_LI;
extern IDTypeInfo IDType_ID_OB;
/* ********** Helpers/Utils API. ********** */
diff --git a/source/blender/blenkernel/BKE_library.h b/source/blender/blenkernel/BKE_library.h
index 1324e4ebf90..5bc3d50bf8d 100644
--- a/source/blender/blenkernel/BKE_library.h
+++ b/source/blender/blenkernel/BKE_library.h
@@ -34,8 +34,6 @@ extern "C" {
struct Library;
struct Main;
-void BKE_library_free(struct Library *lib);
-
void BKE_library_filepath_set(struct Main *bmain, struct Library *lib, const char *filepath);
#ifdef __cplusplus
diff --git a/source/blender/blenkernel/intern/idtype.c b/source/blender/blenkernel/intern/idtype.c
index 6161e41db4e..1453234d577 100644
--- a/source/blender/blenkernel/intern/idtype.c
+++ b/source/blender/blenkernel/intern/idtype.c
@@ -52,6 +52,7 @@ static void id_type_init(void)
(void)0
INIT_TYPE(ID_SCE);
+ INIT_TYPE(ID_LI);
INIT_TYPE(ID_OB);
#undef INIT_TYPE
diff --git a/source/blender/blenkernel/intern/lib_id_delete.c b/source/blender/blenkernel/intern/lib_id_delete.c
index 77ab4d1eb2a..e311dd2ef03 100644
--- a/source/blender/blenkernel/intern/lib_id_delete.c
+++ b/source/blender/blenkernel/intern/lib_id_delete.c
@@ -140,7 +140,7 @@ void BKE_libblock_free_datablock(ID *id, const int UNUSED(flag))
BLI_assert(0);
break;
case ID_LI:
- BKE_library_free((Library *)id);
+ BLI_assert(0);
break;
case ID_OB:
BLI_assert(0);
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