diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c index c83bafc1c4c..ade01c9f2c2 100644 --- a/source/blender/makesrna/intern/rna_curve.c +++ b/source/blender/makesrna/intern/rna_curve.c @@ -113,9 +113,9 @@ void rna_def_curve(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Taper Object", "Curve object name that defines the taper (width)."); /* Flags */ - prop= RNA_def_property(srna, "3d", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_3D); - RNA_def_property_ui_text(prop, "3D Curve", "Define curve in three dimensions. Note that in this case fill won't work."); + prop= RNA_def_property(srna, "planer", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CU_3D); + RNA_def_property_ui_text(prop, "2D Curve", "Define curve in two dimensions only. Note that fill only works when this is enabled."); prop= RNA_def_property(srna, "front", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_FRONT); diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c index 77093938c55..16acb73193a 100644 --- a/source/blender/makesrna/intern/rna_define.c +++ b/source/blender/makesrna/intern/rna_define.c @@ -27,6 +27,7 @@ #include #include #include +#include #include "MEM_guardedalloc.h" @@ -165,6 +166,22 @@ static int rna_find_sdna_member(SDNA *sdna, const char *structname, const char * return 0; } +static int rna_validate_identifier(const char *identifier) +{ + int a=0; + + if (!isalpha(identifier[0])) { + return 0; + } + + for(a=1; identifier[a] != '\0'; a++) { + if (identifier[a]=='_') continue; + if (isalnum(identifier[a])==0) return 0; + } + + return 1; +} + /* Blender Data Definition */ BlenderRNA *RNA_create() @@ -280,7 +297,14 @@ StructRNA *RNA_def_struct(BlenderRNA *brna, const char *identifier, const char * StructRNA *srna, *srnafrom= NULL; StructDefRNA *ds= NULL, *dsfrom= NULL; PropertyRNA *prop, *propfrom; - + + if(DefRNA.preprocess) { + if (rna_validate_identifier(identifier) == 0) { + fprintf(stderr, "RNA_def_struct: struct identifier \"%s\" is an invalid name\n", identifier); + DefRNA.error= 1; + } + } + if(from) { /* find struct to derive from */ for(srnafrom= brna->structs.first; srnafrom; srnafrom=srnafrom->next) @@ -500,6 +524,13 @@ PropertyRNA *RNA_def_property(StructRNA *srna, const char *identifier, int type, PropertyRNA *prop; if(DefRNA.preprocess) { + + if (rna_validate_identifier(identifier) == 0) { + fprintf(stderr, "RNA_def_property: property identifier \"%s\" is an invalid name\n", identifier); + DefRNA.error= 1; + return NULL; + } + ds= DefRNA.structs.last; dp= MEM_callocN(sizeof(PropertyDefRNA), "PropertyDefRNA"); rna_addtail(&ds->properties, dp);