Fix T49427: Drivers of Shapekeys break when Append a group.

Optimization attempt with BKE_library_idtype_can_use_idtype() was not taking into account
the fact that drivers may link virtually against any datablock...

Has to be rethinked, but for after 2.78 release, this commit is safe to backport.
This commit is contained in:
Bastien Montagne 2016-09-22 16:11:16 +02:00
parent 9937f28877
commit 4e031073df
Notes: blender-bot 2023-02-14 07:35:03 +01:00
Referenced by issue #49427, Drivers of Shapekeys break when Append a group.
1 changed files with 6 additions and 4 deletions

View File

@ -897,10 +897,12 @@ void BKE_library_update_ID_link_user(ID *id_dst, ID *id_src, const int cd_flag)
* This is a 'simplified' abstract version of #BKE_library_foreach_ID_link() above, quite useful to reduce
* useless iterations in some cases.
*/
/* XXX This has to be fully rethink, basing check on ID type is not really working anymore (and even worth once
* IDProps will support ID pointers), we'll have to do some quick checks on IDs themselves... */
bool BKE_library_idtype_can_use_idtype(const short id_type_owner, const short id_type_used)
{
if (id_type_used == ID_AC) {
return id_type_can_have_animdata(id_type_owner);
if (id_type_can_have_animdata(id_type_owner)) {
return true; /* AnimationData can use virtually any kind of datablocks, through drivers especially. */
}
switch ((ID_Type)id_type_owner) {
@ -999,10 +1001,10 @@ static int foreach_libblock_id_users_callback(void *user_data, ID *self_id, ID *
IDUsersIter *iter = user_data;
/* XXX This is actually some kind of hack...
* Issue is, only ID pointer from shapekeys is the 'from' one, which is not actually ID usage.
* Issue is, shapekeys' 'from' ID pointer is not actually ID usage.
* Maybe we should even nuke it from BKE_library_foreach_ID_link, not 100% sure yet...
*/
if (GS(self_id->name) == ID_KE) {
if ((GS(self_id->name) == ID_KE) && (((Key *)self_id)->from == *id_p)) {
return IDWALK_RET_NOP;
}