disallow identifiers with spaces 'cap end' wasn't working with the python api and made doc generation fail

This commit is contained in:
Campbell Barton
2009-01-15 05:41:25 +00:00
parent 4c17156c9e
commit ac91b159ae
3 changed files with 9 additions and 4 deletions

View File

@@ -1604,7 +1604,7 @@ static int add_primitive_cone_exec(bContext *C, wmOperator *op)
dia = RNA_float_get(op->ptr,"radius");
make_prim(obedit, PRIM_CONE, mat, RNA_int_get(op->ptr,"vertices"), 32, 2, dia, RNA_float_get(op->ptr,"depth")/2, 1, RNA_int_get(op->ptr,"cap end"));
make_prim(obedit, PRIM_CONE, mat, RNA_int_get(op->ptr,"vertices"), 32, 2, dia, RNA_float_get(op->ptr,"depth")/2, 1, RNA_int_get(op->ptr,"cap_end"));
ED_undo_push(C, "Add Cone"); // Note this will become depricated
WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
@@ -1630,7 +1630,7 @@ void MESH_OT_add_primitive_cone(wmOperatorType *ot)
RNA_def_property(ot->srna, "vertices", PROP_INT, PROP_NONE);
RNA_def_property(ot->srna, "radius", PROP_FLOAT, PROP_NONE);
RNA_def_property(ot->srna, "depth", PROP_FLOAT, PROP_NONE);
RNA_def_property(ot->srna, "cap end",PROP_INT, PROP_NONE);
RNA_def_property(ot->srna, "cap_end",PROP_INT, PROP_NONE);
}
static int add_primitive_grid_exec(bContext *C, wmOperator *op)
@@ -1687,4 +1687,4 @@ void MESH_OT_add_primitive_monkey(wmOperatorType *ot)
/* api callbacks */
ot->exec= add_primitive_monkey_exec;
ot->poll= ED_operator_editmesh;
}
}

View File

@@ -136,7 +136,7 @@ void ED_keymap_mesh(wmWindowManager *wm)
RNA_int_set(cone->ptr,"vertices",32);
RNA_float_set(cone->ptr,"radius",2);
RNA_float_set(cone->ptr,"depth",-3);
RNA_float_set(cone->ptr,"cap end",0);
RNA_float_set(cone->ptr,"cap_end",0);
WM_keymap_add_item(keymap, "MESH_OT_add_primitive_grid", NINEKEY, KM_PRESS, KM_CTRL, 0);

View File

@@ -200,6 +200,11 @@ static int rna_validate_identifier(const char *identifier, char *error, int prop
continue;
}
if (identifier[a]==' ') {
strcpy(error, "spaces are not ok in identifier names");
return 0;
}
if (isalnum(identifier[a])==0) {
strcpy(error, "one of the characters failed an isalnum() check and is not an underscore");
return 0;