[Bf-blender-cvs] [aff71a7fdce] master: Fix (unreported) RNA sometimes trying to get named sub-props from non-Group IDProp.

Bastien Montagne noreply at git.blender.org
Tue Apr 17 12:03:48 CEST 2018


Commit: aff71a7fdced77a29a44124f8caae191b27ac91d
Author: Bastien Montagne
Date:   Tue Apr 17 11:59:14 2018 +0200
Branches: master
https://developer.blender.org/rBaff71a7fdced77a29a44124f8caae191b27ac91d

Fix (unreported) RNA sometimes trying to get named sub-props from non-Group IDProp.

Why exactly this happens remains unclear, found that in the
autumn.blenrig file of Spring production while working on static
overrides... Tons of ugly IDProps in that rig. xD

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

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 bec6830f8c3..80e377ad8e1 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -277,8 +277,9 @@ IDProperty *RNA_struct_idprops(PointerRNA *ptr, bool create)
 {
 	StructRNA *type = ptr->type;
 
-	if (type && type->idproperties)
+	if (type && type->idproperties) {
 		return type->idproperties(ptr, create);
+	}
 	
 	return NULL;
 }
@@ -292,8 +293,16 @@ static IDProperty *rna_idproperty_find(PointerRNA *ptr, const char *name)
 {
 	IDProperty *group = RNA_struct_idprops(ptr, 0);
 
-	if (group)
-		return IDP_GetPropertyFromGroup(group, name);
+	if (group) {
+		if (group->type == IDP_GROUP) {
+			return IDP_GetPropertyFromGroup(group, name);
+		}
+		else {
+			/* Not sure why that happens sometimes, with nested properties... */
+			/* Seems to be actually array prop, name is usually "0"... To be sorted out later. */
+//			printf("Got unexpected IDProp container when trying to retrieve %s: %d\n", name, group->type);
+		}
+	}
 
 	return NULL;
 }



More information about the Bf-blender-cvs mailing list