Commit: 4e031073df3658f3bf9c807bfdfd70cdeca73102
Author: Bastien Montagne
Date:   Thu Sep 22 16:11:16 2016 +0200
Branches: master
https://developer.blender.org/rB4e031073df3658f3bf9c807bfdfd70cdeca73102

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.

===================================================================

M       source/blender/blenkernel/intern/library_query.c

===================================================================

diff --git a/source/blender/blenkernel/intern/library_query.c 
b/source/blender/blenkernel/intern/library_query.c
index cb86433..392ac68 100644
--- a/source/blender/blenkernel/intern/library_query.c
+++ b/source/blender/blenkernel/intern/library_query.c
@@ -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;
        }

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to