Readfile: Replace the 'expand' specific code by generic usage of foreach_id.

The `expand` callback is 'trivial' to replace, since it is only iterating
over ID pointers and calling a callback.

The only change in behavior here is that some pointers that were not
processed previously will now be.

In practice this is not expected to have any real effect (usually
the IDs used by these pointers would have been expanded through other
usages anyway). But it may solve a few corner cases, undocumented issues
though.

Part of implementing #105134: Removal of readfile's lib_link & expand code.
This commit is contained in:
Bastien Montagne 2023-08-23 12:36:56 +02:00
parent c79642fa98
commit 8bb5916183
63 changed files with 43 additions and 996 deletions

View File

@ -18,7 +18,6 @@ extern "C" {
#endif
struct BlendDataReader;
struct BlendExpander;
struct BlendLibReader;
struct BlendWriter;
struct bArmature;
@ -394,8 +393,6 @@ void BKE_pose_blend_read_data(struct BlendDataReader *reader,
struct bPose *pose) ATTR_NONNULL(1, 2);
void BKE_pose_blend_read_lib(struct BlendLibReader *reader, struct Object *ob, struct bPose *pose)
ATTR_NONNULL(1, 2);
void BKE_pose_blend_read_expand(struct BlendExpander *expander, struct bPose *pose)
ATTR_NONNULL(1);
/* `action_mirror.cc` */

View File

@ -16,7 +16,6 @@ extern "C" {
struct AnimData;
struct BlendDataReader;
struct BlendExpander;
struct BlendLibReader;
struct BlendWriter;
struct ID;
@ -135,7 +134,6 @@ 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);
void BKE_animdata_blend_read_expand(struct BlendExpander *expander, struct AnimData *adt);
#ifdef __cplusplus
}

View File

@ -17,7 +17,6 @@ extern "C" {
struct AnimData;
struct BlendDataReader;
struct BlendExpander;
struct BlendLibReader;
struct BlendWriter;
struct Depsgraph;
@ -106,7 +105,6 @@ void BKE_keyingsets_blend_read_data(struct BlendDataReader *reader, struct ListB
void BKE_keyingsets_blend_read_lib(struct BlendLibReader *reader,
struct ID *id,
struct ListBase *list);
void BKE_keyingsets_blend_read_expand(struct BlendExpander *expander, struct ListBase *list);
/* ************************************* */
/* Path Fixing API */

View File

@ -24,7 +24,6 @@ extern "C" {
struct BLI_Iterator;
struct Base;
struct BlendDataReader;
struct BlendExpander;
struct BlendLibReader;
struct BlendWriter;
struct Collection;
@ -318,8 +317,6 @@ void BKE_collection_blend_read_data(struct BlendDataReader *reader,
struct Collection *collection,
struct ID *owner_id);
void BKE_collection_blend_read_lib(struct BlendLibReader *reader, struct Collection *collection);
void BKE_collection_blend_read_expand(struct BlendExpander *expander,
struct Collection *collection);
/* Iteration callbacks. */

View File

@ -9,7 +9,6 @@
*/
struct BlendDataReader;
struct BlendExpander;
struct BlendLibReader;
struct BlendWriter;
struct Depsgraph;
@ -375,7 +374,6 @@ void BKE_constraint_blend_read_data(struct BlendDataReader *reader,
void BKE_constraint_blend_read_lib(struct BlendLibReader *reader,
struct ID *id,
struct ListBase *conlist);
void BKE_constraint_blend_read_expand(struct BlendExpander *expander, struct ListBase *lb);
#ifdef __cplusplus
}

View File

@ -23,7 +23,6 @@ struct AnimData;
struct AnimationEvalContext;
struct BezTriple;
struct BlendDataReader;
struct BlendExpander;
struct BlendLibReader;
struct BlendWriter;
struct LibraryForeachIDData;
@ -639,14 +638,12 @@ void BKE_fmodifiers_blend_read_data(struct BlendDataReader *reader,
void BKE_fmodifiers_blend_read_lib(struct BlendLibReader *reader,
struct ID *id,
struct ListBase *fmodifiers);
void BKE_fmodifiers_blend_read_expand(struct BlendExpander *expander, struct ListBase *fmodifiers);
void BKE_fcurve_blend_write(struct BlendWriter *writer, struct ListBase *fcurves);
void BKE_fcurve_blend_read_data(struct BlendDataReader *reader, struct ListBase *fcurves);
void BKE_fcurve_blend_read_lib(struct BlendLibReader *reader,
struct ID *id,
struct ListBase *fcurves);
void BKE_fcurve_blend_read_expand(struct BlendExpander *expander, struct ListBase *fcurves);
#ifdef __cplusplus
}

View File

@ -16,7 +16,6 @@ extern "C" {
#endif
struct BlendDataReader;
struct BlendExpander;
struct BlendLibReader;
struct BlendWriter;
struct ID;
@ -316,7 +315,6 @@ void IDP_BlendReadData_impl(struct BlendDataReader *reader,
const char *caller_func_id);
#define IDP_BlendDataRead(reader, prop) IDP_BlendReadData_impl(reader, prop, __func__)
void IDP_BlendReadLib(struct BlendLibReader *reader, struct ID *self_id, struct IDProperty *prop);
void IDP_BlendReadExpand(struct BlendExpander *expander, struct IDProperty *prop);
typedef enum eIDPropertyUIDataType {
/** Other properties types that don't support RNA UI data. */

View File

@ -18,7 +18,6 @@ extern "C" {
struct BPathForeachPathData;
struct BlendDataReader;
struct BlendExpander;
struct BlendLibReader;
struct BlendWriter;
struct ID;
@ -102,7 +101,6 @@ typedef void (*IDTypeBlendWriteFunction)(struct BlendWriter *writer,
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 void (*IDTypeBlendReadUndoPreserve)(struct BlendLibReader *reader,
struct ID *id_new,
@ -211,11 +209,6 @@ typedef struct IDTypeInfo {
*/
IDTypeBlendReadLibFunction blend_read_lib;
/**
* Specify which other id data blocks should be loaded when the current one is loaded.
*/
IDTypeBlendReadExpandFunction blend_read_expand;
/**
* Allow an ID type to preserve some of its data across (memfile) undo steps.
*

View File

@ -28,7 +28,6 @@ struct Speaker;
struct bAction;
struct BlendDataReader;
struct BlendExpander;
struct BlendLibReader;
struct BlendWriter;
struct PointerRNA;
@ -489,7 +488,6 @@ void BKE_nla_blend_read_data(struct BlendDataReader *reader,
struct ID *id_owner,
struct ListBase *tracks);
void BKE_nla_blend_read_lib(struct BlendLibReader *reader, struct ID *id, struct ListBase *tracks);
void BKE_nla_blend_read_expand(struct BlendExpander *expander, struct ListBase *tracks);
#ifdef __cplusplus
}

View File

@ -31,7 +31,6 @@ extern "C" {
#define MAX_SOCKET 512
struct BlendDataReader;
struct BlendExpander;
struct BlendLibReader;
struct BlendWriter;
struct FreestyleLineStyle;

View File

@ -58,8 +58,6 @@ void ntreeLocalMerge(Main *bmain, bNodeTree *localtree, bNodeTree *ntree);
void ntreeBlendReadData(BlendDataReader *reader, ID *owner_id, bNodeTree *ntree);
void ntreeBlendReadLib(BlendLibReader *reader, bNodeTree *ntree);
void ntreeBlendReadExpand(BlendExpander *expander, bNodeTree *ntree);
/* -------------------------------------------------------------------- */
/** \name Node Tree Interface
* \{ */

View File

@ -263,34 +263,6 @@ static void action_blend_read_lib(BlendLibReader *reader, ID *id)
}
}
static void blend_read_expand_constraint_channels(BlendExpander *expander, ListBase *chanbase)
{
LISTBASE_FOREACH (bConstraintChannel *, chan, chanbase) {
BLO_expand(expander, chan->ipo);
}
}
static void action_blend_read_expand(BlendExpander *expander, ID *id)
{
bAction *act = (bAction *)id;
/* XXX deprecated - old animation system -------------- */
LISTBASE_FOREACH (bActionChannel *, chan, &act->chanbase) {
BLO_expand(expander, chan->ipo);
blend_read_expand_constraint_channels(expander, &chan->constraintChannels);
}
/* --------------------------------------------------- */
/* F-Curves in Action */
BKE_fcurve_blend_read_expand(expander, &act->curves);
LISTBASE_FOREACH (TimeMarker *, marker, &act->markers) {
if (marker->camera) {
BLO_expand(expander, marker->camera);
}
}
}
static IDProperty *action_asset_type_property(const bAction *action)
{
const bool is_single_frame = BKE_action_has_single_frame(action);
@ -338,7 +310,6 @@ IDTypeInfo IDType_ID_AC = {
/*blend_write*/ action_blend_write,
/*blend_read_data*/ action_blend_read_data,
/*blend_read_lib*/ action_blend_read_lib,
/*blend_read_expand*/ action_blend_read_expand,
/*blend_read_undo_preserve*/ nullptr,
@ -1971,19 +1942,6 @@ void BKE_pose_blend_read_lib(BlendLibReader *reader, Object *ob, bPose *pose)
}
}
void BKE_pose_blend_read_expand(BlendExpander *expander, bPose *pose)
{
if (!pose) {
return;
}
LISTBASE_FOREACH (bPoseChannel *, chan, &pose->chanbase) {
BKE_constraint_blend_read_expand(expander, &chan->constraints);
IDP_BlendReadExpand(expander, chan->prop);
BLO_expand(expander, chan->custom);
}
}
void BKE_action_fcurves_clear(bAction *act)
{
if (!act) {

View File

@ -1519,15 +1519,3 @@ void BKE_animdata_blend_read_lib(BlendLibReader *reader, ID *id, AnimData *adt)
BKE_nla_blend_read_lib(reader, id, &adt->nla_tracks);
}
void BKE_animdata_blend_read_expand(BlendExpander *expander, AnimData *adt)
{
/* own action */
BLO_expand(expander, adt->action);
BLO_expand(expander, adt->tmpact);
/* drivers - assume that these F-Curves have driver data to be in this list... */
BKE_fcurve_blend_read_expand(expander, &adt->drivers);
/* NLA data - referenced actions. */
BKE_nla_blend_read_expand(expander, &adt->nla_tracks);
}

View File

@ -330,15 +330,6 @@ void BKE_keyingsets_blend_read_lib(BlendLibReader *reader, ID *id, ListBase *lis
}
}
void BKE_keyingsets_blend_read_expand(BlendExpander *expander, ListBase *list)
{
LISTBASE_FOREACH (KeyingSet *, ks, list) {
LISTBASE_FOREACH (KS_Path *, ksp, &ks->paths) {
BLO_expand(expander, ksp->id);
}
}
}
/* ***************************************** */
/* Evaluation Data-Setting Backend */

View File

@ -279,23 +279,6 @@ static void armature_blend_read_lib(BlendLibReader *reader, ID *id)
}
}
static void expand_bones(BlendExpander *expander, Bone *bone)
{
IDP_BlendReadExpand(expander, bone->prop);
LISTBASE_FOREACH (Bone *, curBone, &bone->childbase) {
expand_bones(expander, curBone);
}
}
static void armature_blend_read_expand(BlendExpander *expander, ID *id)
{
bArmature *arm = (bArmature *)id;
LISTBASE_FOREACH (Bone *, curBone, &arm->bonebase) {
expand_bones(expander, curBone);
}
}
IDTypeInfo IDType_ID_AR = {
/*id_code*/ ID_AR,
/*id_filter*/ FILTER_ID_AR,
@ -319,7 +302,6 @@ IDTypeInfo IDType_ID_AR = {
/*blend_write*/ armature_blend_write,
/*blend_read_data*/ armature_blend_read_data,
/*blend_read_lib*/ armature_blend_read_lib,
/*blend_read_expand*/ armature_blend_read_expand,
/*blend_read_undo_preserve*/ nullptr,

View File

@ -386,19 +386,6 @@ static void brush_blend_read_lib(BlendLibReader *reader, ID *id)
}
}
static void brush_blend_read_expand(BlendExpander *expander, ID *id)
{
Brush *brush = (Brush *)id;
BLO_expand(expander, brush->mtex.tex);
BLO_expand(expander, brush->mask_mtex.tex);
BLO_expand(expander, brush->clone.image);
BLO_expand(expander, brush->paint_curve);
if (brush->gpencil_settings != nullptr) {
BLO_expand(expander, brush->gpencil_settings->material);
BLO_expand(expander, brush->gpencil_settings->material_alt);
}
}
static int brush_undo_preserve_cb(LibraryIDLinkCallbackData *cb_data)
{
BlendLibReader *reader = (BlendLibReader *)cb_data->user_data;
@ -455,7 +442,6 @@ IDTypeInfo IDType_ID_BR = {
/*blend_write*/ brush_blend_write,
/*blend_read_data*/ brush_blend_read_data,
/*blend_read_lib*/ brush_blend_read_lib,
/*blend_read_expand*/ brush_blend_read_expand,
/*blend_read_undo_preserve*/ brush_undo_preserve,

View File

@ -145,7 +145,6 @@ IDTypeInfo IDType_ID_CF = {
/*blend_write*/ cache_file_blend_write,
/*blend_read_data*/ cache_file_blend_read_data,
/*blend_read_lib*/ nullptr,
/*blend_read_expand*/ nullptr,
/*blend_read_undo_preserve*/ nullptr,

View File

@ -244,17 +244,6 @@ static void camera_blend_read_lib(BlendLibReader *reader, ID *id)
}
}
static void camera_blend_read_expand(BlendExpander *expander, ID *id)
{
Camera *ca = (Camera *)id;
BLO_expand(expander, ca->ipo); // XXX deprecated - old animation system
LISTBASE_FOREACH (CameraBGImage *, bgpic, &ca->bg_images) {
BLO_expand(expander, bgpic->ima);
BLO_expand(expander, bgpic->clip);
}
}
IDTypeInfo IDType_ID_CA = {
/*id_code*/ ID_CA,
/*id_filter*/ FILTER_ID_CA,
@ -278,7 +267,6 @@ IDTypeInfo IDType_ID_CA = {
/*blend_write*/ camera_blend_write,
/*blend_read_data*/ camera_blend_read_data,
/*blend_read_lib*/ camera_blend_read_lib,
/*blend_read_expand*/ camera_blend_read_expand,
/*blend_read_undo_preserve*/ nullptr,

View File

@ -331,23 +331,6 @@ static void collection_blend_read_lib(BlendLibReader *reader, ID *id)
BKE_collection_blend_read_lib(reader, collection);
}
void BKE_collection_blend_read_expand(BlendExpander *expander, Collection *collection)
{
LISTBASE_FOREACH (CollectionObject *, cob, &collection->gobject) {
BLO_expand(expander, cob->ob);
}
LISTBASE_FOREACH (CollectionChild *, child, &collection->children) {
BLO_expand(expander, child->collection);
}
}
static void collection_blend_read_expand(BlendExpander *expander, ID *id)
{
Collection *collection = (Collection *)id;
BKE_collection_blend_read_expand(expander, collection);
}
IDTypeInfo IDType_ID_GR = {
/*id_code*/ ID_GR,
/*id_filter*/ FILTER_ID_GR,
@ -371,7 +354,6 @@ IDTypeInfo IDType_ID_GR = {
/*blend_write*/ collection_blend_write,
/*blend_read_data*/ collection_blend_read_data,
/*blend_read_lib*/ collection_blend_read_lib,
/*blend_read_expand*/ collection_blend_read_expand,
/*blend_read_undo_preserve*/ nullptr,

View File

@ -6595,24 +6595,3 @@ void BKE_constraint_blend_read_lib(BlendLibReader *reader, ID *id, ListBase *con
BKE_constraints_id_loop(conlist, lib_link_constraint_cb, IDWALK_NOP, &cld);
}
/* callback function used to expand constraint ID-links */
static void expand_constraint_cb(bConstraint * /*con*/,
ID **idpoin,
bool /*is_reference*/,
void *userdata)
{
BlendExpander *expander = static_cast<BlendExpander *>(userdata);
BLO_expand(expander, *idpoin);
}
void BKE_constraint_blend_read_expand(BlendExpander *expander, ListBase *lb)
{
BKE_constraints_id_loop(lb, expand_constraint_cb, IDWALK_NOP, expander);
/* deprecated manual expansion stuff */
LISTBASE_FOREACH (bConstraint *, curcon, lb) {
if (curcon->ipo) {
BLO_expand(expander, curcon->ipo); /* XXX deprecated - old animation system */
}
}
}

View File

@ -291,24 +291,6 @@ static void curve_blend_read_lib(BlendLibReader *reader, ID *id)
BLO_read_id_address(reader, id, &cu->key);
}
static void curve_blend_read_expand(BlendExpander *expander, ID *id)
{
Curve *cu = (Curve *)id;
for (int a = 0; a < cu->totcol; a++) {
BLO_expand(expander, cu->mat[a]);
}
BLO_expand(expander, cu->vfont);
BLO_expand(expander, cu->vfontb);
BLO_expand(expander, cu->vfonti);
BLO_expand(expander, cu->vfontbi);
BLO_expand(expander, cu->key);
BLO_expand(expander, cu->ipo); /* XXX deprecated - old animation system */
BLO_expand(expander, cu->bevobj);
BLO_expand(expander, cu->taperobj);
BLO_expand(expander, cu->textoncurve);
}
IDTypeInfo IDType_ID_CU_LEGACY = {
/*id_code*/ ID_CU_LEGACY,
/*id_filter*/ FILTER_ID_CU_LEGACY,
@ -332,7 +314,6 @@ IDTypeInfo IDType_ID_CU_LEGACY = {
/*blend_write*/ curve_blend_write,
/*blend_read_data*/ curve_blend_read_data,
/*blend_read_lib*/ curve_blend_read_lib,
/*blend_read_expand*/ curve_blend_read_expand,
/*blend_read_undo_preserve*/ nullptr,

View File

@ -139,15 +139,6 @@ static void curves_blend_read_lib(BlendLibReader *reader, ID *id)
BLO_read_id_address(reader, id, &curves->surface);
}
static void curves_blend_read_expand(BlendExpander *expander, ID *id)
{
Curves *curves = (Curves *)id;
for (int a = 0; a < curves->totcol; a++) {
BLO_expand(expander, curves->mat[a]);
}
BLO_expand(expander, curves->surface);
}
IDTypeInfo IDType_ID_CV = {
/*id_code*/ ID_CV,
/*id_filter*/ FILTER_ID_CV,
@ -171,7 +162,6 @@ IDTypeInfo IDType_ID_CV = {
/*blend_write*/ curves_blend_write,
/*blend_read_data*/ curves_blend_read_data,
/*blend_read_lib*/ curves_blend_read_lib,
/*blend_read_expand*/ curves_blend_read_expand,
/*blend_read_undo_preserve*/ nullptr,

View File

@ -2521,20 +2521,6 @@ void BKE_fmodifiers_blend_read_lib(BlendLibReader *reader, ID *id, ListBase *fmo
}
}
void BKE_fmodifiers_blend_read_expand(BlendExpander *expander, ListBase *fmodifiers)
{
LISTBASE_FOREACH (FModifier *, fcm, fmodifiers) {
/* library data for specific F-Modifier types */
switch (fcm->type) {
case FMODIFIER_TYPE_PYTHON: {
FMod_Python *data = (FMod_Python *)fcm->data;
BLO_expand(expander, data->script);
break;
}
}
}
}
void BKE_fcurve_blend_write(BlendWriter *writer, ListBase *fcurves)
{
BLO_write_struct_list(writer, FCurve, fcurves);
@ -2654,25 +2640,4 @@ void BKE_fcurve_blend_read_lib(BlendLibReader *reader, ID *id, ListBase *fcurves
}
}
void BKE_fcurve_blend_read_expand(BlendExpander *expander, ListBase *fcurves)
{
LISTBASE_FOREACH (FCurve *, fcu, fcurves) {
/* Driver targets if there is a driver */
if (fcu->driver) {
ChannelDriver *driver = fcu->driver;
LISTBASE_FOREACH (DriverVar *, dvar, &driver->variables) {
DRIVER_TARGETS_LOOPER_BEGIN (dvar) {
/* TODO: only expand those that are going to get used? */
BLO_expand(expander, dtar->id);
}
DRIVER_TARGETS_LOOPER_END;
}
}
/* F-Curve Modifiers */
BKE_fmodifiers_blend_read_expand(expander, &fcu->modifiers);
}
}
/** \} */

View File

@ -279,18 +279,6 @@ static void greasepencil_blend_read_lib(BlendLibReader *reader, ID *id)
}
}
static void greasepencil_blend_read_expand(BlendExpander *expander, ID *id)
{
bGPdata *gpd = (bGPdata *)id;
LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
BLO_expand(expander, gpl->parent);
}
for (int a = 0; a < gpd->totcol; a++) {
BLO_expand(expander, gpd->mat[a]);
}
}
IDTypeInfo IDType_ID_GD_LEGACY = {
/*id_code*/ ID_GD_LEGACY,
/*id_filter*/ FILTER_ID_GD_LEGACY,
@ -314,7 +302,6 @@ IDTypeInfo IDType_ID_GD_LEGACY = {
/*blend_write*/ greasepencil_blend_write,
/*blend_read_data*/ greasepencil_blend_read_data,
/*blend_read_lib*/ greasepencil_blend_read_lib,
/*blend_read_expand*/ greasepencil_blend_read_expand,
/*blend_read_undo_preserve*/ nullptr,

View File

@ -208,22 +208,6 @@ static void grease_pencil_blend_read_lib(BlendLibReader *reader, ID *id)
}
}
static void grease_pencil_blend_read_expand(BlendExpander *expander, ID *id)
{
GreasePencil *grease_pencil = reinterpret_cast<GreasePencil *>(id);
for (int i = 0; i < grease_pencil->material_array_num; i++) {
BLO_expand(expander, grease_pencil->material_array[i]);
}
for (int i = 0; i < grease_pencil->drawing_array_num; i++) {
GreasePencilDrawingBase *drawing_base = grease_pencil->drawing_array[i];
if (drawing_base->type == GP_DRAWING_REFERENCE) {
GreasePencilDrawingReference *drawing_reference =
reinterpret_cast<GreasePencilDrawingReference *>(drawing_base);
BLO_expand(expander, drawing_reference->id_reference);
}
}
}
IDTypeInfo IDType_ID_GP = {
/*id_code*/ ID_GP,
/*id_filter*/ FILTER_ID_GP,
@ -247,7 +231,6 @@ IDTypeInfo IDType_ID_GP = {
/*blend_write*/ grease_pencil_blend_write,
/*blend_read_data*/ grease_pencil_blend_read_data,
/*blend_read_lib*/ grease_pencil_blend_read_lib,
/*blend_read_expand*/ grease_pencil_blend_read_expand,
/*blend_read_undo_preserve*/ nullptr,

View File

@ -1515,31 +1515,6 @@ void IDP_BlendReadLib(BlendLibReader *reader, ID *self_id, IDProperty *prop)
}
}
void IDP_BlendReadExpand(BlendExpander *expander, IDProperty *prop)
{
if (!prop) {
return;
}
switch (prop->type) {
case IDP_ID:
BLO_expand(expander, IDP_Id(prop));
break;
case IDP_IDPARRAY: {
IDProperty *idp_array = IDP_IDPArray(prop);
for (int i = 0; i < prop->len; i++) {
IDP_BlendReadExpand(expander, &idp_array[i]);
}
break;
}
case IDP_GROUP:
LISTBASE_FOREACH (IDProperty *, loop, &prop->data.group) {
IDP_BlendReadExpand(expander, loop);
}
break;
}
}
eIDPropertyUIDataType IDP_ui_data_type(const IDProperty *prop)
{
if (prop->type == IDP_STRING) {

View File

@ -456,7 +456,6 @@ constexpr IDTypeInfo get_type_info()
info.blend_write = image_blend_write;
info.blend_read_data = image_blend_read_data;
info.blend_read_lib = image_blend_read_lib;
info.blend_read_expand = nullptr;
info.blend_read_undo_preserve = nullptr;

View File

@ -165,17 +165,6 @@ static void ipo_blend_read_lib(BlendLibReader *reader, ID *id)
}
}
static void ipo_blend_read_expand(BlendExpander *expander, ID *id)
{
Ipo *ipo = (Ipo *)id;
LISTBASE_FOREACH (IpoCurve *, icu, &ipo->curve) {
if (icu->driver) {
BLO_expand(expander, icu->driver->ob);
}
}
}
IDTypeInfo IDType_ID_IP = {
/*id_code*/ ID_IP,
/*id_filter*/ 0,
@ -199,7 +188,6 @@ IDTypeInfo IDType_ID_IP = {
/*blend_write*/ nullptr,
/*blend_read_data*/ ipo_blend_read_data,
/*blend_read_lib*/ ipo_blend_read_lib,
/*blend_read_expand*/ ipo_blend_read_expand,
/*blend_read_undo_preserve*/ nullptr,

View File

@ -188,12 +188,6 @@ static void shapekey_blend_read_lib(BlendLibReader *reader, ID *id)
BLO_read_id_address(reader, id, &key->from);
}
static void shapekey_blend_read_expand(BlendExpander *expander, ID *id)
{
Key *key = (Key *)id;
BLO_expand(expander, key->ipo); /* XXX deprecated - old animation system */
}
IDTypeInfo IDType_ID_KE = {
/*id_code*/ ID_KE,
/*id_filter*/ FILTER_ID_KE,
@ -219,7 +213,6 @@ IDTypeInfo IDType_ID_KE = {
/*blend_write*/ shapekey_blend_write,
/*blend_read_data*/ shapekey_blend_read_data,
/*blend_read_lib*/ shapekey_blend_read_lib,
/*blend_read_expand*/ shapekey_blend_read_expand,
/*blend_read_undo_preserve*/ nullptr,

View File

@ -166,13 +166,6 @@ static void lattice_blend_read_lib(BlendLibReader *reader, ID *id)
BLO_read_id_address(reader, id, &lt->key);
}
static void lattice_blend_read_expand(BlendExpander *expander, ID *id)
{
Lattice *lt = (Lattice *)id;
BLO_expand(expander, lt->ipo); // XXX deprecated - old animation system
BLO_expand(expander, lt->key);
}
IDTypeInfo IDType_ID_LT = {
/*id_code*/ ID_LT,
/*id_filter*/ FILTER_ID_LT,
@ -196,7 +189,6 @@ IDTypeInfo IDType_ID_LT = {
/*blend_write*/ lattice_blend_write,
/*blend_read_data*/ lattice_blend_read_data,
/*blend_read_lib*/ lattice_blend_read_lib,
/*blend_read_expand*/ lattice_blend_read_expand,
/*blend_read_undo_preserve*/ nullptr,

View File

@ -101,7 +101,6 @@ IDTypeInfo IDType_ID_LINK_PLACEHOLDER = {
/*blend_write*/ nullptr,
/*blend_read_data*/ nullptr,
/*blend_read_lib*/ nullptr,
/*blend_read_expand*/ nullptr,
/*blend_read_undo_preserve*/ nullptr,

View File

@ -105,7 +105,6 @@ IDTypeInfo IDType_ID_LI = {
/*blend_write*/ nullptr,
/*blend_read_data*/ library_blend_read_data,
/*blend_read_lib*/ nullptr,
/*blend_read_expand*/ nullptr,
/*blend_read_undo_preserve*/ nullptr,

View File

@ -160,12 +160,6 @@ static void light_blend_read_lib(BlendLibReader *reader, ID *id)
BLO_read_id_address(reader, id, &la->ipo); // XXX deprecated - old animation system
}
static void light_blend_read_expand(BlendExpander *expander, ID *id)
{
Light *la = (Light *)id;
BLO_expand(expander, la->ipo); // XXX deprecated - old animation system
}
IDTypeInfo IDType_ID_LA = {
/*id_code*/ ID_LA,
/*id_filter*/ FILTER_ID_LA,
@ -189,7 +183,6 @@ IDTypeInfo IDType_ID_LA = {
/*blend_write*/ light_blend_write,
/*blend_read_data*/ light_blend_read_data,
/*blend_read_lib*/ light_blend_read_lib,
/*blend_read_expand*/ light_blend_read_expand,
/*blend_read_undo_preserve*/ nullptr,

View File

@ -81,7 +81,6 @@ IDTypeInfo IDType_ID_LP = {
/*blend_write*/ lightprobe_blend_write,
/*blend_read_data*/ nullptr,
/*blend_read_lib*/ lightprobe_blend_read_lib,
/*blend_read_expand*/ nullptr,
/*blend_read_undo_preserve*/ nullptr,

View File

@ -684,34 +684,6 @@ static void linestyle_blend_read_lib(BlendLibReader *reader, ID *id)
}
}
static void linestyle_blend_read_expand(BlendExpander *expander, ID *id)
{
FreestyleLineStyle *linestyle = (FreestyleLineStyle *)id;
for (int a = 0; a < MAX_MTEX; a++) {
if (linestyle->mtex[a]) {
BLO_expand(expander, linestyle->mtex[a]->tex);
BLO_expand(expander, linestyle->mtex[a]->object);
}
}
LISTBASE_FOREACH (LineStyleModifier *, m, &linestyle->color_modifiers) {
if (m->type == LS_MODIFIER_DISTANCE_FROM_OBJECT) {
BLO_expand(expander, ((LineStyleColorModifier_DistanceFromObject *)m)->target);
}
}
LISTBASE_FOREACH (LineStyleModifier *, m, &linestyle->alpha_modifiers) {
if (m->type == LS_MODIFIER_DISTANCE_FROM_OBJECT) {
BLO_expand(expander, ((LineStyleAlphaModifier_DistanceFromObject *)m)->target);
}
}
LISTBASE_FOREACH (LineStyleModifier *, m, &linestyle->thickness_modifiers) {
if (m->type == LS_MODIFIER_DISTANCE_FROM_OBJECT) {
BLO_expand(expander, ((LineStyleThicknessModifier_DistanceFromObject *)m)->target);
}
}
}
IDTypeInfo IDType_ID_LS = {
/*id_code*/ ID_LS,
/*id_filter*/ FILTER_ID_LS,
@ -735,7 +707,6 @@ IDTypeInfo IDType_ID_LS = {
/*blend_write*/ linestyle_blend_write,
/*blend_read_data*/ linestyle_blend_read_data,
/*blend_read_lib*/ linestyle_blend_read_lib,
/*blend_read_expand*/ linestyle_blend_read_expand,
/*blend_read_undo_preserve*/ nullptr,

View File

@ -205,28 +205,6 @@ static void mask_blend_read_lib(BlendLibReader *reader, ID *id)
}
}
static void expand_mask_parent(BlendExpander *expander, MaskParent *parent)
{
if (parent->id) {
BLO_expand(expander, parent->id);
}
}
static void mask_blend_read_expand(BlendExpander *expander, ID *id)
{
Mask *mask = (Mask *)id;
LISTBASE_FOREACH (MaskLayer *, mask_layer, &mask->masklayers) {
LISTBASE_FOREACH (MaskSpline *, spline, &mask_layer->splines) {
for (int i = 0; i < spline->tot_point; i++) {
MaskSplinePoint *point = &spline->points[i];
expand_mask_parent(expander, &point->parent);
}
expand_mask_parent(expander, &spline->parent);
}
}
}
IDTypeInfo IDType_ID_MSK = {
/*id_code*/ ID_MSK,
/*id_filter*/ FILTER_ID_MSK,
@ -250,7 +228,6 @@ IDTypeInfo IDType_ID_MSK = {
/*blend_write*/ mask_blend_write,
/*blend_read_data*/ mask_blend_read_data,
/*blend_read_lib*/ mask_blend_read_lib,
/*blend_read_expand*/ mask_blend_read_expand,
/*blend_read_undo_preserve*/ nullptr,

View File

@ -243,18 +243,6 @@ static void material_blend_read_lib(BlendLibReader *reader, ID *id)
}
}
static void material_blend_read_expand(BlendExpander *expander, ID *id)
{
Material *ma = (Material *)id;
BLO_expand(expander, ma->ipo); /* XXX deprecated - old animation system */
if (ma->gp_style) {
MaterialGPencilStyle *gp_style = ma->gp_style;
BLO_expand(expander, gp_style->sima);
BLO_expand(expander, gp_style->ima);
}
}
IDTypeInfo IDType_ID_MA = {
/*id_code*/ ID_MA,
/*id_filter*/ FILTER_ID_MA,
@ -278,7 +266,6 @@ IDTypeInfo IDType_ID_MA = {
/*blend_write*/ material_blend_write,
/*blend_read_data*/ material_blend_read_data,
/*blend_read_lib*/ material_blend_read_lib,
/*blend_read_expand*/ material_blend_read_expand,
/*blend_read_undo_preserve*/ nullptr,

View File

@ -151,14 +151,6 @@ static void metaball_blend_read_lib(BlendLibReader *reader, ID *id)
BLO_read_id_address(reader, id, &mb->ipo); // XXX deprecated - old animation system
}
static void metaball_blend_read_expand(BlendExpander *expander, ID *id)
{
MetaBall *mb = (MetaBall *)id;
for (int a = 0; a < mb->totcol; a++) {
BLO_expand(expander, mb->mat[a]);
}
}
IDTypeInfo IDType_ID_MB = {
/*id_code*/ ID_MB,
/*id_filter*/ FILTER_ID_MB,
@ -182,7 +174,6 @@ IDTypeInfo IDType_ID_MB = {
/*blend_write*/ metaball_blend_write,
/*blend_read_data*/ metaball_blend_read_data,
/*blend_read_lib*/ metaball_blend_read_lib,
/*blend_read_expand*/ metaball_blend_read_expand,
/*blend_read_undo_preserve*/ nullptr,

View File

@ -371,17 +371,6 @@ static void mesh_blend_read_lib(BlendLibReader *reader, ID *id)
BLO_read_id_address(reader, id, &me->texcomesh);
}
static void mesh_read_expand(BlendExpander *expander, ID *id)
{
Mesh *me = reinterpret_cast<Mesh *>(id);
for (int a = 0; a < me->totcol; a++) {
BLO_expand(expander, me->mat[a]);
}
BLO_expand(expander, me->key);
BLO_expand(expander, me->texcomesh);
}
IDTypeInfo IDType_ID_ME = {
/*id_code*/ ID_ME,
/*id_filter*/ FILTER_ID_ME,
@ -405,7 +394,6 @@ IDTypeInfo IDType_ID_ME = {
/*blend_write*/ mesh_blend_write,
/*blend_read_data*/ mesh_blend_read_data,
/*blend_read_lib*/ mesh_blend_read_lib,
/*blend_read_expand*/ mesh_read_expand,
/*blend_read_undo_preserve*/ nullptr,

View File

@ -329,7 +329,6 @@ IDTypeInfo IDType_ID_MC = {
/*blend_write*/ movieclip_blend_write,
/*blend_read_data*/ movieclip_blend_read_data,
/*blend_read_lib*/ movieclip_blend_read_lib,
/*blend_read_expand*/ nullptr,
/*blend_read_undo_preserve*/ nullptr,

View File

@ -2371,23 +2371,6 @@ static void blend_lib_read_nla_strips(BlendLibReader *reader, ID *id, ListBase *
}
}
static void blend_read_expand_nla_strips(BlendExpander *expander, ListBase *strips)
{
LISTBASE_FOREACH (NlaStrip *, strip, strips) {
/* check child strips */
blend_read_expand_nla_strips(expander, &strip->strips);
/* check F-Curves */
BKE_fcurve_blend_read_expand(expander, &strip->fcurves);
/* check F-Modifiers */
BKE_fmodifiers_blend_read_expand(expander, &strip->modifiers);
/* relink referenced action */
BLO_expand(expander, strip->act);
}
}
void BKE_nla_blend_write(BlendWriter *writer, ListBase *tracks)
{
/* write all the tracks */
@ -2424,10 +2407,3 @@ void BKE_nla_blend_read_lib(BlendLibReader *reader, ID *id, ListBase *tracks)
}
}
void BKE_nla_blend_read_expand(BlendExpander *expander, ListBase *tracks)
{
/* nla-data - referenced actions */
LISTBASE_FOREACH (NlaTrack *, nlt, tracks) {
blend_read_expand_nla_strips(expander, &nlt->strips);
}
}

View File

@ -1047,85 +1047,6 @@ static void ntree_blend_read_lib(BlendLibReader *reader, ID *id)
ntreeBlendReadLib(reader, ntree);
}
static void expand_node_socket(BlendExpander *expander, bNodeSocket *sock)
{
IDP_BlendReadExpand(expander, sock->prop);
if (sock->default_value == nullptr) {
return;
}
switch (eNodeSocketDatatype(sock->type)) {
case SOCK_OBJECT: {
BLO_expand(expander, sock->default_value_typed<bNodeSocketValueObject>()->value);
break;
}
case SOCK_IMAGE: {
BLO_expand(expander, sock->default_value_typed<bNodeSocketValueImage>()->value);
break;
}
case SOCK_COLLECTION: {
BLO_expand(expander, sock->default_value_typed<bNodeSocketValueCollection>()->value);
break;
}
case SOCK_TEXTURE: {
BLO_expand(expander, sock->default_value_typed<bNodeSocketValueTexture>()->value);
break;
}
case SOCK_MATERIAL: {
BLO_expand(expander, sock->default_value_typed<bNodeSocketValueMaterial>()->value);
break;
}
case SOCK_FLOAT:
case SOCK_VECTOR:
case SOCK_RGBA:
case SOCK_BOOLEAN:
case SOCK_ROTATION:
case SOCK_INT:
case SOCK_STRING:
case SOCK_CUSTOM:
case SOCK_SHADER:
case SOCK_GEOMETRY:
break;
}
}
static void expand_node_sockets(BlendExpander *expander, ListBase *sockets)
{
LISTBASE_FOREACH (bNodeSocket *, sock, sockets) {
expand_node_socket(expander, sock);
}
}
void ntreeBlendReadExpand(BlendExpander *expander, bNodeTree *ntree)
{
if (ntree->gpd) {
BLO_expand(expander, ntree->gpd);
}
LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
if (node->id && !(node->type == CMP_NODE_R_LAYERS) &&
!(node->type == CMP_NODE_CRYPTOMATTE && node->custom1 == CMP_CRYPTOMATTE_SRC_RENDER))
{
BLO_expand(expander, node->id);
}
IDP_BlendReadExpand(expander, node->prop);
expand_node_sockets(expander, &node->inputs);
expand_node_sockets(expander, &node->outputs);
}
expand_node_sockets(expander, &ntree->inputs);
expand_node_sockets(expander, &ntree->outputs);
}
static void ntree_blend_read_expand(BlendExpander *expander, ID *id)
{
bNodeTree *ntree = reinterpret_cast<bNodeTree *>(id);
ntreeBlendReadExpand(expander, ntree);
}
static void node_tree_asset_pre_save(void *asset_ptr, AssetMetaData *asset_data)
{
bNodeTree &node_tree = *static_cast<bNodeTree *>(asset_ptr);
@ -1179,7 +1100,6 @@ IDTypeInfo IDType_ID_NT = {
/*blend_write*/ blender::bke::ntree_blend_write,
/*blend_read_data*/ blender::bke::ntree_blend_read_data,
/*blend_read_lib*/ blender::bke::ntree_blend_read_lib,
/*blend_read_expand*/ blender::bke::ntree_blend_read_expand,
/*blend_read_undo_preserve*/ nullptr,

View File

@ -376,42 +376,6 @@ static void socket_data_read_lib(BlendLibReader *reader, ID *id, bNodeTreeInterf
/** \} */
/* -------------------------------------------------------------------- */
/** \name Expand Socket Data
* \{ */
template<typename T> void socket_data_expand_impl(BlendExpander * /*expander*/, T & /*data*/) {}
template<> void socket_data_expand_impl(BlendExpander *expander, bNodeSocketValueObject &data)
{
BLO_expand(expander, &data.value);
}
template<> void socket_data_expand_impl(BlendExpander *expander, bNodeSocketValueImage &data)
{
BLO_expand(expander, &data.value);
}
template<> void socket_data_expand_impl(BlendExpander *expander, bNodeSocketValueCollection &data)
{
BLO_expand(expander, &data.value);
}
template<> void socket_data_expand_impl(BlendExpander *expander, bNodeSocketValueTexture &data)
{
BLO_expand(expander, &data.value);
}
template<> void socket_data_expand_impl(BlendExpander *expander, bNodeSocketValueMaterial &data)
{
BLO_expand(expander, &data.value);
}
static void socket_data_expand(BlendExpander *expander, bNodeTreeInterfaceSocket &socket)
{
socket_data_to_static_type_tag(socket.socket_type, [&](auto type_tag) {
using SocketDataType = typename decltype(type_tag)::type;
socket_data_expand_impl(expander, get_socket_data_as<SocketDataType>(socket));
});
}
/** \} */
/* -------------------------------------------------------------------- */
/** \name Callback per ID Pointer
* \{ */
@ -624,25 +588,6 @@ static void item_read_lib(BlendLibReader *reader, ID *id, bNodeTreeInterfaceItem
}
}
static void item_read_expand(BlendExpander *expander, bNodeTreeInterfaceItem &item)
{
switch (item.item_type) {
case NODE_INTERFACE_SOCKET: {
bNodeTreeInterfaceSocket &socket = reinterpret_cast<bNodeTreeInterfaceSocket &>(item);
IDP_BlendReadExpand(expander, socket.properties);
socket_types::socket_data_expand(expander, socket);
break;
}
case NODE_INTERFACE_PANEL: {
bNodeTreeInterfacePanel &panel = reinterpret_cast<bNodeTreeInterfacePanel &>(item);
for (bNodeTreeInterfaceItem *item : panel.items()) {
item_read_expand(expander, *item);
}
break;
}
}
}
static void item_foreach_id(LibraryForeachIDData *data, bNodeTreeInterfaceItem &item)
{
switch (item.item_type) {
@ -1096,11 +1041,6 @@ void bNodeTreeInterface::read_lib(BlendLibReader *reader, ID *id)
item_types::item_read_lib(reader, id, this->root_panel.item);
}
void bNodeTreeInterface::read_expand(BlendExpander *expander)
{
item_types::item_read_expand(expander, this->root_panel.item);
}
bNodeTreeInterfaceItem *bNodeTreeInterface::active_item()
{
bNodeTreeInterfaceItem *active = nullptr;

View File

@ -1029,23 +1029,6 @@ static void object_blend_read_lib(BlendLibReader *reader, ID *id)
}
}
/* XXX deprecated - old animation system */
static void expand_constraint_channels(BlendExpander *expander, ListBase *chanbase)
{
LISTBASE_FOREACH (bConstraintChannel *, chan, chanbase) {
BLO_expand(expander, chan->ipo);
}
}
static void expand_object_expandModifiers(void *user_data,
Object * /*ob*/,
ID **idpoin,
int /*cb_flag*/)
{
BlendExpander *expander = (BlendExpander *)user_data;
BLO_expand(expander, *idpoin);
}
PartEff *BKE_object_do_version_give_parteff_245(Object *ob)
{
PartEff *paf;
@ -1060,97 +1043,6 @@ PartEff *BKE_object_do_version_give_parteff_245(Object *ob)
return nullptr;
}
static void object_blend_read_expand(BlendExpander *expander, ID *id)
{
Object *ob = (Object *)id;
BLO_expand(expander, ob->data);
BLO_expand(expander, ob->parent);
/* expand_object_expandModifier() */
if (ob->modifiers.first) {
BKE_modifiers_foreach_ID_link(ob, expand_object_expandModifiers, expander);
}
/* expand_object_expandModifier() */
if (ob->greasepencil_modifiers.first) {
BKE_gpencil_modifiers_foreach_ID_link(ob, expand_object_expandModifiers, expander);
}
/* expand_object_expandShaderFx() */
if (ob->shader_fx.first) {
BKE_shaderfx_foreach_ID_link(ob, expand_object_expandModifiers, expander);
}
BKE_pose_blend_read_expand(expander, ob->pose);
BLO_expand(expander, ob->poselib);
BKE_constraint_blend_read_expand(expander, &ob->constraints);
BLO_expand(expander, ob->gpd);
/* XXX deprecated - old animation system (for version patching only) */
BLO_expand(expander, ob->ipo);
BLO_expand(expander, ob->action);
expand_constraint_channels(expander, &ob->constraintChannels);
LISTBASE_FOREACH (bActionStrip *, strip, &ob->nlastrips) {
BLO_expand(expander, strip->object);
BLO_expand(expander, strip->act);
BLO_expand(expander, strip->ipo);
}
/* XXX deprecated - old animation system (for version patching only) */
for (int a = 0; a < ob->totcol; a++) {
BLO_expand(expander, ob->mat[a]);
}
PartEff *paf = BKE_object_do_version_give_parteff_245(ob);
if (paf && paf->group) {
BLO_expand(expander, paf->group);
}
if (ob->instance_collection) {
BLO_expand(expander, ob->instance_collection);
}
if (ob->proxy) {
BLO_expand(expander, ob->proxy);
}
if (ob->proxy_group) {
BLO_expand(expander, ob->proxy_group);
}
LISTBASE_FOREACH (ParticleSystem *, psys, &ob->particlesystem) {
BLO_expand(expander, psys->part);
}
if (ob->pd) {
BLO_expand(expander, ob->pd->tex);
BLO_expand(expander, ob->pd->f_source);
}
if (ob->soft) {
BLO_expand(expander, ob->soft->collision_group);
if (ob->soft->effector_weights) {
BLO_expand(expander, ob->soft->effector_weights->group);
}
}
if (ob->rigidbody_constraint) {
BLO_expand(expander, ob->rigidbody_constraint->ob1);
BLO_expand(expander, ob->rigidbody_constraint->ob2);
}
/* Light and shadow linking. */
if (ob->light_linking) {
BLO_expand(expander, ob->light_linking->receiver_collection);
BLO_expand(expander, ob->light_linking->blocker_collection);
}
}
static void object_lib_override_apply_post(ID *id_dst, ID *id_src)
{
/* id_dst is the new local override copy of the linked reference data. id_src is the old override
@ -1274,7 +1166,6 @@ IDTypeInfo IDType_ID_OB = {
/*blend_write*/ object_blend_write,
/*blend_read_data*/ object_blend_read_data,
/*blend_read_lib*/ object_blend_read_lib,
/*blend_read_expand*/ object_blend_read_expand,
/*blend_read_undo_preserve*/ nullptr,

View File

@ -161,7 +161,6 @@ IDTypeInfo IDType_ID_PAL = {
/*blend_write*/ palette_blend_write,
/*blend_read_data*/ palette_blend_read_data,
/*blend_read_lib*/ nullptr,
/*blend_read_expand*/ nullptr,
/*blend_read_undo_preserve*/ palette_undo_preserve,
@ -229,7 +228,6 @@ IDTypeInfo IDType_ID_PC = {
/*blend_write*/ paint_curve_blend_write,
/*blend_read_data*/ paint_curve_blend_read_data,
/*blend_read_lib*/ nullptr,
/*blend_read_expand*/ nullptr,
/*blend_read_undo_preserve*/ nullptr,

View File

@ -435,55 +435,6 @@ static void particle_settings_blend_read_lib(BlendLibReader *reader, ID *id)
}
}
static void particle_settings_blend_read_expand(BlendExpander *expander, ID *id)
{
ParticleSettings *part = (ParticleSettings *)id;
BLO_expand(expander, part->instance_object);
BLO_expand(expander, part->instance_collection);
BLO_expand(expander, part->force_group);
BLO_expand(expander, part->bb_ob);
BLO_expand(expander, part->collision_group);
for (int a = 0; a < MAX_MTEX; a++) {
if (part->mtex[a]) {
BLO_expand(expander, part->mtex[a]->tex);
BLO_expand(expander, part->mtex[a]->object);
}
}
if (part->effector_weights) {
BLO_expand(expander, part->effector_weights->group);
}
if (part->pd) {
BLO_expand(expander, part->pd->tex);
BLO_expand(expander, part->pd->f_source);
}
if (part->pd2) {
BLO_expand(expander, part->pd2->tex);
BLO_expand(expander, part->pd2->f_source);
}
if (part->boids) {
LISTBASE_FOREACH (BoidState *, state, &part->boids->states) {
LISTBASE_FOREACH (BoidRule *, rule, &state->rules) {
if (rule->type == eBoidRuleType_Avoid) {
BoidRuleGoalAvoid *gabr = (BoidRuleGoalAvoid *)rule;
BLO_expand(expander, gabr->ob);
}
else if (rule->type == eBoidRuleType_FollowLeader) {
BoidRuleFollowLeader *flbr = (BoidRuleFollowLeader *)rule;
BLO_expand(expander, flbr->ob);
}
}
}
}
LISTBASE_FOREACH (ParticleDupliWeight *, dw, &part->instance_weights) {
BLO_expand(expander, dw->ob);
}
}
IDTypeInfo IDType_ID_PA = {
/*id_code*/ ID_PA,
/*id_filter*/ FILTER_ID_PA,
@ -507,7 +458,6 @@ IDTypeInfo IDType_ID_PA = {
/*blend_write*/ particle_settings_blend_write,
/*blend_read_data*/ particle_settings_blend_read_data,
/*blend_read_lib*/ particle_settings_blend_read_lib,
/*blend_read_expand*/ particle_settings_blend_read_expand,
/*blend_read_undo_preserve*/ nullptr,

View File

@ -149,14 +149,6 @@ static void pointcloud_blend_read_lib(BlendLibReader *reader, ID *id)
}
}
static void pointcloud_blend_read_expand(BlendExpander *expander, ID *id)
{
PointCloud *pointcloud = (PointCloud *)id;
for (int a = 0; a < pointcloud->totcol; a++) {
BLO_expand(expander, pointcloud->mat[a]);
}
}
IDTypeInfo IDType_ID_PT = {
/*id_code*/ ID_PT,
/*id_filter*/ FILTER_ID_PT,
@ -180,7 +172,6 @@ IDTypeInfo IDType_ID_PT = {
/*blend_write*/ pointcloud_blend_write,
/*blend_read_data*/ pointcloud_blend_read_data,
/*blend_read_lib*/ pointcloud_blend_read_lib,
/*blend_read_expand*/ pointcloud_blend_read_expand,
/*blend_read_undo_preserve*/ nullptr,

View File

@ -1662,82 +1662,6 @@ static void scene_blend_read_lib(BlendLibReader *reader, ID *id)
#endif
}
static void scene_blend_read_expand(BlendExpander *expander, ID *id)
{
Scene *sce = (Scene *)id;
LISTBASE_FOREACH (Base *, base_legacy, &sce->base) {
BLO_expand(expander, base_legacy->object);
}
BLO_expand(expander, sce->camera);
BLO_expand(expander, sce->world);
BKE_keyingsets_blend_read_expand(expander, &sce->keyingsets);
if (sce->set) {
BLO_expand(expander, sce->set);
}
LISTBASE_FOREACH (SceneRenderLayer *, srl, &sce->r.layers) {
BLO_expand(expander, srl->mat_override);
LISTBASE_FOREACH (FreestyleModuleConfig *, module, &srl->freestyleConfig.modules) {
if (module->script) {
BLO_expand(expander, module->script);
}
}
LISTBASE_FOREACH (FreestyleLineSet *, lineset, &srl->freestyleConfig.linesets) {
if (lineset->group) {
BLO_expand(expander, lineset->group);
}
BLO_expand(expander, lineset->linestyle);
}
}
LISTBASE_FOREACH (ViewLayer *, view_layer, &sce->view_layers) {
IDP_BlendReadExpand(expander, view_layer->id_properties);
LISTBASE_FOREACH (FreestyleModuleConfig *, module, &view_layer->freestyle_config.modules) {
if (module->script) {
BLO_expand(expander, module->script);
}
}
LISTBASE_FOREACH (FreestyleLineSet *, lineset, &view_layer->freestyle_config.linesets) {
if (lineset->group) {
BLO_expand(expander, lineset->group);
}
BLO_expand(expander, lineset->linestyle);
}
}
if (sce->gpd) {
BLO_expand(expander, sce->gpd);
}
if (sce->ed) {
SEQ_blend_read_expand(expander, &sce->ed->seqbase);
}
if (sce->rigidbody_world) {
BLO_expand(expander, sce->rigidbody_world->group);
BLO_expand(expander, sce->rigidbody_world->constraints);
}
LISTBASE_FOREACH (TimeMarker *, marker, &sce->markers) {
IDP_BlendReadExpand(expander, marker->prop);
if (marker->camera) {
BLO_expand(expander, marker->camera);
}
}
BLO_expand(expander, sce->clip);
if (sce->r.bake.cage_object) {
BLO_expand(expander, sce->r.bake.cage_object);
}
}
static void scene_undo_preserve(BlendLibReader *reader, ID *id_new, ID *id_old)
{
Scene *scene_new = (Scene *)id_new;
@ -1794,7 +1718,6 @@ constexpr IDTypeInfo get_type_info()
info.blend_write = scene_blend_write;
info.blend_read_data = scene_blend_read_data;
info.blend_read_lib = scene_blend_read_lib;
info.blend_read_expand = scene_blend_read_expand;
info.blend_read_undo_preserve = scene_undo_preserve;

View File

@ -185,7 +185,6 @@ IDTypeInfo IDType_ID_SCR = {
/* Cannot be used yet, because #direct_link_screen has a return value. */
/*blend_read_data*/ nullptr,
/*blend_read_lib*/ screen_blend_read_lib,
/*blend_read_expand*/ nullptr,
/*blend_read_undo_preserve*/ nullptr,

View File

@ -196,12 +196,6 @@ static void sound_blend_read_lib(BlendLibReader *reader, ID *id)
BLO_read_id_address(reader, id, &sound->ipo);
}
static void sound_blend_read_expand(BlendExpander *expander, ID *id)
{
bSound *snd = (bSound *)id;
BLO_expand(expander, snd->ipo); /* XXX deprecated - old animation system */
}
IDTypeInfo IDType_ID_SO = {
/*id_code*/ ID_SO,
/*id_filter*/ FILTER_ID_SO,
@ -226,7 +220,6 @@ IDTypeInfo IDType_ID_SO = {
/*blend_write*/ sound_blend_write,
/*blend_read_data*/ sound_blend_read_data,
/*blend_read_lib*/ sound_blend_read_lib,
/*blend_read_expand*/ sound_blend_read_expand,
/*blend_read_undo_preserve*/ nullptr,

View File

@ -57,12 +57,6 @@ static void speaker_blend_read_lib(BlendLibReader *reader, ID *id)
BLO_read_id_address(reader, id, &spk->sound);
}
static void speaker_blend_read_expand(BlendExpander *expander, ID *id)
{
Speaker *spk = (Speaker *)id;
BLO_expand(expander, spk->sound);
}
IDTypeInfo IDType_ID_SPK = {
/*id_code*/ ID_SPK,
/*id_filter*/ FILTER_ID_SPK,
@ -86,7 +80,6 @@ IDTypeInfo IDType_ID_SPK = {
/*blend_write*/ speaker_blend_write,
/*blend_read_data*/ nullptr,
/*blend_read_lib*/ speaker_blend_read_lib,
/*blend_read_expand*/ speaker_blend_read_expand,
/*blend_read_undo_preserve*/ nullptr,

View File

@ -248,7 +248,6 @@ IDTypeInfo IDType_ID_TXT = {
/*blend_write*/ text_blend_write,
/*blend_read_data*/ text_blend_read_data,
/*blend_read_lib*/ nullptr,
/*blend_read_expand*/ nullptr,
/*blend_read_undo_preserve*/ nullptr,

View File

@ -201,13 +201,6 @@ static void texture_blend_read_lib(BlendLibReader *reader, ID *id)
BLO_read_id_address(reader, id, &tex->ipo); /* XXX deprecated - old animation system */
}
static void texture_blend_read_expand(BlendExpander *expander, ID *id)
{
Tex *tex = (Tex *)id;
BLO_expand(expander, tex->ima);
BLO_expand(expander, tex->ipo); /* XXX deprecated - old animation system */
}
IDTypeInfo IDType_ID_TE = {
/*id_code*/ ID_TE,
/*id_filter*/ FILTER_ID_TE,
@ -231,7 +224,6 @@ IDTypeInfo IDType_ID_TE = {
/*blend_write*/ texture_blend_write,
/*blend_read_data*/ texture_blend_read_data,
/*blend_read_lib*/ texture_blend_read_lib,
/*blend_read_expand*/ texture_blend_read_expand,
/*blend_read_undo_preserve*/ nullptr,

View File

@ -177,7 +177,6 @@ IDTypeInfo IDType_ID_VF = {
/*blend_write*/ vfont_blend_write,
/*blend_read_data*/ vfont_blend_read_data,
/*blend_read_lib*/ nullptr,
/*blend_read_expand*/ nullptr,
/*blend_read_undo_preserve*/ nullptr,

View File

@ -636,14 +636,6 @@ static void volume_blend_read_lib(BlendLibReader *reader, ID *id)
}
}
static void volume_blend_read_expand(BlendExpander *expander, ID *id)
{
Volume *volume = (Volume *)id;
for (int a = 0; a < volume->totcol; a++) {
BLO_expand(expander, volume->mat[a]);
}
}
IDTypeInfo IDType_ID_VO = {
/*id_code*/ ID_VO,
/*id_filter*/ FILTER_ID_VO,
@ -667,7 +659,6 @@ IDTypeInfo IDType_ID_VO = {
/*blend_write*/ volume_blend_write,
/*blend_read_data*/ volume_blend_read_data,
/*blend_read_lib*/ volume_blend_read_lib,
/*blend_read_expand*/ volume_blend_read_expand,
/*blend_read_undo_preserve*/ nullptr,

View File

@ -177,15 +177,6 @@ static void workspace_blend_read_lib(BlendLibReader *reader, ID *id)
BKE_viewer_path_blend_read_lib(reader, id, &workspace->viewer_path);
}
static void workspace_blend_read_expand(BlendExpander *expander, ID *id)
{
WorkSpace *workspace = (WorkSpace *)id;
LISTBASE_FOREACH (WorkSpaceLayout *, layout, &workspace->layouts) {
BLO_expand(expander, BKE_workspace_layout_screen_get(layout));
}
}
IDTypeInfo IDType_ID_WS = {
/*id_code*/ ID_WS,
/*id_filter*/ FILTER_ID_WS,
@ -210,7 +201,6 @@ IDTypeInfo IDType_ID_WS = {
/*blend_write*/ workspace_blend_write,
/*blend_read_data*/ workspace_blend_read_data,
/*blend_read_lib*/ workspace_blend_read_lib,
/*blend_read_expand*/ workspace_blend_read_expand,
/*blend_read_undo_preserve*/ nullptr,

View File

@ -181,12 +181,6 @@ static void world_blend_read_lib(BlendLibReader *reader, ID *id)
BLO_read_id_address(reader, id, &wrld->ipo); /* XXX deprecated, old animation system */
}
static void world_blend_read_expand(BlendExpander *expander, ID *id)
{
World *wrld = (World *)id;
BLO_expand(expander, wrld->ipo); /* XXX deprecated, old animation system */
}
IDTypeInfo IDType_ID_WO = {
/*id_code*/ ID_WO,
/*id_filter*/ FILTER_ID_WO,
@ -210,7 +204,6 @@ IDTypeInfo IDType_ID_WO = {
/*blend_write*/ world_blend_write,
/*blend_read_data*/ world_blend_read_data,
/*blend_read_lib*/ world_blend_read_lib,
/*blend_read_expand*/ world_blend_read_expand,
/*blend_read_undo_preserve*/ nullptr,

View File

@ -38,7 +38,6 @@ extern "C" {
#endif
typedef struct BlendDataReader BlendDataReader;
typedef struct BlendExpander BlendExpander;
typedef struct BlendLibReader BlendLibReader;
typedef struct BlendWriter BlendWriter;
@ -313,19 +312,6 @@ struct BlendFileReadReport *BLO_read_lib_reports(BlendLibReader *reader);
/** \} */
/* -------------------------------------------------------------------- */
/** \name Blend Expand API
*
* BLO_expand has to be called for every data block that should be loaded. If the data block is in
* a separate `.blend` file, it will be pulled from there.
* \{ */
void BLO_expand_id(BlendExpander *expander, struct ID *id);
#define BLO_expand(expander, id) BLO_expand_id(expander, (struct ID *)id)
/** \} */
/* -------------------------------------------------------------------- */
/** \name Report API
* \{ */

View File

@ -597,11 +597,6 @@ struct BlendLibReader {
Main *main;
};
struct BlendExpander {
FileData *fd;
Main *main;
};
static void switch_endian_bh4(BHead4 *bhead)
{
/* the ID_.. codes */
@ -3933,6 +3928,11 @@ static ID *library_id_is_yet_read(FileData *fd, Main *mainvar, BHead *bhead)
/** \name Library Linking (expand pointers)
* \{ */
struct BlendExpander {
FileData *fd;
Main *main;
};
static void expand_doit_library(void *fdhandle, Main *mainvar, void *old)
{
FileData *fd = static_cast<FileData *>(fdhandle);
@ -4058,55 +4058,41 @@ static void expand_doit_library(void *fdhandle, Main *mainvar, void *old)
static BLOExpandDoitCallback expand_doit;
static void expand_id(BlendExpander *expander, ID *id);
static void expand_id_embedded_id(BlendExpander *expander, ID *id)
{
/* Handle 'private IDs'. */
bNodeTree *nodetree = ntreeFromID(id);
if (nodetree != nullptr) {
expand_id(expander, &nodetree->id);
blender::bke::ntreeBlendReadExpand(expander, nodetree);
}
if (GS(id->name) == ID_SCE) {
Scene *scene = (Scene *)id;
if (scene->master_collection != nullptr) {
expand_id(expander, &scene->master_collection->id);
BKE_collection_blend_read_expand(expander, scene->master_collection);
}
}
}
static void expand_id(BlendExpander *expander, ID *id)
{
IDP_BlendReadExpand(expander, id->properties);
if (id->override_library) {
BLO_expand(expander, id->override_library->reference);
BLO_expand(expander, id->override_library->storage);
LISTBASE_FOREACH (IDOverrideLibraryProperty *, op, &id->override_library->properties) {
LISTBASE_FOREACH (IDOverrideLibraryPropertyOperation *, opop, &op->operations) {
BLO_expand(expander, opop->subitem_reference_id);
BLO_expand(expander, opop->subitem_local_id);
}
}
}
AnimData *adt = BKE_animdata_from_id(id);
if (adt != nullptr) {
BKE_animdata_blend_read_expand(expander, adt);
}
expand_id_embedded_id(expander, id);
}
void BLO_main_expander(BLOExpandDoitCallback expand_doit_func)
{
expand_doit = expand_doit_func;
}
static int expand_cb(LibraryIDLinkCallbackData *cb_data)
{
/* Embedded IDs are not known by lib_link code, so they would be remapped to `nullptr`. But there
* is no need to process them anyway, asthey are already handled during the 'read_data' phase.
*/
if (cb_data->cb_flag & (IDWALK_CB_EMBEDDED | IDWALK_CB_EMBEDDED_NOT_OWNING)) {
return IDWALK_RET_NOP;
}
/* Explicitely requested to be ignored during readfile processing. Means the read_data code
* already handled this pointer. Typically, the 'owner_id' pointer of an embedded ID. */
if (cb_data->cb_flag & IDWALK_CB_READFILE_IGNORE) {
return IDWALK_RET_NOP;
}
/* Expand process can be re-entrant or have other complex imteractions that will not work well
* with loop-back pointers. Further more, processing such data should not be needed here anyway.
*/
if (cb_data->cb_flag & (IDWALK_CB_LOOPBACK)) {
return IDWALK_RET_NOP;
}
BlendExpander *expander = static_cast<BlendExpander *>(cb_data->user_data);
ID *id = *(cb_data->id_pointer);
expand_doit(expander->fd, expander->main, id);
return IDWALK_RET_NOP;
}
void BLO_expand_main(void *fdhandle, Main *mainvar)
{
FileData *fd = static_cast<FileData *>(fdhandle);
@ -4121,12 +4107,14 @@ void BLO_expand_main(void *fdhandle, Main *mainvar)
continue;
}
expand_id(&expander, id_iter);
const IDTypeInfo *id_type = BKE_idtype_get_info_from_id(id_iter);
if (id_type->blend_read_expand != nullptr) {
id_type->blend_read_expand(&expander, id_iter);
}
/* Original (current) ID pointer can be considered as valid, but _not_ its own pointers to
* other IDs - the already loaded ones will be valid, but the yet-to-be-read ones will not.
* Expanding should _not_ require processing of UI ID pointers.
* Expanding should never modify ID pointers themselves.
* Handling of DNA deprecated data should never be needed in undo case. */
const int flag = IDWALK_READONLY | IDWALK_NO_ORIG_POINTERS_ACCESS |
((fd->flags & FD_FLAGS_IS_MEMFILE) ? 0 : IDWALK_DO_DEPRECATED_POINTERS);
BKE_library_foreach_ID_link(nullptr, id_iter, expand_cb, &expander, flag);
do_it = true;
id_iter->tag &= ~LIB_TAG_NEED_EXPAND;
@ -4979,9 +4967,4 @@ BlendFileReadReport *BLO_read_lib_reports(BlendLibReader *reader)
return reader->fd->reports;
}
void BLO_expand_id(BlendExpander *expander, ID *id)
{
expand_doit(expander->fd, expander->main, id);
}
/** \} */

View File

@ -37,7 +37,6 @@ struct uiLayout;
struct BlendWriter;
struct BlendDataReader;
struct BlendLibReader;
struct BlendExpander;
/** Type of interface item. */
typedef enum NodeTreeInterfaceItemType {
@ -212,7 +211,6 @@ typedef struct bNodeTreeInterface {
void write(BlendWriter *writer);
void read_data(BlendDataReader *reader);
void read_lib(BlendLibReader *reader, ID *id);
void read_expand(BlendExpander *expander);
bNodeTreeInterfaceItem *active_item();
const bNodeTreeInterfaceItem *active_item() const;

View File

@ -15,7 +15,6 @@ extern "C" {
#endif
struct BlendDataReader;
struct BlendExpander;
struct BlendLibReader;
struct BlendWriter;
struct Depsgraph;
@ -111,8 +110,6 @@ void SEQ_blend_read_lib(struct BlendLibReader *reader,
struct Scene *scene,
struct ListBase *seqbase);
void SEQ_blend_read_expand(struct BlendExpander *expander, struct ListBase *seqbase);
void SEQ_doversion_250_sound_proxy_update(struct Main *bmain, struct Editing *ed);
/* Depsgraph update function. */

View File

@ -904,40 +904,6 @@ void SEQ_blend_read_lib(BlendLibReader *reader, Scene *scene, ListBase *seqbase)
SEQ_for_each_callback(seqbase, seq_read_lib_cb, &data);
}
static bool seq_blend_read_expand(Sequence *seq, void *user_data)
{
BlendExpander *expander = (BlendExpander *)user_data;
IDP_BlendReadExpand(expander, seq->prop);
if (seq->scene) {
BLO_expand(expander, seq->scene);
}
if (seq->scene_camera) {
BLO_expand(expander, seq->scene_camera);
}
if (seq->clip) {
BLO_expand(expander, seq->clip);
}
if (seq->mask) {
BLO_expand(expander, seq->mask);
}
if (seq->sound) {
BLO_expand(expander, seq->sound);
}
if (seq->type == SEQ_TYPE_TEXT && seq->effectdata) {
TextVars *data = static_cast<TextVars *>(seq->effectdata);
BLO_expand(expander, data->text_font);
}
return true;
}
void SEQ_blend_read_expand(BlendExpander *expander, ListBase *seqbase)
{
SEQ_for_each_callback(seqbase, seq_blend_read_expand, expander);
}
static bool seq_doversion_250_sound_proxy_update_cb(Sequence *seq, void *user_data)
{
Main *bmain = static_cast<Main *>(user_data);

View File

@ -292,7 +292,6 @@ IDTypeInfo IDType_ID_WM = {
/*blend_write*/ window_manager_blend_write,
/*blend_read_data*/ window_manager_blend_read_data,
/*blend_read_lib*/ window_manager_blend_read_lib,
/*blend_read_expand*/ nullptr,
/*blend_read_undo_preserve*/ nullptr,