formatting edits in py api, no functional changes

This commit is contained in:
2011-12-18 08:50:06 +00:00
parent 414370b8d4
commit 9c9099a805
17 changed files with 132 additions and 128 deletions

View File

@@ -82,7 +82,7 @@ static PyObject *bpy_app_handlers_persistent_new(PyTypeObject *UNUSED(type), PyO
{
PyObject *value;
if(!PyArg_ParseTuple(args, "O:bpy.app.handlers.persistent", &value))
if (!PyArg_ParseTuple(args, "O:bpy.app.handlers.persistent", &value))
return NULL;
if (PyFunction_Check(value)) {
@@ -252,12 +252,12 @@ void BPY_app_handlers_reset(const short do_all)
PyObject *item;
PyObject **dict_ptr;
for(i= PyList_GET_SIZE(ls) - 1; i >= 0; i--) {
for (i= PyList_GET_SIZE(ls) - 1; i >= 0; i--) {
if ( (PyFunction_Check((item= PyList_GET_ITEM(ls, i)))) &&
(dict_ptr= _PyObject_GetDictPtr(item)) &&
(*dict_ptr) &&
(PyDict_GetItem(*dict_ptr, perm_id_str) != NULL))
if ( (PyFunction_Check((item= PyList_GET_ITEM(ls, i)))) &&
(dict_ptr= _PyObject_GetDictPtr(item)) &&
(*dict_ptr) &&
(PyDict_GetItem(*dict_ptr, perm_id_str) != NULL))
{
/* keep */
}

View File

@@ -971,14 +971,14 @@ static EnumPropertyItem *enum_items_from_py(PyObject *seq_fast, PyObject *def, i
item= PySequence_Fast_GET_ITEM(seq_fast, i);
if ( (PyTuple_CheckExact(item)) &&
(item_size= PyTuple_GET_SIZE(item)) &&
(item_size == 3 || item_size == 4) &&
(tmp.identifier= _PyUnicode_AsStringAndSize(PyTuple_GET_ITEM(item, 0), &id_str_size)) &&
(tmp.name= _PyUnicode_AsStringAndSize(PyTuple_GET_ITEM(item, 1), &name_str_size)) &&
(tmp.description= _PyUnicode_AsStringAndSize(PyTuple_GET_ITEM(item, 2), &desc_str_size)) &&
(item_size < 4 || py_long_as_int(PyTuple_GET_ITEM(item, 3), &tmp.value) != -1) /* TODO, number isnt ensured to be unique from the script author */
) {
if ( (PyTuple_CheckExact(item)) &&
(item_size= PyTuple_GET_SIZE(item)) &&
(item_size == 3 || item_size == 4) &&
(tmp.identifier= _PyUnicode_AsStringAndSize(PyTuple_GET_ITEM(item, 0), &id_str_size)) &&
(tmp.name= _PyUnicode_AsStringAndSize(PyTuple_GET_ITEM(item, 1), &name_str_size)) &&
(tmp.description= _PyUnicode_AsStringAndSize(PyTuple_GET_ITEM(item, 2), &desc_str_size)) &&
(item_size < 4 || py_long_as_int(PyTuple_GET_ITEM(item, 3), &tmp.value) != -1)) /* TODO, number isnt ensured to be unique from the script author */
{
if (is_enum_flag) {
if (item_size < 4) {
tmp.value= 1<<i;

View File

@@ -624,7 +624,7 @@ PyObject *pyrna_math_object_from_array(PointerRNA *ptr, PropertyRNA *prop)
if (!is_thick)
ret= pyrna_prop_CreatePyObject(ptr, prop); /* owned by the mathutils PyObject */
switch(subtype) {
switch (subtype) {
case PROP_ALL_VECTOR_SUBTYPES:
if (len>=2 && len <= 4) {
if (is_thick) {
@@ -3441,7 +3441,7 @@ static PyObject *pyrna_struct_getattro(BPy_StructRNA *self, PyObject *pyname)
int done= CTX_data_get(C, name, &newptr, &newlb, &newtype);
if (done==1) { /* found */
switch(newtype) {
switch (newtype) {
case CTX_DATA_TYPE_POINTER:
if (newptr.data == NULL) {
ret= Py_None;
@@ -4201,7 +4201,7 @@ static int foreach_compat_buffer(RawPropertyType raw_type, int attr_signed, cons
{
char f= format ? *format:'B'; /* B is assumed when not set */
switch(raw_type) {
switch (raw_type) {
case PROP_RAW_CHAR:
if (attr_signed) return (f=='b') ? 1:0;
else return (f=='B') ? 1:0;
@@ -4265,7 +4265,7 @@ static PyObject *foreach_getset(BPy_PropertyRNA *self, PyObject *args, int set)
for ( ; i<tot; i++) {
item= PySequence_GetItem(seq, i);
switch(raw_type) {
switch (raw_type) {
case PROP_RAW_CHAR:
((char *)array)[i]= (char)PyLong_AsLong(item);
break;
@@ -4320,7 +4320,7 @@ static PyObject *foreach_getset(BPy_PropertyRNA *self, PyObject *args, int set)
for ( ; i<tot; i++) {
switch(raw_type) {
switch (raw_type) {
case PROP_RAW_CHAR:
item= PyLong_FromSsize_t((Py_ssize_t) ((char *)array)[i]);
break;
@@ -4616,7 +4616,7 @@ static PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *dat
PyTuple_SET_ITEM(ret, a, PyLong_FromSsize_t((Py_ssize_t)((int*)data)[a]));
break;
case PROP_FLOAT:
switch(RNA_property_subtype(prop)) {
switch (RNA_property_subtype(prop)) {
#ifdef USE_MATHUTILS
case PROP_ALL_VECTOR_SUBTYPES:
ret= Vector_CreatePyObject(data, len, Py_NEW, NULL);
@@ -6969,10 +6969,10 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param
if (err != 0) {
ReportList *reports;
/* alert the user, else they wont know unless they see the console. */
if ( (!is_static) &&
(ptr->data) &&
(RNA_struct_is_a(ptr->type, &RNA_Operator)) &&
(is_valid_wm == (CTX_wm_manager(C) != NULL)))
if ( (!is_static) &&
(ptr->data) &&
(RNA_struct_is_a(ptr->type, &RNA_Operator)) &&
(is_valid_wm == (CTX_wm_manager(C) != NULL)))
{
wmOperator *op= ptr->data;
reports= op->reports;

View File

@@ -148,8 +148,8 @@ static int pyrna_struct_anim_args_parse(
/* internal use for insert and delete */
static int pyrna_struct_keyframe_parse(
PointerRNA *ptr, PyObject *args, PyObject *kw, const char *parse_str, const char *error_prefix,
const char **path_full, int *index, float *cfra, const char **group_name) /* return values */
PointerRNA *ptr, PyObject *args, PyObject *kw, const char *parse_str, const char *error_prefix,
const char **path_full, int *index, float *cfra, const char **group_name) /* return values */
{
static const char *kwlist[]= {"data_path", "index", "frame", "group", NULL};
const char *path;

View File

@@ -60,7 +60,7 @@ static void cb_region_draw(const bContext *C, ARegion *UNUSED(ar), void *customd
cb_args= PyTuple_GET_ITEM((PyObject *)customdata, 1);
result= PyObject_CallObject(cb_func, cb_args);
if(result) {
if (result) {
Py_DECREF(result);
}
else {
@@ -82,21 +82,22 @@ PyObject *pyrna_callback_add(BPy_StructRNA *self, PyObject *args)
if (!PyArg_ParseTuple(args, "OO!|s:bpy_struct.callback_add", &cb_func, &PyTuple_Type, &cb_args, &cb_event_str))
return NULL;
if(!PyCallable_Check(cb_func)) {
if (!PyCallable_Check(cb_func)) {
PyErr_SetString(PyExc_TypeError, "callback_add(): first argument isn't callable");
return NULL;
}
if(RNA_struct_is_a(self->ptr.type, &RNA_Region)) {
if(cb_event_str) {
if (RNA_struct_is_a(self->ptr.type, &RNA_Region)) {
if (cb_event_str) {
static EnumPropertyItem region_draw_mode_items[]= {
{REGION_DRAW_POST_PIXEL, "POST_PIXEL", 0, "Post Pixel", ""},
{REGION_DRAW_POST_VIEW, "POST_VIEW", 0, "Post View", ""},
{REGION_DRAW_PRE_VIEW, "PRE_VIEW", 0, "Pre View", ""},
{0, NULL, 0, NULL, NULL}};
if(pyrna_enum_value_from_id(region_draw_mode_items, cb_event_str, &cb_event, "bpy_struct.callback_add()") < 0)
if (pyrna_enum_value_from_id(region_draw_mode_items, cb_event_str, &cb_event, "bpy_struct.callback_add()") < 0) {
return NULL;
}
}
else {
cb_event= REGION_DRAW_POST_PIXEL;
@@ -124,12 +125,12 @@ PyObject *pyrna_callback_remove(BPy_StructRNA *self, PyObject *args)
handle= PyCapsule_GetPointer(py_handle, RNA_CAPSULE_ID);
if(handle==NULL) {
if (handle==NULL) {
PyErr_SetString(PyExc_ValueError, "callback_remove(handle): NULL handle given, invalid or already removed");
return NULL;
}
if(RNA_struct_is_a(self->ptr.type, &RNA_Region)) {
if (RNA_struct_is_a(self->ptr.type, &RNA_Region)) {
customdata= ED_region_draw_cb_customdata(handle);
Py_DECREF((PyObject *)customdata);

View File

@@ -184,7 +184,8 @@ static PyObject* GPU_export_shader(PyObject* UNUSED(self), PyObject *args, PyObj
PyErr_SetString(PyExc_SystemError, "scene.as_pointer() failed");
return NULL;
}
} else {
}
else {
PyErr_SetString(PyExc_TypeError, "gpu.export_shader() first argument should be of Scene type");
return NULL;
}
@@ -204,7 +205,8 @@ static PyObject* GPU_export_shader(PyObject* UNUSED(self), PyObject *args, PyObj
PyErr_SetString(PyExc_SystemError, "scene.as_pointer() failed");
return NULL;
}
} else {
}
else {
PyErr_SetString(PyExc_TypeError, "gpu.export_shader() second argument should be of Material type");
return NULL;
}
@@ -260,7 +262,8 @@ static PyObject* GPU_export_shader(PyObject* UNUSED(self), PyObject *args, PyObj
if (attribute->name) {
if (attribute->name[0] != 0) {
PY_DICT_ADD_STRING(dict,attribute,name);
} else {
}
else {
val = PyLong_FromLong(0);
PyDict_SetItemString(dict, "name", val);
Py_DECREF(val);