Fix T95601: Missing handling of keyingsets ID pointers in lib_query/foreach_id code.

This will have to be backported to 2.93 and possibly 2.83 if possible.
This commit is contained in:
Bastien Montagne 2022-02-14 12:05:11 +01:00
parent e0fd31f083
commit 3a9a37d6dc
Notes: blender-bot 2023-06-07 10:31:13 +02:00
Referenced by issue #88449: Blender LTS: Maintenance Task 2.93
Referenced by issue #88449, Blender LTS: Maintenance Task 2.93
Referenced by issue #95601, Keying sets for armatures in library overrides break if unrelated objects are changed in source file
Referenced by issue #77348, Blender LTS: Maintenance Task 2.83
3 changed files with 17 additions and 0 deletions

View File

@ -39,6 +39,7 @@ struct FCurve;
struct ID;
struct KS_Path;
struct KeyingSet;
struct LibraryForeachIDData;
struct ListBase;
struct Main;
struct NlaKeyframingContext;
@ -102,6 +103,9 @@ struct KS_Path *BKE_keyingset_find_path(struct KeyingSet *ks,
/* Copy all KeyingSets in the given list */
void BKE_keyingsets_copy(struct ListBase *newlist, const struct ListBase *list);
/** Process the ID pointers inside a scene's keyingsets, in see `BKE_lib_query.h` for details. */
void BKE_keyingsets_foreach_id(struct LibraryForeachIDData *data, const struct ListBase *keyingsets);
/* Free the given Keying Set path */
void BKE_keyingset_free_path(struct KeyingSet *ks, struct KS_Path *ksp);

View File

@ -57,6 +57,7 @@
#include "BKE_fcurve.h"
#include "BKE_global.h"
#include "BKE_lib_id.h"
#include "BKE_lib_query.h"
#include "BKE_main.h"
#include "BKE_material.h"
#include "BKE_nla.h"
@ -265,6 +266,15 @@ void BKE_keyingsets_copy(ListBase *newlist, const ListBase *list)
}
}
void BKE_keyingsets_foreach_id(LibraryForeachIDData *data, const ListBase *keyingsets)
{
for (KeyingSet *ksn = keyingsets->first; ksn; ksn = ksn->next) {
for (KS_Path *kspn = ksn->paths.first; kspn; kspn = kspn->next) {
BKE_LIB_FOREACHID_PROCESS_ID(data, kspn->id, IDWALK_CB_NOP);
}
}
}
/* Freeing Tools --------------------------- */
void BKE_keyingset_free(KeyingSet *ks)

View File

@ -816,6 +816,9 @@ static void scene_foreach_id(ID *id, LibraryForeachIDData *data)
data, SEQ_for_each_callback(&scene->ed->seqbase, seq_foreach_member_id_cb, data));
}
BKE_LIB_FOREACHID_PROCESS_FUNCTION_CALL(data,
BKE_keyingsets_foreach_id(data, &scene->keyingsets));
/* This pointer can be NULL during old files reading, better be safe than sorry. */
if (scene->master_collection != NULL) {
BKE_LIB_FOREACHID_PROCESS_FUNCTION_CALL(