Fix T54005: Broken IDProp copying from RNA code.
When destination IDProp did not exist, new code (related ot static overrides) would not do nothing... IDProps and RNA are really not easy to tame, thinking more and more we should totally bypass RNA and directly use (add) IDP code to handle comparison and diff creation/application of IDProps. But for now, this bandage should to the trick.
This commit is contained in:
parent
0eb9d2adc6
commit
1ae5dfd049
Notes:
blender-bot
2023-02-14 10:11:54 +01:00
Referenced by issue #54005, Copy to selected not working for Python defined properties
|
@ -7053,6 +7053,19 @@ bool RNA_property_copy(PointerRNA *ptr, PointerRNA *fromptr, PropertyRNA *prop,
|
|||
prop_dst = rna_ensure_property_realdata(&prop_dst, ptr);
|
||||
prop_src = rna_ensure_property_realdata(&prop_src, fromptr);
|
||||
|
||||
/* IDprops: destination may not exist, if source does and is set, try to create it. */
|
||||
/* Note: this is sort of quick hack/bandage to fix the issue, we need to rethink how IDProps are handled
|
||||
* in 'diff' RNA code completely, imho... */
|
||||
if (prop_src != NULL && prop_dst == NULL && RNA_property_is_set(fromptr, prop)) {
|
||||
BLI_assert(prop_src->magic != RNA_MAGIC);
|
||||
IDProperty *idp_dst = RNA_struct_idprops(ptr, true);
|
||||
IDProperty *prop_idp_dst = IDP_CopyProperty((IDProperty *)prop_src);
|
||||
IDP_AddToGroup(idp_dst, prop_idp_dst);
|
||||
rna_idproperty_touch(prop_idp_dst);
|
||||
/* Nothing else to do here... */
|
||||
return true;
|
||||
}
|
||||
|
||||
if (ELEM(NULL, prop_dst, prop_src)) {
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue