[Bf-blender-cvs] [07b8be9514d] master: RNA: support enum defaults which don't exist in the item array

Campbell Barton noreply at git.blender.org
Tue Mar 12 23:11:35 CET 2019


Commit: 07b8be9514d9bb3211de87c8e200a9ddd4ae52d3
Author: Campbell Barton
Date:   Wed Mar 13 09:06:44 2019 +1100
Branches: master
https://developer.blender.org/rB07b8be9514d9bb3211de87c8e200a9ddd4ae52d3

RNA: support enum defaults which don't exist in the item array

Allow dynamic defines to have defaults which don't exist in the
static array, this is an exception that's only allowed when the item
array is set to DummyRNA_NULL_items.

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

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

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

diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c
index 0fcd9e3599f..8e0af001eec 100644
--- a/source/blender/makesrna/intern/makesrna.c
+++ b/source/blender/makesrna/intern/makesrna.c
@@ -31,6 +31,7 @@
 
 #include "RNA_define.h"
 #include "RNA_types.h"
+#include "RNA_enum_types.h"
 
 #include "rna_internal.h"
 
@@ -2957,7 +2958,9 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
 					}
 				}
 				else {
-					if (!defaultfound) {
+					if (!defaultfound &&
+					    !(eprop->itemf && eprop->item == DummyRNA_NULL_items))
+					{
 						CLOG_ERROR(&LOG, "%s%s.%s, enum default is not in items.",
 						           srna->identifier, errnest, prop->identifier);
 						DefRNA.error = 1;



More information about the Bf-blender-cvs mailing list