Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <bastien@blender.org>2022-04-19 16:52:08 +0300
committerBastien Montagne <bastien@blender.org>2022-04-19 16:53:54 +0300
commit6f56bd4083f95330e55043c66ab292c8bb99a95f (patch)
tree8291b3c507d8603b1966ce91f3a4c6dc4aa596ff
parent767939231d55bdfb238465cf3cf9fc363299747e (diff)
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.
-rw-r--r--source/blender/makesrna/intern/rna_rna.c43
1 files changed, 24 insertions, 19 deletions
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);
}
}