[Bf-blender-cvs] [1ae5dfd0493] blender2.8: Fix T54005: Broken IDProp copying from RNA code.

Bastien Montagne noreply at git.blender.org
Tue Feb 6 14:40:25 CET 2018


Commit: 1ae5dfd04933752c0cd5a11281806401fad0a1f2
Author: Bastien Montagne
Date:   Tue Feb 6 14:35:36 2018 +0100
Branches: blender2.8
https://developer.blender.org/rB1ae5dfd04933752c0cd5a11281806401fad0a1f2

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.

===================================================================

M	source/blender/makesrna/intern/rna_access.c

===================================================================

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



More information about the Bf-blender-cvs mailing list