From 96bd647c4f9eff5fe21308228808ad8cd992ba68 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 21 Dec 2011 22:56:06 +0000 Subject: [PATCH] split some >120 lines, no functional changes --- source/blender/blenkernel/intern/unit.c | 10 +++-- .../editors/transform/transform_conversions.c | 24 ++++++++--- source/blender/makesrna/intern/rna_access.c | 43 ++++++++++++++----- source/blender/python/intern/gpu.c | 16 ++++--- 4 files changed, 67 insertions(+), 26 deletions(-) diff --git a/source/blender/blenkernel/intern/unit.c b/source/blender/blenkernel/intern/unit.c index aa914998a72..81c526e45a6 100644 --- a/source/blender/blenkernel/intern/unit.c +++ b/source/blender/blenkernel/intern/unit.c @@ -299,7 +299,8 @@ static bUnitDef *unit_best_fit(double value, bUnitCollection *usys, bUnitDef *un if(suppress && (unit->flag & B_UNIT_DEF_SUPPRESS)) continue; - if (value_abs >= unit->scalar*(1.0-EPS)) /* scale down scalar so 1cm doesnt convert to 10mm because of float error */ + /* scale down scalar so 1cm doesnt convert to 10mm because of float error */ + if (value_abs >= unit->scalar*(1.0-EPS)) return unit; } @@ -481,11 +482,14 @@ static int ch_is_op(char op) } } -static int unit_scale_str(char *str, int len_max, char *str_tmp, double scale_pref, bUnitDef *unit, const char *replace_str) +static int unit_scale_str(char *str, int len_max, char *str_tmp, + double scale_pref, bUnitDef *unit, const char *replace_str) { char *str_found; - if((len_max>0) && (str_found= (char *)unit_find_str(str, replace_str))) { /* XXX - investigate, does not respect len_max properly */ + if((len_max>0) && (str_found= (char *)unit_find_str(str, replace_str))) { + /* XXX - investigate, does not respect len_max properly */ + int len, len_num, len_name, len_move, found_ofs; found_ofs = (int)(str_found-str); diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 4b6c3a7031b..53d26f0a655 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -1548,8 +1548,10 @@ static void createTransCurveVerts(bContext *C, TransInfo *t) /* TODO - in the case of tilt and radius we can also avoid allocating the initTransDataCurveHandles * but for now just dont change handle types */ - if (ELEM(t->mode, TFM_CURVE_SHRINKFATTEN, TFM_TILT) == 0) - testhandlesNurb(nu); /* sets the handles based on their selection, do this after the data is copied to the TransData */ + if (ELEM(t->mode, TFM_CURVE_SHRINKFATTEN, TFM_TILT) == 0) { + /* sets the handles based on their selection, do this after the data is copied to the TransData */ + testhandlesNurb(nu); + } } else { TransData *head, *tail; @@ -4443,7 +4445,8 @@ static int count_proportional_objects(TransInfo *t) /* mark all children */ for (base= scene->base.first; base; base= base->next) { /* all base not already selected or marked that is editable */ - if ((base->object->flag & (SELECT|BA_TRANSFORM_CHILD|BA_TRANSFORM_PARENT)) == 0 && BASE_EDITABLE_BGMODE(v3d, scene, base)) + if ( (base->object->flag & (SELECT|BA_TRANSFORM_CHILD|BA_TRANSFORM_PARENT)) == 0 && + (BASE_EDITABLE_BGMODE(v3d, scene, base))) { mark_children(base->object); } @@ -4454,7 +4457,8 @@ static int count_proportional_objects(TransInfo *t) Object *ob= base->object; /* if base is not selected, not a parent of selection or not a child of selection and it is editable */ - if ((ob->flag & (SELECT|BA_TRANSFORM_CHILD|BA_TRANSFORM_PARENT)) == 0 && BASE_EDITABLE_BGMODE(v3d, scene, base)) + if ( (ob->flag & (SELECT|BA_TRANSFORM_CHILD|BA_TRANSFORM_PARENT)) == 0 && + (BASE_EDITABLE_BGMODE(v3d, scene, base))) { /* used for flush, depgraph will change recalcs if needed :) */ @@ -4530,7 +4534,9 @@ void autokeyframe_ob_cb_func(bContext *C, Scene *scene, View3D *v3d, Object *ob, if (adt && adt->action) { for (fcu= adt->action->curves.first; fcu; fcu= fcu->next) { fcu->flag &= ~FCURVE_SELECTED; - insert_keyframe(reports, id, adt->action, ((fcu->grp)?(fcu->grp->name):(NULL)), fcu->rna_path, fcu->array_index, cfra, flag); + insert_keyframe(reports, id, adt->action, + (fcu->grp ? fcu->grp->name : NULL), + fcu->rna_path, fcu->array_index, cfra, flag); } } } @@ -5048,8 +5054,12 @@ void special_aftertrans_update(bContext *C, TransInfo *t) DAG_id_tag_update(&ob->id, OB_RECALC_DATA); } - else if(t->scene->basact && (ob = t->scene->basact->object) && (ob->mode & OB_MODE_PARTICLE_EDIT) && PE_get_current(t->scene, ob)) { - ; + else if ( (t->scene->basact) && + (ob = t->scene->basact->object) && + (ob->mode & OB_MODE_PARTICLE_EDIT) && + PE_get_current(t->scene, ob)) + { + /* do nothing */ ; } else { /* Objects */ int i, recalcObPaths=0; diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index 02b1fa300fb..56edfef8aa1 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -837,12 +837,17 @@ char RNA_property_array_item_char(PropertyRNA *prop, int index) PropertySubType subtype= rna_ensure_property(prop)->subtype; /* get string to use for array index */ - if ((index < 4) && ELEM(subtype, PROP_QUATERNION, PROP_AXISANGLE)) + if ((index < 4) && ELEM(subtype, PROP_QUATERNION, PROP_AXISANGLE)) { return quatitem[index]; - else if((index < 4) && ELEM8(subtype, PROP_TRANSLATION, PROP_DIRECTION, PROP_XYZ, PROP_XYZ_LENGTH, PROP_EULER, PROP_VELOCITY, PROP_ACCELERATION, PROP_COORDS)) + } + else if((index < 4) && ELEM8(subtype, PROP_TRANSLATION, PROP_DIRECTION, PROP_XYZ, PROP_XYZ_LENGTH, + PROP_EULER, PROP_VELOCITY, PROP_ACCELERATION, PROP_COORDS)) + { return vectoritem[index]; - else if ((index < 4) && ELEM(subtype, PROP_COLOR, PROP_COLOR_GAMMA)) + } + else if ((index < 4) && ELEM(subtype, PROP_COLOR, PROP_COLOR_GAMMA)) { return coloritem[index]; + } return '\0'; } @@ -865,7 +870,9 @@ int RNA_property_array_item_index(PropertyRNA *prop, char name) return 3; } } - else if(ELEM6(subtype, PROP_TRANSLATION, PROP_DIRECTION, PROP_XYZ, PROP_EULER, PROP_VELOCITY, PROP_ACCELERATION)) { + else if(ELEM6(subtype, PROP_TRANSLATION, PROP_DIRECTION, PROP_XYZ, + PROP_EULER, PROP_VELOCITY, PROP_ACCELERATION)) + { switch (name) { case 'x': return 0; @@ -1519,7 +1526,8 @@ void RNA_property_update_cache_add(PointerRNA *ptr, PropertyRNA *prop) /* find cache element for which key matches... */ for (uce = rna_updates_cache.first; uce; uce = uce->next) { /* just match by id only for now, since most update calls that we'll encounter only really care about this */ - // TODO: later, the cache might need to have some nesting on L1 to cope better with these problems + some tagging to indicate we need this + /* TODO: later, the cache might need to have some nesting on L1 to cope better + * with these problems + some tagging to indicate we need this */ if (uce->ptr.id.data == ptr->id.data) break; } @@ -4969,7 +4977,9 @@ static int rna_function_format_array_length(const char *format, int ofs, int fle return 0; } -static int rna_function_parameter_parse(PointerRNA *ptr, PropertyRNA *prop, PropertyType type, char ftype, int len, void *dest, void *src, StructRNA *srna, const char *tid, const char *fid, const char *pid) +static int rna_function_parameter_parse(PointerRNA *ptr, PropertyRNA *prop, PropertyType type, + char ftype, int len, void *dest, void *src, StructRNA *srna, + const char *tid, const char *fid, const char *pid) { /* ptr is always a function pointer, prop always a parameter */ @@ -5055,7 +5065,9 @@ static int rna_function_parameter_parse(PointerRNA *ptr, PropertyRNA *prop, Prop } if (ptype!=srna && !RNA_struct_is_a(srna, ptype)) { - fprintf(stderr, "%s.%s: wrong type for parameter %s, an object of type %s was expected, passed an object of type %s\n", tid, fid, pid, RNA_struct_identifier(ptype), RNA_struct_identifier(srna)); + fprintf(stderr, "%s.%s: wrong type for parameter %s, " + "an object of type %s was expected, passed an object of type %s\n", + tid, fid, pid, RNA_struct_identifier(ptype), RNA_struct_identifier(srna)); return -1; } @@ -5080,7 +5092,10 @@ static int rna_function_parameter_parse(PointerRNA *ptr, PropertyRNA *prop, Prop ptype= RNA_property_pointer_type(ptr, prop); if (ptype!=srna && !RNA_struct_is_a(srna, ptype)) { - fprintf(stderr, "%s.%s: wrong type for parameter %s, a collection of objects of type %s was expected, passed a collection of objects of type %s\n", tid, fid, pid, RNA_struct_identifier(ptype), RNA_struct_identifier(srna)); + fprintf(stderr, "%s.%s: wrong type for parameter %s, " + "a collection of objects of type %s was expected, " + "passed a collection of objects of type %s\n", + tid, fid, pid, RNA_struct_identifier(ptype), RNA_struct_identifier(srna)); return -1; } @@ -5159,7 +5174,10 @@ int RNA_function_call_direct_va(bContext *C, ReportList *reports, PointerRNA *pt if (len!=alen) { err= -1; - fprintf(stderr, "%s.%s: for parameter %s, was expecting an array of %i elements, passed %i elements instead\n", tid, fid, pid, len, alen); + fprintf(stderr, "%s.%s: for parameter %s, " + "was expecting an array of %i elements, " + "passed %i elements instead\n", + tid, fid, pid, len, alen); break; } @@ -5224,7 +5242,9 @@ int RNA_function_call_direct_va(bContext *C, ReportList *reports, PointerRNA *pt if (len!=alen) { err= -1; - fprintf(stderr, "%s.%s: for return parameter %s, was expecting an array of %i elements, passed %i elements instead\n", tid, fid, pid, len, alen); + fprintf(stderr, "%s.%s: for return parameter %s, " + "was expecting an array of %i elements, passed %i elements instead\n", + tid, fid, pid, len, alen); } else { switch (type) { @@ -5278,7 +5298,8 @@ int RNA_function_call_direct_va(bContext *C, ReportList *reports, PointerRNA *pt return err; } -int RNA_function_call_direct_va_lookup(bContext *C, ReportList *reports, PointerRNA *ptr, const char *identifier, const char *format, va_list args) +int RNA_function_call_direct_va_lookup(bContext *C, ReportList *reports, PointerRNA *ptr, + const char *identifier, const char *format, va_list args) { FunctionRNA *func; diff --git a/source/blender/python/intern/gpu.c b/source/blender/python/intern/gpu.c index a155a7ec3d9..66e8ff510ef 100644 --- a/source/blender/python/intern/gpu.c +++ b/source/blender/python/intern/gpu.c @@ -145,6 +145,14 @@ PyInit_gpu(void) PyObject_SetAttrString(d, #f, val); \ Py_DECREF(val) +PyDoc_STRVAR(GPU_export_shader_doc, +"export_shader(scene, material)\n" +"\n" +" Returns the GLSL shader that produces the visual effect of material in scene.\n" +"\n" +" :return: Dictionary defining the shader, uniforms and attributes.\n" +" :rtype: Dict" +); static PyObject* GPU_export_shader(PyObject* UNUSED(self), PyObject *args, PyObject *kwds) { PyObject* pyscene; @@ -279,11 +287,9 @@ static PyObject* GPU_export_shader(PyObject* UNUSED(self), PyObject *args, PyObj return result; } -static PyMethodDef meth_export_shader[] = {{ "export_shader", (PyCFunction)GPU_export_shader, METH_VARARGS | METH_KEYWORDS, - "export_shader(scene,material)\n\n" - "Returns the GLSL shader that produces the visual effect of material in scene.\n\n" - ":return: Dictionary defining the shader, uniforms and attributes.\n" - ":rtype: Dict"}}; +static PyMethodDef meth_export_shader[] = { + {"export_shader", (PyCFunction)GPU_export_shader, METH_VARARGS | METH_KEYWORDS, GPU_export_shader_doc} +}; PyObject* GPU_initPython(void) {