[Bf-blender-cvs] [da48a8ef506] master: Fix T74815: Shapekeys animation is blocked after second append of the same object.

Bastien Montagne noreply at git.blender.org
Fri Apr 10 10:54:08 CEST 2020


Commit: da48a8ef506c3fc0778dba5c570bc44f975f9f21
Author: Bastien Montagne
Date:   Fri Apr 10 10:52:18 2020 +0200
Branches: master
https://developer.blender.org/rBda48a8ef506c3fc0778dba5c570bc44f975f9f21

Fix T74815: Shapekeys animation is blocked after second append of the same object.

Logic to handle shepkeys datablocks in helper in 'make local' code that
checks which ID should be copied, and which can be directly made local,
was wrong.

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

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

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

diff --git a/source/blender/blenkernel/intern/lib_id.c b/source/blender/blenkernel/intern/lib_id.c
index 487ec0bf161..9e4f1dda682 100644
--- a/source/blender/blenkernel/intern/lib_id.c
+++ b/source/blender/blenkernel/intern/lib_id.c
@@ -1720,21 +1720,31 @@ static void library_make_local_copying_check(ID *id,
     /* Used_to_user stores ID pointer, not pointer to ID pointer. */
     ID *par_id = (ID *)entry->id_pointer;
 
-    /* Our oh-so-beloved 'from' pointers... */
+    /* Our oh-so-beloved 'from' pointers... Those should always be ignored here, since the actual
+     * relation we want to check is in the other way around. */
     if (entry->usage_flag & IDWALK_CB_LOOPBACK) {
-      /* We totally disregard Object->proxy_from 'usage' here,
-       * this one would only generate fake positives. */
-      if (GS(par_id->name) == ID_OB) {
-        BLI_assert(((Object *)par_id)->proxy_from == (Object *)id);
-        continue;
+#ifndef NDEBUG
+      /* Some debug checks to ensure we explicitely are aware of all 'loopback' cases, since those
+       * may not always be manageable in the same way... */
+      switch (GS(par_id->name)) {
+        case ID_OB:
+          BLI_assert(((Object *)par_id)->proxy_from == (Object *)id);
+          break;
+        case ID_KE:
+          BLI_assert(((Key *)par_id)->from == id);
+          break;
+        default:
+          BLI_assert(0);
       }
+#endif
+      continue;
+    }
 
-      /* Shapekeys are considered 'private' to their owner ID here, and never tagged
-       * (since they cannot be linked), so we have to switch effective parent to their owner.
-       */
-      if (GS(par_id->name) == ID_KE) {
-        par_id = ((Key *)par_id)->from;
-      }
+    /* Shapekeys are considered 'private' to their owner ID here, and never tagged
+     * (since they cannot be linked), so we have to switch effective parent to their owner.
+     */
+    if (GS(par_id->name) == ID_KE) {
+      par_id = ((Key *)par_id)->from;
     }
 
     if (par_id->lib == NULL) {



More information about the Bf-blender-cvs mailing list