diff options
author | Bastien Montagne <bastien@blender.org> | 2022-07-29 13:23:39 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2022-07-29 13:25:15 +0300 |
commit | ae0b8e904c8b80aedd743a8a36a53494e37a8fbf (patch) | |
tree | 2d30f2ced59c7c6d8ebb92a248ae38fc7a22044e /source | |
parent | 6ca602dd9fa14faf75a4b21faccc8c5662b9e79e (diff) |
Fix (unreported) lib-linking of ID properties not taking library parameter.
While this was not a critical issue (that lib pointer is only used for
some kind of sanity check that no linked data uses local ID pointers),
better to keep `IDP_BlendReadLib` in sync with all other lib-linking
code.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/BKE_idprop.h | 3 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/action.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/armature.c | 8 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/idprop.c | 8 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/layer.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/node.cc | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/scene.cc | 2 | ||||
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 2 | ||||
-rw-r--r-- | source/blender/sequencer/intern/sequencer.c | 2 |
9 files changed, 17 insertions, 16 deletions
diff --git a/source/blender/blenkernel/BKE_idprop.h b/source/blender/blenkernel/BKE_idprop.h index 3f7d9498e39..404ce63a5df 100644 --- a/source/blender/blenkernel/BKE_idprop.h +++ b/source/blender/blenkernel/BKE_idprop.h @@ -19,6 +19,7 @@ struct BlendWriter; struct ID; struct IDProperty; struct IDPropertyUIData; +struct Library; typedef union IDPropertyTemplate { int i; @@ -318,7 +319,7 @@ void IDP_BlendReadData_impl(struct BlendDataReader *reader, struct IDProperty **prop, const char *caller_func_id); #define IDP_BlendDataRead(reader, prop) IDP_BlendReadData_impl(reader, prop, __func__) -void IDP_BlendReadLib(struct BlendLibReader *reader, struct IDProperty *prop); +void IDP_BlendReadLib(struct BlendLibReader *reader, struct Library *lib, struct IDProperty *prop); void IDP_BlendReadExpand(struct BlendExpander *expander, struct IDProperty *prop); typedef enum eIDPropertyUIDataType { diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index fee7582acb3..3ea595cfaf0 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -1950,7 +1950,7 @@ void BKE_pose_blend_read_lib(BlendLibReader *reader, Object *ob, bPose *pose) pchan->bone = BKE_armature_find_bone_name(arm, pchan->name); - IDP_BlendReadLib(reader, pchan->prop); + IDP_BlendReadLib(reader, ob->id.lib, pchan->prop); BLO_read_id_address(reader, ob->id.lib, &pchan->custom); if (UNLIKELY(pchan->bone == NULL)) { diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index f29074c827c..7be3fe6f0e1 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -261,12 +261,12 @@ static void armature_blend_read_data(BlendDataReader *reader, ID *id) BKE_armature_bone_hash_make(arm); } -static void lib_link_bones(BlendLibReader *reader, Bone *bone) +static void lib_link_bones(BlendLibReader *reader, Library *lib, Bone *bone) { - IDP_BlendReadLib(reader, bone->prop); + IDP_BlendReadLib(reader, lib, bone->prop); LISTBASE_FOREACH (Bone *, curbone, &bone->childbase) { - lib_link_bones(reader, curbone); + lib_link_bones(reader, lib, curbone); } } @@ -274,7 +274,7 @@ static void armature_blend_read_lib(BlendLibReader *reader, ID *id) { bArmature *arm = (bArmature *)id; LISTBASE_FOREACH (Bone *, curbone, &arm->bonebase) { - lib_link_bones(reader, curbone); + lib_link_bones(reader, id->lib, curbone); } } diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c index 35f02c29a00..43e732b428d 100644 --- a/source/blender/blenkernel/intern/idprop.c +++ b/source/blender/blenkernel/intern/idprop.c @@ -1428,7 +1428,7 @@ void IDP_BlendReadData_impl(BlendDataReader *reader, IDProperty **prop, const ch } } -void IDP_BlendReadLib(BlendLibReader *reader, IDProperty *prop) +void IDP_BlendReadLib(BlendLibReader *reader, Library *lib, IDProperty *prop) { if (!prop) { return; @@ -1437,7 +1437,7 @@ void IDP_BlendReadLib(BlendLibReader *reader, IDProperty *prop) switch (prop->type) { case IDP_ID: /* PointerProperty */ { - void *newaddr = BLO_read_get_new_id_address(reader, NULL, IDP_Id(prop)); + void *newaddr = BLO_read_get_new_id_address(reader, lib, IDP_Id(prop)); if (IDP_Id(prop) && !newaddr && G.debug) { printf("Error while loading \"%s\". Data not found in file!\n", prop->name); } @@ -1448,14 +1448,14 @@ void IDP_BlendReadLib(BlendLibReader *reader, IDProperty *prop) { IDProperty *idp_array = IDP_IDPArray(prop); for (int i = 0; i < prop->len; i++) { - IDP_BlendReadLib(reader, &(idp_array[i])); + IDP_BlendReadLib(reader, lib, &(idp_array[i])); } break; } case IDP_GROUP: /* PointerProperty */ { LISTBASE_FOREACH (IDProperty *, loop, &prop->data.group) { - IDP_BlendReadLib(reader, loop); + IDP_BlendReadLib(reader, lib, loop); } break; } diff --git a/source/blender/blenkernel/intern/layer.c b/source/blender/blenkernel/intern/layer.c index 0202fb3ff5e..4257bccad93 100644 --- a/source/blender/blenkernel/intern/layer.c +++ b/source/blender/blenkernel/intern/layer.c @@ -2384,7 +2384,7 @@ void BKE_view_layer_blend_read_lib(BlendLibReader *reader, Library *lib, ViewLay BLO_read_id_address(reader, lib, &view_layer->mat_override); - IDP_BlendReadLib(reader, view_layer->id_properties); + IDP_BlendReadLib(reader, lib, view_layer->id_properties); } /** \} */ diff --git a/source/blender/blenkernel/intern/node.cc b/source/blender/blenkernel/intern/node.cc index 05e16192f9a..ba473b29474 100644 --- a/source/blender/blenkernel/intern/node.cc +++ b/source/blender/blenkernel/intern/node.cc @@ -835,7 +835,7 @@ static void ntree_blend_read_data(BlendDataReader *reader, ID *id) static void lib_link_node_socket(BlendLibReader *reader, Library *lib, bNodeSocket *sock) { - IDP_BlendReadLib(reader, sock->prop); + IDP_BlendReadLib(reader, lib, sock->prop); /* This can happen for all socket types when a file is saved in an older version of Blender than * it was originally created in (T86298). Some socket types still require a default value. The @@ -901,7 +901,7 @@ void ntreeBlendReadLib(struct BlendLibReader *reader, struct bNodeTree *ntree) LISTBASE_FOREACH (bNode *, node, &ntree->nodes) { /* Link ID Properties -- and copy this comment EXACTLY for easy finding * of library blocks that implement this. */ - IDP_BlendReadLib(reader, node->prop); + IDP_BlendReadLib(reader, lib, node->prop); BLO_read_id_address(reader, lib, &node->id); diff --git a/source/blender/blenkernel/intern/scene.cc b/source/blender/blenkernel/intern/scene.cc index e2da27fc840..aaa6baac1ff 100644 --- a/source/blender/blenkernel/intern/scene.cc +++ b/source/blender/blenkernel/intern/scene.cc @@ -1481,7 +1481,7 @@ static void scene_blend_read_lib(BlendLibReader *reader, ID *id) } LISTBASE_FOREACH (TimeMarker *, marker, &sce->markers) { - IDP_BlendReadLib(reader, marker->prop); + IDP_BlendReadLib(reader, sce->id.lib, marker->prop); if (marker->camera) { BLO_read_id_address(reader, sce->id.lib, &marker->camera); diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index e6e16019097..6fad67eb217 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -1999,7 +1999,7 @@ static void lib_link_id(BlendLibReader *reader, ID *id) { /* NOTE: WM IDProperties are never written to file, hence they should always be NULL here. */ BLI_assert((GS(id->name) != ID_WM) || id->properties == NULL); - IDP_BlendReadLib(reader, id->properties); + IDP_BlendReadLib(reader, id->lib, id->properties); AnimData *adt = BKE_animdata_from_id(id); if (adt != NULL) { diff --git a/source/blender/sequencer/intern/sequencer.c b/source/blender/sequencer/intern/sequencer.c index a184f727b9e..53a969d7fea 100644 --- a/source/blender/sequencer/intern/sequencer.c +++ b/source/blender/sequencer/intern/sequencer.c @@ -836,7 +836,7 @@ static bool seq_read_lib_cb(Sequence *seq, void *user_data) BlendLibReader *reader = data->reader; Scene *sce = data->scene; - IDP_BlendReadLib(reader, seq->prop); + IDP_BlendReadLib(reader, sce->id.lib, seq->prop); if (seq->ipo) { /* XXX: deprecated - old animation system. */ |