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.
This commit is contained in:
Bastien Montagne 2022-04-19 15:52:08 +02:00
parent 767939231d
commit 6f56bd4083
1 changed files with 24 additions and 19 deletions

View File

@ -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);
}
}