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 <montagne29@wanadoo.fr>2018-02-06 16:35:36 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2018-02-06 16:39:39 +0300
commit1ae5dfd04933752c0cd5a11281806401fad0a1f2 (patch)
tree42b8dd2467f034a497e20620735eb8517bed9ad2
parent0eb9d2adc6d70bd611803201881ef63e341c80f5 (diff)
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.
-rw-r--r--source/blender/makesrna/intern/rna_access.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index 115d89d93c7..1750c50b9da 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -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;
}