[Bf-blender-cvs] [0479a663130] blender-v3.0-release: Fix broken versionning after recent refactor of insertion in liboverrides.

Bastien Montagne noreply at git.blender.org
Tue Nov 23 14:36:45 CET 2021


Commit: 0479a66313056bc6f467a833bba11592747f78ca
Author: Bastien Montagne
Date:   Tue Nov 23 14:33:26 2021 +0100
Branches: blender-v3.0-release
https://developer.blender.org/rB0479a66313056bc6f467a833bba11592747f78ca

Fix broken versionning after recent refactor of insertion in liboverrides.

rB33c5e7bcd5e5b79 doversion code was incorrectly dealing with 'insert in
first position' case from older blendfiles.

Specifically, a NULL anchor is valid (it means that the new item is the
first of the stored override data, and should be inserted at start of
the list).

Reported as part of T93321.

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

M	source/blender/blenloader/intern/versioning_300.c

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

diff --git a/source/blender/blenloader/intern/versioning_300.c b/source/blender/blenloader/intern/versioning_300.c
index 18baebf57fb..940a10a9e91 100644
--- a/source/blender/blenloader/intern/versioning_300.c
+++ b/source/blender/blenloader/intern/versioning_300.c
@@ -1309,13 +1309,16 @@ static void version_liboverride_rnacollections_insertion_object_constraints(
                                                                        opop->subitem_local_name,
                                                                        offsetof(bConstraint, name),
                                                                        opop->subitem_local_index);
-    if (constraint_anchor == NULL || constraint_anchor->next == NULL) {
+    bConstraint *constraint_src = constraint_anchor != NULL ? constraint_anchor->next :
+                                                              constraints->first;
+
+    if (constraint_src == NULL) {
       /* Invalid case, just remove that override property operation. */
-      CLOG_ERROR(&LOG, "Could not find anchor or source constraints in stored override data");
+      CLOG_ERROR(&LOG, "Could not find source constraint in stored override data");
       BKE_lib_override_library_property_operation_delete(op, opop);
       continue;
     }
-    bConstraint *constraint_src = constraint_anchor->next;
+
     opop->subitem_reference_name = opop->subitem_local_name;
     opop->subitem_local_name = BLI_strdup(constraint_src->name);
     opop->subitem_reference_index = opop->subitem_local_index;
@@ -1338,13 +1341,15 @@ static void version_liboverride_rnacollections_insertion_object(Object *object)
                                                                    opop->subitem_local_name,
                                                                    offsetof(ModifierData, name),
                                                                    opop->subitem_local_index);
-      if (mod_anchor == NULL || mod_anchor->next == NULL) {
+      ModifierData *mod_src = mod_anchor != NULL ? mod_anchor->next : object->modifiers.first;
+
+      if (mod_src == NULL) {
         /* Invalid case, just remove that override property operation. */
-        CLOG_ERROR(&LOG, "Could not find anchor or source modifiers in stored override data");
+        CLOG_ERROR(&LOG, "Could not find source modifier in stored override data");
         BKE_lib_override_library_property_operation_delete(op, opop);
         continue;
       }
-      ModifierData *mod_src = mod_anchor->next;
+
       opop->subitem_reference_name = opop->subitem_local_name;
       opop->subitem_local_name = BLI_strdup(mod_src->name);
       opop->subitem_reference_index = opop->subitem_local_index;
@@ -1363,13 +1368,17 @@ static void version_liboverride_rnacollections_insertion_object(Object *object)
           opop->subitem_local_name,
           offsetof(GpencilModifierData, name),
           opop->subitem_local_index);
-      if (gp_mod_anchor == NULL || gp_mod_anchor->next == NULL) {
+      GpencilModifierData *gp_mod_src = gp_mod_anchor != NULL ?
+                                            gp_mod_anchor->next :
+                                            object->greasepencil_modifiers.first;
+
+      if (gp_mod_src == NULL) {
         /* Invalid case, just remove that override property operation. */
-        CLOG_ERROR(&LOG, "Could not find anchor GP modifier in stored override data");
+        CLOG_ERROR(&LOG, "Could not find source GP modifier in stored override data");
         BKE_lib_override_library_property_operation_delete(op, opop);
         continue;
       }
-      GpencilModifierData *gp_mod_src = gp_mod_anchor->next;
+
       opop->subitem_reference_name = opop->subitem_local_name;
       opop->subitem_local_name = BLI_strdup(gp_mod_src->name);
       opop->subitem_reference_index = opop->subitem_local_index;



More information about the Bf-blender-cvs mailing list