IDTypeInfo: add .blend file io callbacks
This is part of T76372. It adds the `blend_write`, `blend_read_data`, `blend_read_lib` and `blend_read_expand` which correspond to the various steps when reading and writing .blend files. Having these callbacks allows us to decentralize the blenloader code a lot more. This has the affect that code related to any specific ID type is less scattered. Reviewers: mont29 Differential Revision: https://developer.blender.org/D8670
This commit is contained in:
parent
346023b457
commit
a443287908
|
@ -34,6 +34,10 @@ extern "C" {
|
|||
struct ID;
|
||||
struct LibraryForeachIDData;
|
||||
struct Main;
|
||||
struct BlendWriter;
|
||||
struct BlendDataReader;
|
||||
struct BlendLibReader;
|
||||
struct BlendExpander;
|
||||
|
||||
/** IDTypeInfo.flags. */
|
||||
enum {
|
||||
|
@ -89,6 +93,13 @@ typedef void (*IDTypeForeachCacheFunction)(struct ID *id,
|
|||
IDTypeForeachCacheFunctionCallback function_callback,
|
||||
void *user_data);
|
||||
|
||||
typedef void (*IDTypeBlendWriteFunction)(struct BlendWriter *writer,
|
||||
struct ID *id,
|
||||
const void *id_address);
|
||||
typedef void (*IDTypeBlendReadDataFunction)(struct BlendDataReader *reader, struct ID *id);
|
||||
typedef void (*IDTypeBlendReadLibFunction)(struct BlendLibReader *reader, struct ID *id);
|
||||
typedef void (*IDTypeBlendReadExpandFunction)(struct BlendExpander *expander, struct ID *id);
|
||||
|
||||
typedef struct IDTypeInfo {
|
||||
/* ********** General IDType data. ********** */
|
||||
|
||||
|
@ -161,6 +172,26 @@ typedef struct IDTypeInfo {
|
|||
* Iterator over all cache pointers of given ID.
|
||||
*/
|
||||
IDTypeForeachCacheFunction foreach_cache;
|
||||
|
||||
/**
|
||||
* Write all structs that should be saved in a .blend file.
|
||||
*/
|
||||
IDTypeBlendWriteFunction blend_write;
|
||||
|
||||
/**
|
||||
* Update pointers for all structs directly owned by this data block.
|
||||
*/
|
||||
IDTypeBlendReadDataFunction blend_read_data;
|
||||
|
||||
/**
|
||||
* Update pointers to other id data blocks.
|
||||
*/
|
||||
IDTypeBlendReadLibFunction blend_read_lib;
|
||||
|
||||
/**
|
||||
* Specify which other id data blocks should be loaded when the current one is loaded.
|
||||
*/
|
||||
IDTypeBlendReadExpandFunction blend_read_expand;
|
||||
} IDTypeInfo;
|
||||
|
||||
/* ********** Declaration of each IDTypeInfo. ********** */
|
||||
|
|
|
@ -184,6 +184,12 @@ IDTypeInfo IDType_ID_AC = {
|
|||
.free_data = action_free_data,
|
||||
.make_local = NULL,
|
||||
.foreach_id = action_foreach_id,
|
||||
.foreach_cache = NULL,
|
||||
|
||||
.blend_write = NULL,
|
||||
.blend_read_data = NULL,
|
||||
.blend_read_lib = NULL,
|
||||
.blend_read_expand = NULL,
|
||||
};
|
||||
|
||||
/* ***************** Library data level operations on action ************** */
|
||||
|
|
|
@ -180,6 +180,12 @@ IDTypeInfo IDType_ID_AR = {
|
|||
.free_data = armature_free_data,
|
||||
.make_local = NULL,
|
||||
.foreach_id = armature_foreach_id,
|
||||
.foreach_cache = NULL,
|
||||
|
||||
.blend_write = NULL,
|
||||
.blend_read_data = NULL,
|
||||
.blend_read_lib = NULL,
|
||||
.blend_read_expand = NULL,
|
||||
};
|
||||
|
||||
/** \} */
|
||||
|
|
|
@ -210,6 +210,12 @@ IDTypeInfo IDType_ID_BR = {
|
|||
.free_data = brush_free_data,
|
||||
.make_local = brush_make_local,
|
||||
.foreach_id = brush_foreach_id,
|
||||
.foreach_cache = NULL,
|
||||
|
||||
.blend_write = NULL,
|
||||
.blend_read_data = NULL,
|
||||
.blend_read_lib = NULL,
|
||||
.blend_read_expand = NULL,
|
||||
};
|
||||
|
||||
static RNG *brush_rng;
|
||||
|
|
|
@ -100,6 +100,12 @@ IDTypeInfo IDType_ID_CF = {
|
|||
.free_data = cache_file_free_data,
|
||||
.make_local = NULL,
|
||||
.foreach_id = NULL,
|
||||
.foreach_cache = NULL,
|
||||
|
||||
.blend_write = NULL,
|
||||
.blend_read_data = NULL,
|
||||
.blend_read_lib = NULL,
|
||||
.blend_read_expand = NULL,
|
||||
};
|
||||
|
||||
/* TODO: make this per cache file to avoid global locks. */
|
||||
|
|
|
@ -128,6 +128,12 @@ IDTypeInfo IDType_ID_CA = {
|
|||
.free_data = camera_free_data,
|
||||
.make_local = camera_make_local,
|
||||
.foreach_id = camera_foreach_id,
|
||||
.foreach_cache = NULL,
|
||||
|
||||
.blend_write = NULL,
|
||||
.blend_read_data = NULL,
|
||||
.blend_read_lib = NULL,
|
||||
.blend_read_expand = NULL,
|
||||
};
|
||||
|
||||
/** \} */
|
||||
|
|
|
@ -173,6 +173,12 @@ IDTypeInfo IDType_ID_GR = {
|
|||
.free_data = collection_free_data,
|
||||
.make_local = NULL,
|
||||
.foreach_id = collection_foreach_id,
|
||||
.foreach_cache = NULL,
|
||||
|
||||
.blend_write = NULL,
|
||||
.blend_read_data = NULL,
|
||||
.blend_read_lib = NULL,
|
||||
.blend_read_expand = NULL,
|
||||
};
|
||||
|
||||
/** \} */
|
||||
|
|
|
@ -146,6 +146,12 @@ IDTypeInfo IDType_ID_CU = {
|
|||
.free_data = curve_free_data,
|
||||
.make_local = NULL,
|
||||
.foreach_id = curve_foreach_id,
|
||||
.foreach_cache = NULL,
|
||||
|
||||
.blend_write = NULL,
|
||||
.blend_read_data = NULL,
|
||||
.blend_read_lib = NULL,
|
||||
.blend_read_expand = NULL,
|
||||
};
|
||||
|
||||
static int cu_isectLL(const float v1[3],
|
||||
|
|
|
@ -135,6 +135,12 @@ IDTypeInfo IDType_ID_VF = {
|
|||
.free_data = vfont_free_data,
|
||||
.make_local = NULL,
|
||||
.foreach_id = NULL,
|
||||
.foreach_cache = NULL,
|
||||
|
||||
.blend_write = NULL,
|
||||
.blend_read_data = NULL,
|
||||
.blend_read_lib = NULL,
|
||||
.blend_read_expand = NULL,
|
||||
};
|
||||
|
||||
/***************************** VFont *******************************/
|
||||
|
|
|
@ -126,6 +126,12 @@ IDTypeInfo IDType_ID_GD = {
|
|||
.free_data = greasepencil_free_data,
|
||||
.make_local = NULL,
|
||||
.foreach_id = greasepencil_foreach_id,
|
||||
.foreach_cache = NULL,
|
||||
|
||||
.blend_write = NULL,
|
||||
.blend_read_data = NULL,
|
||||
.blend_read_lib = NULL,
|
||||
.blend_read_expand = NULL,
|
||||
};
|
||||
|
||||
/* ************************************************** */
|
||||
|
|
|
@ -119,6 +119,12 @@ IDTypeInfo IDType_ID_HA = {
|
|||
.free_data = hair_free_data,
|
||||
.make_local = NULL,
|
||||
.foreach_id = hair_foreach_id,
|
||||
.foreach_cache = NULL,
|
||||
|
||||
.blend_write = NULL,
|
||||
.blend_read_data = NULL,
|
||||
.blend_read_lib = NULL,
|
||||
.blend_read_expand = NULL,
|
||||
};
|
||||
|
||||
static void hair_random(Hair *hair)
|
||||
|
|
|
@ -232,6 +232,11 @@ IDTypeInfo IDType_ID_IM = {
|
|||
.make_local = NULL,
|
||||
.foreach_id = NULL,
|
||||
.foreach_cache = image_foreach_cache,
|
||||
|
||||
.blend_write = NULL,
|
||||
.blend_read_data = NULL,
|
||||
.blend_read_lib = NULL,
|
||||
.blend_read_expand = NULL,
|
||||
};
|
||||
|
||||
/* prototypes */
|
||||
|
|
|
@ -124,6 +124,12 @@ IDTypeInfo IDType_ID_IP = {
|
|||
.free_data = ipo_free_data,
|
||||
.make_local = NULL,
|
||||
.foreach_id = NULL,
|
||||
.foreach_cache = NULL,
|
||||
|
||||
.blend_write = NULL,
|
||||
.blend_read_data = NULL,
|
||||
.blend_read_lib = NULL,
|
||||
.blend_read_expand = NULL,
|
||||
};
|
||||
|
||||
/* *************************************************** */
|
||||
|
|
|
@ -113,6 +113,12 @@ IDTypeInfo IDType_ID_KE = {
|
|||
.free_data = shapekey_free_data,
|
||||
.make_local = NULL,
|
||||
.foreach_id = shapekey_foreach_id,
|
||||
.foreach_cache = NULL,
|
||||
|
||||
.blend_write = NULL,
|
||||
.blend_read_data = NULL,
|
||||
.blend_read_lib = NULL,
|
||||
.blend_read_expand = NULL,
|
||||
};
|
||||
|
||||
#define KEY_MODE_DUMMY 0 /* use where mode isn't checked for */
|
||||
|
|
|
@ -139,6 +139,12 @@ IDTypeInfo IDType_ID_LT = {
|
|||
.free_data = lattice_free_data,
|
||||
.make_local = NULL,
|
||||
.foreach_id = lattice_foreach_id,
|
||||
.foreach_cache = NULL,
|
||||
|
||||
.blend_write = NULL,
|
||||
.blend_read_data = NULL,
|
||||
.blend_read_lib = NULL,
|
||||
.blend_read_expand = NULL,
|
||||
};
|
||||
|
||||
int BKE_lattice_index_from_uvw(Lattice *lt, const int u, const int v, const int w)
|
||||
|
|
|
@ -75,6 +75,12 @@ IDTypeInfo IDType_ID_LI = {
|
|||
.free_data = library_free_data,
|
||||
.make_local = NULL,
|
||||
.foreach_id = library_foreach_id,
|
||||
.foreach_cache = NULL,
|
||||
|
||||
.blend_write = NULL,
|
||||
.blend_read_data = NULL,
|
||||
.blend_read_lib = NULL,
|
||||
.blend_read_expand = NULL,
|
||||
};
|
||||
|
||||
void BKE_library_filepath_set(Main *bmain, Library *lib, const char *filepath)
|
||||
|
|
|
@ -134,6 +134,12 @@ IDTypeInfo IDType_ID_LA = {
|
|||
.free_data = light_free_data,
|
||||
.make_local = NULL,
|
||||
.foreach_id = light_foreach_id,
|
||||
.foreach_cache = NULL,
|
||||
|
||||
.blend_write = NULL,
|
||||
.blend_read_data = NULL,
|
||||
.blend_read_lib = NULL,
|
||||
.blend_read_expand = NULL,
|
||||
};
|
||||
|
||||
Light *BKE_light_add(Main *bmain, const char *name)
|
||||
|
|
|
@ -69,6 +69,12 @@ IDTypeInfo IDType_ID_LP = {
|
|||
.free_data = NULL,
|
||||
.make_local = NULL,
|
||||
.foreach_id = lightprobe_foreach_id,
|
||||
.foreach_cache = NULL,
|
||||
|
||||
.blend_write = NULL,
|
||||
.blend_read_data = NULL,
|
||||
.blend_read_lib = NULL,
|
||||
.blend_read_expand = NULL,
|
||||
};
|
||||
|
||||
void BKE_lightprobe_type_set(LightProbe *probe, const short lightprobe_type)
|
||||
|
|
|
@ -204,6 +204,12 @@ IDTypeInfo IDType_ID_LS = {
|
|||
.free_data = linestyle_free_data,
|
||||
.make_local = NULL,
|
||||
.foreach_id = linestyle_foreach_id,
|
||||
.foreach_cache = NULL,
|
||||
|
||||
.blend_write = NULL,
|
||||
.blend_read_data = NULL,
|
||||
.blend_read_lib = NULL,
|
||||
.blend_read_expand = NULL,
|
||||
};
|
||||
|
||||
static const char *modifier_name[LS_MODIFIER_NUM] = {
|
||||
|
|
|
@ -109,6 +109,12 @@ IDTypeInfo IDType_ID_MSK = {
|
|||
.free_data = mask_free_data,
|
||||
.make_local = NULL,
|
||||
.foreach_id = mask_foreach_id,
|
||||
.foreach_cache = NULL,
|
||||
|
||||
.blend_write = NULL,
|
||||
.blend_read_data = NULL,
|
||||
.blend_read_lib = NULL,
|
||||
.blend_read_expand = NULL,
|
||||
};
|
||||
|
||||
static struct {
|
||||
|
|
|
@ -175,6 +175,12 @@ IDTypeInfo IDType_ID_MA = {
|
|||
.free_data = material_free_data,
|
||||
.make_local = NULL,
|
||||
.foreach_id = material_foreach_id,
|
||||
.foreach_cache = NULL,
|
||||
|
||||
.blend_write = NULL,
|
||||
.blend_read_data = NULL,
|
||||
.blend_read_lib = NULL,
|
||||
.blend_read_expand = NULL,
|
||||
};
|
||||
|
||||
void BKE_gpencil_material_attr_init(Material *ma)
|
||||
|
|
|
@ -125,6 +125,12 @@ IDTypeInfo IDType_ID_MB = {
|
|||
.free_data = metaball_free_data,
|
||||
.make_local = NULL,
|
||||
.foreach_id = metaball_foreach_id,
|
||||
.foreach_cache = NULL,
|
||||
|
||||
.blend_write = NULL,
|
||||
.blend_read_data = NULL,
|
||||
.blend_read_lib = NULL,
|
||||
.blend_read_expand = NULL,
|
||||
};
|
||||
|
||||
/* Functions */
|
||||
|
|
|
@ -178,6 +178,12 @@ IDTypeInfo IDType_ID_ME = {
|
|||
.free_data = mesh_free_data,
|
||||
.make_local = NULL,
|
||||
.foreach_id = mesh_foreach_id,
|
||||
.foreach_cache = NULL,
|
||||
|
||||
.blend_write = NULL,
|
||||
.blend_read_data = NULL,
|
||||
.blend_read_lib = NULL,
|
||||
.blend_read_expand = NULL,
|
||||
};
|
||||
|
||||
enum {
|
||||
|
|
|
@ -162,6 +162,11 @@ IDTypeInfo IDType_ID_MC = {
|
|||
.make_local = NULL,
|
||||
.foreach_id = movie_clip_foreach_id,
|
||||
.foreach_cache = movie_clip_foreach_cache,
|
||||
|
||||
.blend_write = NULL,
|
||||
.blend_read_data = NULL,
|
||||
.blend_read_lib = NULL,
|
||||
.blend_read_expand = NULL,
|
||||
};
|
||||
|
||||
/*********************** movieclip buffer loaders *************************/
|
||||
|
|
|
@ -359,6 +359,11 @@ IDTypeInfo IDType_ID_NT = {
|
|||
.make_local = NULL,
|
||||
.foreach_id = node_foreach_id,
|
||||
.foreach_cache = node_foreach_cache,
|
||||
|
||||
.blend_write = NULL,
|
||||
.blend_read_data = NULL,
|
||||
.blend_read_lib = NULL,
|
||||
.blend_read_expand = NULL,
|
||||
};
|
||||
|
||||
static void node_add_sockets_from_type(bNodeTree *ntree, bNode *node, bNodeType *ntype)
|
||||
|
|
|
@ -528,6 +528,12 @@ IDTypeInfo IDType_ID_OB = {
|
|||
.free_data = object_free_data,
|
||||
.make_local = object_make_local,
|
||||
.foreach_id = object_foreach_id,
|
||||
.foreach_cache = NULL,
|
||||
|
||||
.blend_write = NULL,
|
||||
.blend_read_data = NULL,
|
||||
.blend_read_lib = NULL,
|
||||
.blend_read_expand = NULL,
|
||||
};
|
||||
|
||||
void BKE_object_workob_clear(Object *workob)
|
||||
|
|
|
@ -117,6 +117,12 @@ IDTypeInfo IDType_ID_PAL = {
|
|||
.free_data = palette_free_data,
|
||||
.make_local = NULL,
|
||||
.foreach_id = NULL,
|
||||
.foreach_cache = NULL,
|
||||
|
||||
.blend_write = NULL,
|
||||
.blend_read_data = NULL,
|
||||
.blend_read_lib = NULL,
|
||||
.blend_read_expand = NULL,
|
||||
};
|
||||
|
||||
static void paint_curve_copy_data(Main *UNUSED(bmain),
|
||||
|
@ -155,6 +161,12 @@ IDTypeInfo IDType_ID_PC = {
|
|||
.free_data = paint_curve_free_data,
|
||||
.make_local = NULL,
|
||||
.foreach_id = NULL,
|
||||
.foreach_cache = NULL,
|
||||
|
||||
.blend_write = NULL,
|
||||
.blend_read_data = NULL,
|
||||
.blend_read_lib = NULL,
|
||||
.blend_read_expand = NULL,
|
||||
};
|
||||
|
||||
const char PAINT_CURSOR_SCULPT[3] = {255, 100, 100};
|
||||
|
|
|
@ -209,6 +209,12 @@ IDTypeInfo IDType_ID_PA = {
|
|||
.free_data = particle_settings_free_data,
|
||||
.make_local = NULL,
|
||||
.foreach_id = particle_settings_foreach_id,
|
||||
.foreach_cache = NULL,
|
||||
|
||||
.blend_write = NULL,
|
||||
.blend_read_data = NULL,
|
||||
.blend_read_lib = NULL,
|
||||
.blend_read_expand = NULL,
|
||||
};
|
||||
|
||||
unsigned int PSYS_FRAND_SEED_OFFSET[PSYS_FRAND_COUNT];
|
||||
|
|
|
@ -113,6 +113,12 @@ IDTypeInfo IDType_ID_PT = {
|
|||
.free_data = pointcloud_free_data,
|
||||
.make_local = NULL,
|
||||
.foreach_id = pointcloud_foreach_id,
|
||||
.foreach_cache = NULL,
|
||||
|
||||
.blend_write = NULL,
|
||||
.blend_read_data = NULL,
|
||||
.blend_read_lib = NULL,
|
||||
.blend_read_expand = NULL,
|
||||
};
|
||||
|
||||
static void pointcloud_random(PointCloud *pointcloud)
|
||||
|
|
|
@ -606,6 +606,11 @@ IDTypeInfo IDType_ID_SCE = {
|
|||
.make_local = NULL,
|
||||
.foreach_id = scene_foreach_id,
|
||||
.foreach_cache = scene_foreach_cache,
|
||||
|
||||
.blend_write = NULL,
|
||||
.blend_read_data = NULL,
|
||||
.blend_read_lib = NULL,
|
||||
.blend_read_expand = NULL,
|
||||
};
|
||||
|
||||
const char *RE_engine_id_BLENDER_EEVEE = "BLENDER_EEVEE";
|
||||
|
|
|
@ -245,6 +245,12 @@ IDTypeInfo IDType_ID_SCR = {
|
|||
.free_data = screen_free_data,
|
||||
.make_local = NULL,
|
||||
.foreach_id = screen_foreach_id,
|
||||
.foreach_cache = NULL,
|
||||
|
||||
.blend_write = NULL,
|
||||
.blend_read_data = NULL,
|
||||
.blend_read_lib = NULL,
|
||||
.blend_read_expand = NULL,
|
||||
};
|
||||
|
||||
/* ************ Spacetype/regiontype handling ************** */
|
||||
|
|
|
@ -160,6 +160,12 @@ IDTypeInfo IDType_ID_SIM = {
|
|||
/* free_data */ simulation_free_data,
|
||||
/* make_local */ nullptr,
|
||||
/* foreach_id */ simulation_foreach_id,
|
||||
/* foreach_cache */ NULL,
|
||||
|
||||
/* blend_write */ NULL,
|
||||
/* blend_read_data */ NULL,
|
||||
/* blend_read_lib */ NULL,
|
||||
/* blend_read_expand */ NULL,
|
||||
};
|
||||
|
||||
void *BKE_simulation_add(Main *bmain, const char *name)
|
||||
|
|
|
@ -143,6 +143,11 @@ IDTypeInfo IDType_ID_SO = {
|
|||
.make_local = NULL,
|
||||
.foreach_id = NULL,
|
||||
.foreach_cache = sound_foreach_cache,
|
||||
|
||||
.blend_write = NULL,
|
||||
.blend_read_data = NULL,
|
||||
.blend_read_lib = NULL,
|
||||
.blend_read_expand = NULL,
|
||||
};
|
||||
|
||||
#ifdef WITH_AUDASPACE
|
||||
|
|
|
@ -65,6 +65,12 @@ IDTypeInfo IDType_ID_SPK = {
|
|||
.free_data = NULL,
|
||||
.make_local = NULL,
|
||||
.foreach_id = speaker_foreach_id,
|
||||
.foreach_cache = NULL,
|
||||
|
||||
.blend_write = NULL,
|
||||
.blend_read_data = NULL,
|
||||
.blend_read_lib = NULL,
|
||||
.blend_read_expand = NULL,
|
||||
};
|
||||
|
||||
void *BKE_speaker_add(Main *bmain, const char *name)
|
||||
|
|
|
@ -182,6 +182,12 @@ IDTypeInfo IDType_ID_TXT = {
|
|||
.free_data = text_free_data,
|
||||
.make_local = NULL,
|
||||
.foreach_id = NULL,
|
||||
.foreach_cache = NULL,
|
||||
|
||||
.blend_write = NULL,
|
||||
.blend_read_data = NULL,
|
||||
.blend_read_lib = NULL,
|
||||
.blend_read_expand = NULL,
|
||||
};
|
||||
|
||||
/** \} */
|
||||
|
|
|
@ -149,6 +149,12 @@ IDTypeInfo IDType_ID_TE = {
|
|||
.free_data = texture_free_data,
|
||||
.make_local = NULL,
|
||||
.foreach_id = texture_foreach_id,
|
||||
.foreach_cache = NULL,
|
||||
|
||||
.blend_write = NULL,
|
||||
.blend_read_data = NULL,
|
||||
.blend_read_lib = NULL,
|
||||
.blend_read_expand = NULL,
|
||||
};
|
||||
|
||||
/* Utils for all IDs using those texture slots. */
|
||||
|
|
|
@ -525,6 +525,11 @@ IDTypeInfo IDType_ID_VO = {
|
|||
/* make_local */ nullptr,
|
||||
/* foreach_id */ volume_foreach_id,
|
||||
/* foreach_cache */ volume_foreach_cache,
|
||||
|
||||
/* blend_write */ NULL,
|
||||
/* blend_read_data */ NULL,
|
||||
/* blend_read_lib */ NULL,
|
||||
/* blend_read_expand */ NULL,
|
||||
};
|
||||
|
||||
void BKE_volume_init_grids(Volume *volume)
|
||||
|
|
|
@ -90,6 +90,12 @@ IDTypeInfo IDType_ID_WS = {
|
|||
.free_data = workspace_free_data,
|
||||
.make_local = NULL,
|
||||
.foreach_id = workspace_foreach_id,
|
||||
.foreach_cache = NULL,
|
||||
|
||||
.blend_write = NULL,
|
||||
.blend_read_data = NULL,
|
||||
.blend_read_lib = NULL,
|
||||
.blend_read_expand = NULL,
|
||||
};
|
||||
|
||||
/** \name Internal Utils
|
||||
|
|
|
@ -137,6 +137,12 @@ IDTypeInfo IDType_ID_WO = {
|
|||
.free_data = world_free_data,
|
||||
.make_local = NULL,
|
||||
.foreach_id = world_foreach_id,
|
||||
.foreach_cache = NULL,
|
||||
|
||||
.blend_write = NULL,
|
||||
.blend_read_data = NULL,
|
||||
.blend_read_lib = NULL,
|
||||
.blend_read_expand = NULL,
|
||||
};
|
||||
|
||||
World *BKE_world_add(Main *bmain, const char *name)
|
||||
|
|
|
@ -8240,6 +8240,9 @@ static bool direct_link_id(FileData *fd, Main *main, const int tag, ID *id, ID *
|
|||
}
|
||||
|
||||
const IDTypeInfo *id_type = BKE_idtype_get_info_from_id(id);
|
||||
if (id_type->blend_read_data != NULL) {
|
||||
id_type->blend_read_data(&reader, id);
|
||||
}
|
||||
|
||||
/* XXX Very weakly handled currently, see comment in read_libblock() before trying to
|
||||
* use it for anything new. */
|
||||
|
@ -8959,6 +8962,11 @@ static void lib_link_all(FileData *fd, Main *bmain)
|
|||
|
||||
lib_link_id(&reader, id);
|
||||
|
||||
const IDTypeInfo *id_type = BKE_idtype_get_info_from_id(id);
|
||||
if (id_type->blend_read_lib != NULL) {
|
||||
id_type->blend_read_lib(&reader, id);
|
||||
}
|
||||
|
||||
/* Note: ID types are processed in reverse order as defined by INDEX_ID_XXX enums in DNA_ID.h.
|
||||
* This ensures handling of most dependencies in proper order, as elsewhere in code.
|
||||
* Please keep order of entries in that switch matching that order, it's easier to quickly see
|
||||
|
@ -10372,6 +10380,11 @@ void BLO_expand_main(void *fdhandle, Main *mainvar)
|
|||
if (id->tag & LIB_TAG_NEED_EXPAND) {
|
||||
expand_id(&expander, id);
|
||||
|
||||
const IDTypeInfo *id_type = BKE_idtype_get_info_from_id(id);
|
||||
if (id_type->blend_read_expand != NULL) {
|
||||
id_type->blend_read_expand(&expander, id);
|
||||
}
|
||||
|
||||
switch (GS(id->name)) {
|
||||
case ID_OB:
|
||||
expand_object(&expander, (Object *)id);
|
||||
|
|
|
@ -3865,6 +3865,11 @@ static bool write_file_handle(Main *mainvar,
|
|||
((ID *)id_buffer)->prev = NULL;
|
||||
((ID *)id_buffer)->next = NULL;
|
||||
|
||||
const IDTypeInfo *id_type = BKE_idtype_get_info_from_id(id);
|
||||
if (id_type->blend_write != NULL) {
|
||||
id_type->blend_write(&writer, (ID *)id_buffer, id);
|
||||
}
|
||||
|
||||
switch ((ID_Type)GS(id->name)) {
|
||||
case ID_WM:
|
||||
write_windowmanager(&writer, (wmWindowManager *)id_buffer, id);
|
||||
|
|
|
@ -113,6 +113,12 @@ IDTypeInfo IDType_ID_WM = {
|
|||
.free_data = window_manager_free_data,
|
||||
.make_local = NULL,
|
||||
.foreach_id = window_manager_foreach_id,
|
||||
.foreach_cache = NULL,
|
||||
|
||||
.blend_write = NULL,
|
||||
.blend_read_data = NULL,
|
||||
.blend_read_lib = NULL,
|
||||
.blend_read_expand = NULL,
|
||||
};
|
||||
|
||||
#define MAX_OP_REGISTERED 32
|
||||
|
|
Loading…
Reference in New Issue