Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-12-18 12:50:06 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-12-18 12:50:06 +0400
commit9c9099a805a1f143ae9916b2b6f03cbfe640bfff (patch)
treefad0cb1bbe1492b3157913486c264454c16ce9f9 /source/blender/python/intern
parent414370b8d42324878485e569fc332b814131887f (diff)
formatting edits in py api, no functional changes
Diffstat (limited to 'source/blender/python/intern')
-rw-r--r--source/blender/python/intern/bpy_app_handlers.c12
-rw-r--r--source/blender/python/intern/bpy_props.c16
-rw-r--r--source/blender/python/intern/bpy_rna.c20
-rw-r--r--source/blender/python/intern/bpy_rna_anim.c4
-rw-r--r--source/blender/python/intern/bpy_rna_callback.c15
-rw-r--r--source/blender/python/intern/gpu.c9
6 files changed, 40 insertions, 36 deletions
diff --git a/source/blender/python/intern/bpy_app_handlers.c b/source/blender/python/intern/bpy_app_handlers.c
index dd512791e85..dc9ef9ee8e8 100644
--- a/source/blender/python/intern/bpy_app_handlers.c
+++ b/source/blender/python/intern/bpy_app_handlers.c
@@ -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 */
}
diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c
index c0d796669d6..d1408015089 100644
--- a/source/blender/python/intern/bpy_props.c
+++ b/source/blender/python/intern/bpy_props.c
@@ -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;
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index f099994fc57..69a5fb39b67 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -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;
diff --git a/source/blender/python/intern/bpy_rna_anim.c b/source/blender/python/intern/bpy_rna_anim.c
index 8f88814b3e4..3006e2a6b90 100644
--- a/source/blender/python/intern/bpy_rna_anim.c
+++ b/source/blender/python/intern/bpy_rna_anim.c
@@ -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;
diff --git a/source/blender/python/intern/bpy_rna_callback.c b/source/blender/python/intern/bpy_rna_callback.c
index 85f950947a7..134cbfda71f 100644
--- a/source/blender/python/intern/bpy_rna_callback.c
+++ b/source/blender/python/intern/bpy_rna_callback.c
@@ -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);
diff --git a/source/blender/python/intern/gpu.c b/source/blender/python/intern/gpu.c
index 0da63297077..a155a7ec3d9 100644
--- a/source/blender/python/intern/gpu.c
+++ b/source/blender/python/intern/gpu.c
@@ -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);