[Bf-blender-cvs] [87d7b326a21] draw-deferred-compilation-experiment: Fix T94775: Buggy liboverride default apply code for items insertion in RNA collections.

Bastien Montagne noreply at git.blender.org
Thu Apr 21 11:14:12 CEST 2022


Commit: 87d7b326a21b73267c98b6f08f5a2f53bbb9a25f
Author: Bastien Montagne
Date:   Wed Apr 20 11:05:54 2022 +0200
Branches: draw-deferred-compilation-experiment
https://developer.blender.org/rB87d7b326a21b73267c98b6f08f5a2f53bbb9a25f

Fix T94775: Buggy liboverride default apply code for items insertion in RNA collections.

For some reason, the rework of liboverride handling of Collection items
insertion (rB33c5e7bcd5e5) completely missed to update accordingly the
default liboverride apply code...

Many thanks to Wayde Moss (@GuiltyGhost) for the investigation and
proposed solution.

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

M	source/blender/makesrna/intern/rna_rna.c

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

diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c
index bd864006b8c..a7d673d3fe1 100644
--- a/source/blender/makesrna/intern/rna_rna.c
+++ b/source/blender/makesrna/intern/rna_rna.c
@@ -2601,10 +2601,11 @@ bool rna_property_override_apply_default(Main *bmain,
             int item_index_src, item_index_ref;
             if (RNA_property_collection_lookup_string_index(
                     ptr_src, prop_src, opop->subitem_local_name, &item_ptr_src, &item_index_src) &&
-                RNA_property_collection_lookup_int(
-                    ptr_src, prop_src, item_index_src + 1, &item_ptr_src) &&
-                RNA_property_collection_lookup_string_index(
-                    ptr_dst, prop_dst, opop->subitem_local_name, &item_ptr_ref, &item_index_ref)) {
+                RNA_property_collection_lookup_string_index(ptr_dst,
+                                                            prop_dst,
+                                                            opop->subitem_reference_name,
+                                                            &item_ptr_ref,
+                                                            &item_index_ref)) {
               is_valid = true;
               item_index_dst = item_index_ref + 1;
             }
@@ -2612,10 +2613,10 @@ bool rna_property_override_apply_default(Main *bmain,
           if (!is_valid && opop->subitem_local_index >= 0) {
             /* Find from index. */
             if (RNA_property_collection_lookup_int(
-                    ptr_src, prop_src, opop->subitem_local_index + 1, &item_ptr_src) &&
+                    ptr_src, prop_src, opop->subitem_local_index, &item_ptr_src) &&
                 RNA_property_collection_lookup_int(
-                    ptr_dst, prop_dst, opop->subitem_local_index, &item_ptr_ref)) {
-              item_index_dst = opop->subitem_local_index + 1;
+                    ptr_dst, prop_dst, opop->subitem_reference_index, &item_ptr_ref)) {
+              item_index_dst = opop->subitem_reference_index + 1;
               is_valid = true;
             }
           }



More information about the Bf-blender-cvs mailing list