Cleanup/Refactor: Move animdata read/write code into generic ID handling.
There is no reason at all for each ID read/write callbacks to have to deal with this generic, common data explicitely. Generic ID read/write code is the place to handle such data (just like asset, liboverride, etc. data are handled already). Note behavioral change expected here.
This commit is contained in:
parent
ca527efb9f
commit
6a79a6a24a
|
@ -130,8 +130,8 @@ void BKE_animdata_merge_copy(struct Main *bmain,
|
|||
eAnimData_MergeCopy_Modes action_mode,
|
||||
bool fix_drivers);
|
||||
|
||||
void BKE_animdata_blend_write(struct BlendWriter *writer, struct AnimData *adt);
|
||||
void BKE_animdata_blend_read_data(struct BlendDataReader *reader, struct AnimData *adt);
|
||||
void BKE_animdata_blend_write(struct BlendWriter *writer, struct ID *id);
|
||||
void BKE_animdata_blend_read_data(struct BlendDataReader *reader, struct ID *id);
|
||||
void BKE_animdata_blend_read_lib(struct BlendLibReader *reader,
|
||||
struct ID *id,
|
||||
struct AnimData *adt);
|
||||
|
|
|
@ -1439,8 +1439,13 @@ void BKE_animdata_fix_paths_rename_all_ex(Main *bmain,
|
|||
|
||||
/* .blend file API -------------------------------------------- */
|
||||
|
||||
void BKE_animdata_blend_write(BlendWriter *writer, AnimData *adt)
|
||||
void BKE_animdata_blend_write(BlendWriter *writer, ID *id)
|
||||
{
|
||||
AnimData *adt = BKE_animdata_from_id(id);
|
||||
if (!adt) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* firstly, just write the AnimData block */
|
||||
BLO_write_struct(writer, AnimData, adt);
|
||||
|
||||
|
@ -1461,9 +1466,14 @@ void BKE_animdata_blend_write(BlendWriter *writer, AnimData *adt)
|
|||
BKE_nla_blend_write(writer, &adt->nla_tracks);
|
||||
}
|
||||
|
||||
void BKE_animdata_blend_read_data(BlendDataReader *reader, AnimData *adt)
|
||||
void BKE_animdata_blend_read_data(BlendDataReader *reader, ID *id)
|
||||
{
|
||||
/* NOTE: must have called BLO_read_data_address already before doing this... */
|
||||
IdAdtTemplate *iat = id_can_have_animdata(id) ? reinterpret_cast<IdAdtTemplate *>(id) : nullptr;
|
||||
if (!iat || !iat->adt) {
|
||||
return;
|
||||
}
|
||||
|
||||
AnimData *adt = static_cast<AnimData *>(BLO_read_data_address(reader, &iat->adt));
|
||||
if (adt == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -219,10 +219,6 @@ static void armature_blend_write(BlendWriter *writer, ID *id, const void *id_add
|
|||
BLO_write_id_struct(writer, bArmature, id_address, &arm->id);
|
||||
BKE_id_blend_write(writer, &arm->id);
|
||||
|
||||
if (arm->adt) {
|
||||
BKE_animdata_blend_write(writer, arm->adt);
|
||||
}
|
||||
|
||||
/* Direct data */
|
||||
LISTBASE_FOREACH (Bone *, bone, &arm->bonebase) {
|
||||
write_bone(writer, bone);
|
||||
|
@ -256,9 +252,6 @@ static void armature_blend_read_data(BlendDataReader *reader, ID *id)
|
|||
/* Must always be cleared (armatures don't have their own edit-data). */
|
||||
arm->needs_flush_to_id = 0;
|
||||
|
||||
BLO_read_data_address(reader, &arm->adt);
|
||||
BKE_animdata_blend_read_data(reader, arm->adt);
|
||||
|
||||
LISTBASE_FOREACH (Bone *, bone, &arm->bonebase) {
|
||||
direct_link_bones(reader, bone);
|
||||
}
|
||||
|
|
|
@ -104,10 +104,6 @@ static void cache_file_blend_write(BlendWriter *writer, ID *id, const void *id_a
|
|||
BLO_write_id_struct(writer, CacheFile, id_address, &cache_file->id);
|
||||
BKE_id_blend_write(writer, &cache_file->id);
|
||||
|
||||
if (cache_file->adt) {
|
||||
BKE_animdata_blend_write(writer, cache_file->adt);
|
||||
}
|
||||
|
||||
/* write layers */
|
||||
LISTBASE_FOREACH (CacheFileLayer *, layer, &cache_file->layers) {
|
||||
BLO_write_struct(writer, CacheFileLayer, layer);
|
||||
|
@ -122,10 +118,6 @@ static void cache_file_blend_read_data(BlendDataReader *reader, ID *id)
|
|||
cache_file->handle_filepath[0] = '\0';
|
||||
cache_file->handle_readers = nullptr;
|
||||
|
||||
/* relink animdata */
|
||||
BLO_read_data_address(reader, &cache_file->adt);
|
||||
BKE_animdata_blend_read_data(reader, cache_file->adt);
|
||||
|
||||
/* relink layers */
|
||||
BLO_read_list(reader, &cache_file->layers);
|
||||
}
|
||||
|
|
|
@ -115,10 +115,6 @@ static void camera_blend_write(BlendWriter *writer, ID *id, const void *id_addre
|
|||
BLO_write_id_struct(writer, Camera, id_address, &cam->id);
|
||||
BKE_id_blend_write(writer, &cam->id);
|
||||
|
||||
if (cam->adt) {
|
||||
BKE_animdata_blend_write(writer, cam->adt);
|
||||
}
|
||||
|
||||
LISTBASE_FOREACH (CameraBGImage *, bgpic, &cam->bg_images) {
|
||||
BLO_write_struct(writer, CameraBGImage, bgpic);
|
||||
}
|
||||
|
@ -127,8 +123,6 @@ static void camera_blend_write(BlendWriter *writer, ID *id, const void *id_addre
|
|||
static void camera_blend_read_data(BlendDataReader *reader, ID *id)
|
||||
{
|
||||
Camera *ca = (Camera *)id;
|
||||
BLO_read_data_address(reader, &ca->adt);
|
||||
BKE_animdata_blend_read_data(reader, ca->adt);
|
||||
|
||||
BLO_read_list(reader, &ca->bg_images);
|
||||
|
||||
|
|
|
@ -163,9 +163,6 @@ static void curve_blend_write(BlendWriter *writer, ID *id, const void *id_addres
|
|||
|
||||
/* direct data */
|
||||
BLO_write_pointer_array(writer, cu->totcol, cu->mat);
|
||||
if (cu->adt) {
|
||||
BKE_animdata_blend_write(writer, cu->adt);
|
||||
}
|
||||
|
||||
if (cu->vfont) {
|
||||
BLO_write_raw(writer, cu->len + 1, cu->str);
|
||||
|
@ -211,8 +208,6 @@ static void switch_endian_knots(Nurb *nu)
|
|||
static void curve_blend_read_data(BlendDataReader *reader, ID *id)
|
||||
{
|
||||
Curve *cu = (Curve *)id;
|
||||
BLO_read_data_address(reader, &cu->adt);
|
||||
BKE_animdata_blend_read_data(reader, cu->adt);
|
||||
|
||||
/* Protect against integer overflow vulnerability. */
|
||||
CLAMP(cu->len_char32, 0, INT_MAX - 4);
|
||||
|
|
|
@ -115,16 +115,11 @@ static void curves_blend_write(BlendWriter *writer, ID *id, const void *id_addre
|
|||
BLO_write_string(writer, curves->surface_uv_map);
|
||||
|
||||
BLO_write_pointer_array(writer, curves->totcol, curves->mat);
|
||||
if (curves->adt) {
|
||||
BKE_animdata_blend_write(writer, curves->adt);
|
||||
}
|
||||
}
|
||||
|
||||
static void curves_blend_read_data(BlendDataReader *reader, ID *id)
|
||||
{
|
||||
Curves *curves = (Curves *)id;
|
||||
BLO_read_data_address(reader, &curves->adt);
|
||||
BKE_animdata_blend_read_data(reader, curves->adt);
|
||||
|
||||
/* Geometry */
|
||||
curves->geometry.wrap().blend_read(*reader);
|
||||
|
|
|
@ -150,10 +150,6 @@ static void greasepencil_blend_write(BlendWriter *writer, ID *id, const void *id
|
|||
BLO_write_id_struct(writer, bGPdata, id_address, &gpd->id);
|
||||
BKE_id_blend_write(writer, &gpd->id);
|
||||
|
||||
if (gpd->adt) {
|
||||
BKE_animdata_blend_write(writer, gpd->adt);
|
||||
}
|
||||
|
||||
BKE_defbase_blend_write(writer, &gpd->vertex_group_names);
|
||||
|
||||
BLO_write_pointer_array(writer, gpd->totcol, gpd->mat);
|
||||
|
@ -190,10 +186,6 @@ void BKE_gpencil_blend_read_data(BlendDataReader *reader, bGPdata *gpd)
|
|||
return;
|
||||
}
|
||||
|
||||
/* Relink anim-data. */
|
||||
BLO_read_data_address(reader, &gpd->adt);
|
||||
BKE_animdata_blend_read_data(reader, gpd->adt);
|
||||
|
||||
/* Ensure full object-mode for linked grease pencil. */
|
||||
if (ID_IS_LINKED(gpd)) {
|
||||
gpd->flag &= ~GP_DATA_STROKE_PAINTMODE;
|
||||
|
|
|
@ -166,11 +166,6 @@ static void grease_pencil_blend_write(BlendWriter *writer, ID *id, const void *i
|
|||
BLO_write_id_struct(writer, GreasePencil, id_address, &grease_pencil->id);
|
||||
BKE_id_blend_write(writer, &grease_pencil->id);
|
||||
|
||||
/* Write animation data. */
|
||||
if (grease_pencil->adt) {
|
||||
BKE_animdata_blend_write(writer, grease_pencil->adt);
|
||||
}
|
||||
|
||||
/* Write drawings. */
|
||||
write_drawing_array(*grease_pencil, writer);
|
||||
/* Write layer tree. */
|
||||
|
@ -186,10 +181,6 @@ static void grease_pencil_blend_read_data(BlendDataReader *reader, ID *id)
|
|||
using namespace blender::bke::greasepencil;
|
||||
GreasePencil *grease_pencil = reinterpret_cast<GreasePencil *>(id);
|
||||
|
||||
/* Read animation data. */
|
||||
BLO_read_data_address(reader, &grease_pencil->adt);
|
||||
BKE_animdata_blend_read_data(reader, grease_pencil->adt);
|
||||
|
||||
/* Read drawings. */
|
||||
read_drawing_array(*grease_pencil, reader);
|
||||
/* Read layer tree. */
|
||||
|
|
|
@ -110,10 +110,6 @@ static void shapekey_blend_write(BlendWriter *writer, ID *id, const void *id_add
|
|||
BLO_write_id_struct(writer, Key, id_address, &key->id);
|
||||
BKE_id_blend_write(writer, &key->id);
|
||||
|
||||
if (key->adt) {
|
||||
BKE_animdata_blend_write(writer, key->adt);
|
||||
}
|
||||
|
||||
/* direct data */
|
||||
LISTBASE_FOREACH (KeyBlock *, kb, &key->block) {
|
||||
KeyBlock tmp_kb = *kb;
|
||||
|
@ -166,9 +162,6 @@ static void shapekey_blend_read_data(BlendDataReader *reader, ID *id)
|
|||
Key *key = (Key *)id;
|
||||
BLO_read_list(reader, &(key->block));
|
||||
|
||||
BLO_read_data_address(reader, &key->adt);
|
||||
BKE_animdata_blend_read_data(reader, key->adt);
|
||||
|
||||
BLO_read_data_address(reader, &key->refkey);
|
||||
|
||||
LISTBASE_FOREACH (KeyBlock *, kb, &key->block) {
|
||||
|
|
|
@ -133,11 +133,6 @@ static void lattice_blend_write(BlendWriter *writer, ID *id, const void *id_addr
|
|||
BLO_write_id_struct(writer, Lattice, id_address, <->id);
|
||||
BKE_id_blend_write(writer, <->id);
|
||||
|
||||
/* write animdata */
|
||||
if (lt->adt) {
|
||||
BKE_animdata_blend_write(writer, lt->adt);
|
||||
}
|
||||
|
||||
/* direct data */
|
||||
BLO_write_struct_array(writer, BPoint, lt->pntsu * lt->pntsv * lt->pntsw, lt->def);
|
||||
|
||||
|
@ -156,9 +151,6 @@ static void lattice_blend_read_data(BlendDataReader *reader, ID *id)
|
|||
|
||||
lt->editlatt = nullptr;
|
||||
lt->batch_cache = nullptr;
|
||||
|
||||
BLO_read_data_address(reader, <->adt);
|
||||
BKE_animdata_blend_read_data(reader, lt->adt);
|
||||
}
|
||||
|
||||
static void lattice_blend_read_lib(BlendLibReader *reader, ID *id)
|
||||
|
|
|
@ -2226,6 +2226,8 @@ void BKE_id_blend_write(BlendWriter *writer, ID *id)
|
|||
IDP_BlendWrite(writer, id->properties);
|
||||
}
|
||||
|
||||
BKE_animdata_blend_write(writer, id);
|
||||
|
||||
if (id->override_library) {
|
||||
BLO_write_struct(writer, IDOverrideLibrary, id->override_library);
|
||||
|
||||
|
|
|
@ -126,10 +126,6 @@ static void light_blend_write(BlendWriter *writer, ID *id, const void *id_addres
|
|||
BLO_write_id_struct(writer, Light, id_address, &la->id);
|
||||
BKE_id_blend_write(writer, &la->id);
|
||||
|
||||
if (la->adt) {
|
||||
BKE_animdata_blend_write(writer, la->adt);
|
||||
}
|
||||
|
||||
/* Node-tree is integral part of lights, no libdata. */
|
||||
if (la->nodetree) {
|
||||
BLO_Write_IDBuffer *temp_embedded_id_buffer = BLO_write_allocate_id_buffer();
|
||||
|
@ -147,8 +143,6 @@ static void light_blend_write(BlendWriter *writer, ID *id, const void *id_addres
|
|||
static void light_blend_read_data(BlendDataReader *reader, ID *id)
|
||||
{
|
||||
Light *la = (Light *)id;
|
||||
BLO_read_data_address(reader, &la->adt);
|
||||
BKE_animdata_blend_read_data(reader, la->adt);
|
||||
|
||||
BLO_read_data_address(reader, &la->preview);
|
||||
BKE_previewimg_blend_read(reader, la->preview);
|
||||
|
|
|
@ -51,17 +51,6 @@ static void lightprobe_blend_write(BlendWriter *writer, ID *id, const void *id_a
|
|||
/* write LibData */
|
||||
BLO_write_id_struct(writer, LightProbe, id_address, &prb->id);
|
||||
BKE_id_blend_write(writer, &prb->id);
|
||||
|
||||
if (prb->adt) {
|
||||
BKE_animdata_blend_write(writer, prb->adt);
|
||||
}
|
||||
}
|
||||
|
||||
static void lightprobe_blend_read_data(BlendDataReader *reader, ID *id)
|
||||
{
|
||||
LightProbe *prb = (LightProbe *)id;
|
||||
BLO_read_data_address(reader, &prb->adt);
|
||||
BKE_animdata_blend_read_data(reader, prb->adt);
|
||||
}
|
||||
|
||||
static void lightprobe_blend_read_lib(BlendLibReader *reader, ID *id)
|
||||
|
@ -91,7 +80,7 @@ IDTypeInfo IDType_ID_LP = {
|
|||
/*owner_pointer_get*/ nullptr,
|
||||
|
||||
/*blend_write*/ lightprobe_blend_write,
|
||||
/*blend_read_data*/ lightprobe_blend_read_data,
|
||||
/*blend_read_data*/ nullptr,
|
||||
/*blend_read_lib*/ lightprobe_blend_read_lib,
|
||||
/*blend_read_expand*/ nullptr,
|
||||
|
||||
|
|
|
@ -433,10 +433,6 @@ static void linestyle_blend_write(BlendWriter *writer, ID *id, const void *id_ad
|
|||
BLO_write_id_struct(writer, FreestyleLineStyle, id_address, &linestyle->id);
|
||||
BKE_id_blend_write(writer, &linestyle->id);
|
||||
|
||||
if (linestyle->adt) {
|
||||
BKE_animdata_blend_write(writer, linestyle->adt);
|
||||
}
|
||||
|
||||
write_linestyle_color_modifiers(writer, &linestyle->color_modifiers);
|
||||
write_linestyle_alpha_modifiers(writer, &linestyle->alpha_modifiers);
|
||||
write_linestyle_thickness_modifiers(writer, &linestyle->thickness_modifiers);
|
||||
|
@ -630,8 +626,6 @@ static void linestyle_blend_read_data(BlendDataReader *reader, ID *id)
|
|||
{
|
||||
FreestyleLineStyle *linestyle = (FreestyleLineStyle *)id;
|
||||
|
||||
BLO_read_data_address(reader, &linestyle->adt);
|
||||
BKE_animdata_blend_read_data(reader, linestyle->adt);
|
||||
BLO_read_list(reader, &linestyle->color_modifiers);
|
||||
LISTBASE_FOREACH (LineStyleModifier *, modifier, &linestyle->color_modifiers) {
|
||||
direct_link_linestyle_color_modifier(reader, modifier);
|
||||
|
|
|
@ -96,10 +96,6 @@ static void mask_blend_write(BlendWriter *writer, ID *id, const void *id_address
|
|||
BLO_write_id_struct(writer, Mask, id_address, &mask->id);
|
||||
BKE_id_blend_write(writer, &mask->id);
|
||||
|
||||
if (mask->adt) {
|
||||
BKE_animdata_blend_write(writer, mask->adt);
|
||||
}
|
||||
|
||||
LISTBASE_FOREACH (MaskLayer *, masklay, &mask->masklayers) {
|
||||
BLO_write_struct(writer, MaskLayer, masklay);
|
||||
|
||||
|
|
|
@ -185,10 +185,6 @@ static void material_blend_write(BlendWriter *writer, ID *id, const void *id_add
|
|||
BLO_write_id_struct(writer, Material, id_address, &ma->id);
|
||||
BKE_id_blend_write(writer, &ma->id);
|
||||
|
||||
if (ma->adt) {
|
||||
BKE_animdata_blend_write(writer, ma->adt);
|
||||
}
|
||||
|
||||
/* nodetree is integral part of material, no libdata */
|
||||
if (ma->nodetree) {
|
||||
BLO_Write_IDBuffer *temp_embedded_id_buffer = BLO_write_allocate_id_buffer();
|
||||
|
@ -213,8 +209,6 @@ static void material_blend_write(BlendWriter *writer, ID *id, const void *id_add
|
|||
static void material_blend_read_data(BlendDataReader *reader, ID *id)
|
||||
{
|
||||
Material *ma = (Material *)id;
|
||||
BLO_read_data_address(reader, &ma->adt);
|
||||
BKE_animdata_blend_read_data(reader, ma->adt);
|
||||
|
||||
ma->texpaintslot = nullptr;
|
||||
|
||||
|
|
|
@ -114,9 +114,6 @@ static void metaball_blend_write(BlendWriter *writer, ID *id, const void *id_add
|
|||
|
||||
/* direct data */
|
||||
BLO_write_pointer_array(writer, mb->totcol, mb->mat);
|
||||
if (mb->adt) {
|
||||
BKE_animdata_blend_write(writer, mb->adt);
|
||||
}
|
||||
|
||||
LISTBASE_FOREACH (MetaElem *, ml, &mb->elems) {
|
||||
BLO_write_struct(writer, MetaElem, ml);
|
||||
|
@ -126,8 +123,6 @@ static void metaball_blend_write(BlendWriter *writer, ID *id, const void *id_add
|
|||
static void metaball_blend_read_data(BlendDataReader *reader, ID *id)
|
||||
{
|
||||
MetaBall *mb = (MetaBall *)id;
|
||||
BLO_read_data_address(reader, &mb->adt);
|
||||
BKE_animdata_blend_read_data(reader, mb->adt);
|
||||
|
||||
BLO_read_pointer_array(reader, (void **)&mb->mat);
|
||||
|
||||
|
|
|
@ -270,10 +270,6 @@ static void mesh_blend_write(BlendWriter *writer, ID *id, const void *id_address
|
|||
BLO_write_id_struct(writer, Mesh, id_address, &mesh->id);
|
||||
BKE_id_blend_write(writer, &mesh->id);
|
||||
|
||||
if (mesh->adt) {
|
||||
BKE_animdata_blend_write(writer, mesh->adt);
|
||||
}
|
||||
|
||||
BKE_defbase_blend_write(writer, &mesh->vertex_group_names);
|
||||
BLO_write_string(writer, mesh->active_color_attribute);
|
||||
BLO_write_string(writer, mesh->default_color_attribute);
|
||||
|
@ -315,9 +311,6 @@ static void mesh_blend_read_data(BlendDataReader *reader, ID *id)
|
|||
|
||||
BLO_read_data_address(reader, &mesh->mselect);
|
||||
|
||||
BLO_read_data_address(reader, &mesh->adt);
|
||||
BKE_animdata_blend_read_data(reader, mesh->adt);
|
||||
|
||||
BLO_read_list(reader, &mesh->vertex_group_names);
|
||||
|
||||
CustomData_blend_read(reader, &mesh->vert_data, mesh->totvert);
|
||||
|
|
|
@ -198,10 +198,6 @@ static void movieclip_blend_write(BlendWriter *writer, ID *id, const void *id_ad
|
|||
BLO_write_id_struct(writer, MovieClip, id_address, &clip->id);
|
||||
BKE_id_blend_write(writer, &clip->id);
|
||||
|
||||
if (clip->adt) {
|
||||
BKE_animdata_blend_write(writer, clip->adt);
|
||||
}
|
||||
|
||||
LISTBASE_FOREACH (MovieTrackingObject *, object, &tracking->objects) {
|
||||
BLO_write_struct(writer, MovieTrackingObject, object);
|
||||
write_movieTracks(writer, &object->tracks);
|
||||
|
@ -244,9 +240,6 @@ static void movieclip_blend_read_data(BlendDataReader *reader, ID *id)
|
|||
MovieClip *clip = (MovieClip *)id;
|
||||
MovieTracking *tracking = &clip->tracking;
|
||||
|
||||
BLO_read_data_address(reader, &clip->adt);
|
||||
BKE_animdata_blend_read_data(reader, clip->adt);
|
||||
|
||||
direct_link_movieTracks(reader, &tracking->tracks_legacy);
|
||||
direct_link_moviePlaneTracks(reader, &tracking->plane_tracks_legacy);
|
||||
direct_link_movieReconstruction(reader, &tracking->reconstruction_legacy);
|
||||
|
|
|
@ -555,10 +555,6 @@ void ntreeBlendWrite(BlendWriter *writer, bNodeTree *ntree)
|
|||
{
|
||||
BKE_id_blend_write(writer, &ntree->id);
|
||||
|
||||
if (ntree->adt) {
|
||||
BKE_animdata_blend_write(writer, ntree->adt);
|
||||
}
|
||||
|
||||
for (bNode *node : ntree->all_nodes()) {
|
||||
BLO_write_struct(writer, bNode, node);
|
||||
|
||||
|
@ -761,9 +757,6 @@ void ntreeBlendReadData(BlendDataReader *reader, ID *owner_id, bNodeTree *ntree)
|
|||
ntree->runtime = MEM_new<bNodeTreeRuntime>(__func__);
|
||||
BKE_ntree_update_tag_missing_runtime_data(ntree);
|
||||
|
||||
BLO_read_data_address(reader, &ntree->adt);
|
||||
BKE_animdata_blend_read_data(reader, ntree->adt);
|
||||
|
||||
BLO_read_list(reader, &ntree->nodes);
|
||||
int i;
|
||||
LISTBASE_FOREACH_INDEX (bNode *, node, &ntree->nodes, i) {
|
||||
|
|
|
@ -568,10 +568,6 @@ static void object_blend_write(BlendWriter *writer, ID *id, const void *id_addre
|
|||
BLO_write_id_struct(writer, Object, id_address, &ob->id);
|
||||
BKE_id_blend_write(writer, &ob->id);
|
||||
|
||||
if (ob->adt) {
|
||||
BKE_animdata_blend_write(writer, ob->adt);
|
||||
}
|
||||
|
||||
/* direct data */
|
||||
BLO_write_pointer_array(writer, ob->totcol, ob->mat);
|
||||
BLO_write_raw(writer, sizeof(char) * ob->totcol, ob->matbits);
|
||||
|
@ -665,9 +661,6 @@ static void object_blend_read_data(BlendDataReader *reader, ID *id)
|
|||
ob->mode &= ~(OB_MODE_EDIT | OB_MODE_PARTICLE_EDIT);
|
||||
}
|
||||
|
||||
BLO_read_data_address(reader, &ob->adt);
|
||||
BKE_animdata_blend_read_data(reader, ob->adt);
|
||||
|
||||
BLO_read_data_address(reader, &ob->pose);
|
||||
BKE_pose_blend_read_data(reader, ob->pose);
|
||||
|
||||
|
|
|
@ -256,9 +256,6 @@ static void particle_settings_blend_write(BlendWriter *writer, ID *id, const voi
|
|||
BLO_write_id_struct(writer, ParticleSettings, id_address, &part->id);
|
||||
BKE_id_blend_write(writer, &part->id);
|
||||
|
||||
if (part->adt) {
|
||||
BKE_animdata_blend_write(writer, part->adt);
|
||||
}
|
||||
BLO_write_struct(writer, PartDeflect, part->pd);
|
||||
BLO_write_struct(writer, PartDeflect, part->pd2);
|
||||
BLO_write_struct(writer, EffectorWeights, part->effector_weights);
|
||||
|
@ -318,11 +315,9 @@ void BKE_particle_partdeflect_blend_read_data(BlendDataReader * /*reader*/, Part
|
|||
static void particle_settings_blend_read_data(BlendDataReader *reader, ID *id)
|
||||
{
|
||||
ParticleSettings *part = (ParticleSettings *)id;
|
||||
BLO_read_data_address(reader, &part->adt);
|
||||
|
||||
BLO_read_data_address(reader, &part->pd);
|
||||
BLO_read_data_address(reader, &part->pd2);
|
||||
|
||||
BKE_animdata_blend_read_data(reader, part->adt);
|
||||
BKE_particle_partdeflect_blend_read_data(reader, part->pd);
|
||||
BKE_particle_partdeflect_blend_read_data(reader, part->pd2);
|
||||
|
||||
|
|
|
@ -126,16 +126,11 @@ static void pointcloud_blend_write(BlendWriter *writer, ID *id, const void *id_a
|
|||
&pointcloud->id);
|
||||
|
||||
BLO_write_pointer_array(writer, pointcloud->totcol, pointcloud->mat);
|
||||
if (pointcloud->adt) {
|
||||
BKE_animdata_blend_write(writer, pointcloud->adt);
|
||||
}
|
||||
}
|
||||
|
||||
static void pointcloud_blend_read_data(BlendDataReader *reader, ID *id)
|
||||
{
|
||||
PointCloud *pointcloud = (PointCloud *)id;
|
||||
BLO_read_data_address(reader, &pointcloud->adt);
|
||||
BKE_animdata_blend_read_data(reader, pointcloud->adt);
|
||||
|
||||
/* Geometry */
|
||||
CustomData_blend_read(reader, &pointcloud->pdata, pointcloud->totpoint);
|
||||
|
|
|
@ -1009,9 +1009,6 @@ static void scene_blend_write(BlendWriter *writer, ID *id, const void *id_addres
|
|||
BLO_write_id_struct(writer, Scene, id_address, &sce->id);
|
||||
BKE_id_blend_write(writer, &sce->id);
|
||||
|
||||
if (sce->adt) {
|
||||
BKE_animdata_blend_write(writer, sce->adt);
|
||||
}
|
||||
BKE_keyingsets_blend_write(writer, &sce->keyingsets);
|
||||
|
||||
/* direct data */
|
||||
|
@ -1229,9 +1226,6 @@ static void scene_blend_read_data(BlendDataReader *reader, ID *id)
|
|||
|
||||
BLO_read_list(reader, &(sce->base));
|
||||
|
||||
BLO_read_data_address(reader, &sce->adt);
|
||||
BKE_animdata_blend_read_data(reader, sce->adt);
|
||||
|
||||
BLO_read_list(reader, &sce->keyingsets);
|
||||
BKE_keyingsets_blend_read_data(reader, &sce->keyingsets);
|
||||
|
||||
|
|
|
@ -49,22 +49,6 @@ static void speaker_blend_write(BlendWriter *writer, ID *id, const void *id_addr
|
|||
/* write LibData */
|
||||
BLO_write_id_struct(writer, Speaker, id_address, &spk->id);
|
||||
BKE_id_blend_write(writer, &spk->id);
|
||||
|
||||
if (spk->adt) {
|
||||
BKE_animdata_blend_write(writer, spk->adt);
|
||||
}
|
||||
}
|
||||
|
||||
static void speaker_blend_read_data(BlendDataReader *reader, ID *id)
|
||||
{
|
||||
Speaker *spk = (Speaker *)id;
|
||||
BLO_read_data_address(reader, &spk->adt);
|
||||
BKE_animdata_blend_read_data(reader, spk->adt);
|
||||
|
||||
#if 0
|
||||
spk->sound = newdataadr(fd, spk->sound);
|
||||
direct_link_sound(fd, spk->sound);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void speaker_blend_read_lib(BlendLibReader *reader, ID *id)
|
||||
|
@ -100,7 +84,7 @@ IDTypeInfo IDType_ID_SPK = {
|
|||
/*owner_pointer_get*/ nullptr,
|
||||
|
||||
/*blend_write*/ speaker_blend_write,
|
||||
/*blend_read_data*/ speaker_blend_read_data,
|
||||
/*blend_read_data*/ nullptr,
|
||||
/*blend_read_lib*/ speaker_blend_read_lib,
|
||||
/*blend_read_expand*/ speaker_blend_read_expand,
|
||||
|
||||
|
|
|
@ -153,10 +153,6 @@ static void texture_blend_write(BlendWriter *writer, ID *id, const void *id_addr
|
|||
BLO_write_id_struct(writer, Tex, id_address, &tex->id);
|
||||
BKE_id_blend_write(writer, &tex->id);
|
||||
|
||||
if (tex->adt) {
|
||||
BKE_animdata_blend_write(writer, tex->adt);
|
||||
}
|
||||
|
||||
/* direct data */
|
||||
if (tex->coba) {
|
||||
BLO_write_struct(writer, ColorBand, tex->coba);
|
||||
|
@ -183,8 +179,6 @@ static void texture_blend_write(BlendWriter *writer, ID *id, const void *id_addr
|
|||
static void texture_blend_read_data(BlendDataReader *reader, ID *id)
|
||||
{
|
||||
Tex *tex = (Tex *)id;
|
||||
BLO_read_data_address(reader, &tex->adt);
|
||||
BKE_animdata_blend_read_data(reader, tex->adt);
|
||||
|
||||
BLO_read_data_address(reader, &tex->coba);
|
||||
|
||||
|
|
|
@ -608,9 +608,6 @@ static void volume_blend_write(BlendWriter *writer, ID *id, const void *id_addre
|
|||
|
||||
/* direct data */
|
||||
BLO_write_pointer_array(writer, volume->totcol, volume->mat);
|
||||
if (volume->adt) {
|
||||
BKE_animdata_blend_write(writer, volume->adt);
|
||||
}
|
||||
|
||||
BKE_packedfile_blend_write(writer, volume->packedfile);
|
||||
}
|
||||
|
@ -618,8 +615,6 @@ static void volume_blend_write(BlendWriter *writer, ID *id, const void *id_addre
|
|||
static void volume_blend_read_data(BlendDataReader *reader, ID *id)
|
||||
{
|
||||
Volume *volume = (Volume *)id;
|
||||
BLO_read_data_address(reader, &volume->adt);
|
||||
BKE_animdata_blend_read_data(reader, volume->adt);
|
||||
|
||||
BKE_packedfile_blend_read(reader, &volume->packedfile);
|
||||
volume->runtime.frame = 0;
|
||||
|
|
|
@ -139,10 +139,6 @@ static void world_blend_write(BlendWriter *writer, ID *id, const void *id_addres
|
|||
BLO_write_id_struct(writer, World, id_address, &wrld->id);
|
||||
BKE_id_blend_write(writer, &wrld->id);
|
||||
|
||||
if (wrld->adt) {
|
||||
BKE_animdata_blend_write(writer, wrld->adt);
|
||||
}
|
||||
|
||||
/* nodetree is integral part of world, no libdata */
|
||||
if (wrld->nodetree) {
|
||||
BLO_Write_IDBuffer *temp_embedded_id_buffer = BLO_write_allocate_id_buffer();
|
||||
|
@ -166,8 +162,6 @@ static void world_blend_write(BlendWriter *writer, ID *id, const void *id_addres
|
|||
static void world_blend_read_data(BlendDataReader *reader, ID *id)
|
||||
{
|
||||
World *wrld = (World *)id;
|
||||
BLO_read_data_address(reader, &wrld->adt);
|
||||
BKE_animdata_blend_read_data(reader, wrld->adt);
|
||||
|
||||
BLO_read_data_address(reader, &wrld->preview);
|
||||
BKE_previewimg_blend_read(reader, wrld->preview);
|
||||
|
|
|
@ -2088,6 +2088,8 @@ static void direct_link_id_common(
|
|||
return;
|
||||
}
|
||||
|
||||
BKE_animdata_blend_read_data(reader, id);
|
||||
|
||||
if (id->asset_data) {
|
||||
BLO_read_data_address(reader, &id->asset_data);
|
||||
BKE_asset_metadata_read(reader, id->asset_data);
|
||||
|
|
Loading…
Reference in New Issue