[Bf-blender-cvs] [6f56bd4083f] master: Fix wrong logic in comparison code of RNA collection proerties.
Bastien Montagne
noreply at git.blender.org
Tue Apr 19 15:53:59 CEST 2022
Commit: 6f56bd4083f95330e55043c66ab292c8bb99a95f
Author: Bastien Montagne
Date: Tue Apr 19 15:52:08 2022 +0200
Branches: master
https://developer.blender.org/rB6f56bd4083f95330e55043c66ab292c8bb99a95f
Fix wrong logic in comparison code of RNA collection proerties.
Noted as part of T94775 investigation by Wayde Moss (@GuiltyGhost),
thanks!
NOTE: this mistake probably did not have any pratical impact in current
code, at least for overrides.
===================================================================
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 373df6b7444..bd864006b8c 100644
--- a/source/blender/makesrna/intern/rna_rna.c
+++ b/source/blender/makesrna/intern/rna_rna.c
@@ -1474,6 +1474,11 @@ static int rna_property_override_diff_propptr(Main *bmain,
(is_array ? RNA_property_##_typename##_set_index((_ptr), (_prop), (_index), (_value)) : \
RNA_property_##_typename##_set((_ptr), (_prop), (_value)))
+/**
+ * /return `0` is matching, `-1` if `prop_a < prop_b`, `1` if `prop_a > prop_b`. Note that for
+ * unquantifiable properties (e.g. pointers or collections), return value should be interpreted as
+ * a boolean (false == matching, true == not matching).
+ */
int rna_property_override_diff_default(Main *bmain,
PropertyRNAOrID *prop_a,
PropertyRNAOrID *prop_b,
@@ -1932,25 +1937,25 @@ int rna_property_override_diff_default(Main *bmain,
}
else if (is_id || is_valid_for_diffing) {
if (equals || do_create) {
- const int eq = rna_property_override_diff_propptr(bmain,
- ptr_a->owner_id,
- ptr_b->owner_id,
- &iter_a.ptr,
- &iter_b.ptr,
- mode,
- no_ownership,
- no_prop_name,
- override,
- rna_path,
- rna_path_len,
- PROP_COLLECTION,
- propname_a,
- propname_b,
- idx_a,
- idx_b,
- flags,
- r_override_changed);
- equals = equals && eq;
+ const int comp = rna_property_override_diff_propptr(bmain,
+ ptr_a->owner_id,
+ ptr_b->owner_id,
+ &iter_a.ptr,
+ &iter_b.ptr,
+ mode,
+ no_ownership,
+ no_prop_name,
+ override,
+ rna_path,
+ rna_path_len,
+ PROP_COLLECTION,
+ propname_a,
+ propname_b,
+ idx_a,
+ idx_b,
+ flags,
+ r_override_changed);
+ equals = equals && (comp == 0);
}
}
More information about the Bf-blender-cvs
mailing list