0

default values for options are now specified alongside their definitions

This commit is contained in:
Aaron Griffith
2012-01-08 01:09:43 -05:00
parent 7cacc59428
commit 30c4bb26c3
4 changed files with 11 additions and 11 deletions

View File

@@ -26,11 +26,8 @@ static int
depth_start(void *data, RenderState *state, PyObject *support) {
PrimitiveDepth *self = (PrimitiveDepth *)data;
self->min = 0;
if (!render_mode_parse_option(support, "min", "I", &(self->min)))
return 1;
self->max = 127;
if (!render_mode_parse_option(support, "max", "I", &(self->max)))
return 1;

View File

@@ -24,8 +24,6 @@ typedef struct {
static int
edge_lines_start(void *data, RenderState *state, PyObject *support) {
PrimitiveEdgeLines *self = (PrimitiveEdgeLines *)data;
self->opacity = 0.15;
if (!render_mode_parse_option(support, "opacity", "f", &(self->opacity)))
return 1;
return 0;

View File

@@ -176,16 +176,16 @@ int render_mode_parse_option(PyObject *support, const char *name, const char *fo
int ret;
if (support == NULL || name == NULL)
return 1;
return 0;
dict = PyObject_GetAttrString(support, "option_values");
if (!dict)
return 1;
return 0;
item = PyDict_GetItemString(dict, name);
if (item == NULL) {
Py_DECREF(dict);
return 1;
return 0;
};
/* make sure the item we're parsing is a tuple