[Bf-blender-cvs] [f8afbb76571] master: RNA property management: tweak to 'is set' information.

Bastien Montagne noreply at git.blender.org
Mon Jul 13 12:52:00 CEST 2020


Commit: f8afbb76571fa816a1d869240bdca595b97da846
Author: Bastien Montagne
Date:   Mon Jul 13 12:47:49 2020 +0200
Branches: master
https://developer.blender.org/rBf8afbb76571fa816a1d869240bdca595b97da846

RNA property management: tweak to 'is set' information.

Only consider a full IDProperty as set if it actually exists in given
PointerRNA data.

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

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 8bf715f93c1..793552c5c34 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -560,7 +560,10 @@ static PropertyRNA *arraytypemap[IDP_NUMTYPES] = {
 
 /* This function initializes a PropertyRNAOrID with all required info, from a given PropertyRNA
  * and PointerRNA data. It deals properly with the three cases (static RNA, runtime RNA, and
- * IDProperty). */
+ * IDProperty).
+ * WARNING: given `ptr` PointerRNA is assumed to be a valid data one here, calling code is
+ * responsible to ensure that.
+ */
 void rna_property_rna_or_id_get(PropertyRNA *prop,
                                 PointerRNA *ptr,
                                 PropertyRNAOrID *r_prop_rna_or_id)
@@ -617,8 +620,8 @@ void rna_property_rna_or_id_get(PropertyRNA *prop,
 
     r_prop_rna_or_id->idprop = idprop_evaluated;
     r_prop_rna_or_id->is_idprop = true;
-    /* Full IDProperties are always set. */
-    r_prop_rna_or_id->is_set = true;
+    /* Full IDProperties are always set, if it exists. */
+    r_prop_rna_or_id->is_set = (idprop_evaluated != NULL);
 
     r_prop_rna_or_id->identifier = idprop->name;
     if (idprop->type == IDP_ARRAY) {



More information about the Bf-blender-cvs mailing list