Cleanup: Library: Move to IDTypeInfo, and remove unused BKE API.
This commit is contained in:
parent
c25f6e998b
commit
17e1fef85a
|
@ -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. ********** */
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue