diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-08-25 19:49:52 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-08-25 19:49:52 +0400 |
commit | b7eac1edcf472df7c705e6c3463e8404f72422df (patch) | |
tree | 6966686125b6e31c820edd44c8e1818b2388dd34 /source/blender/editors | |
parent | b44a82f3c4d00a84e36c81512080c0c616ac8bad (diff) |
picky style edits with screen/view/drawing, also remove own bad example doc.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/interface/interface_draw.c | 40 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_handlers.c | 3 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_icons.c | 3 | ||||
-rw-r--r-- | source/blender/editors/screen/screen_edit.c | 3 | ||||
-rw-r--r-- | source/blender/editors/screen/screen_ops.c | 15 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/drawobject.c | 24 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_draw.c | 10 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_edit.c | 18 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_view.c | 6 |
9 files changed, 48 insertions, 74 deletions
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index dd7d2ca765f..76ed9891b8e 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -530,14 +530,11 @@ static void ui_draw_but_CHARTAB(uiBut *but) int charmax = G.charmax; /* FO_BUILTIN_NAME font in use. There are TTF FO_BUILTIN_NAME and non-TTF FO_BUILTIN_NAME fonts */ - if(!strcmp(G.selfont->name, FO_BUILTIN_NAME)) - { - if(G.ui_international == TRUE) - { + if(!strcmp(G.selfont->name, FO_BUILTIN_NAME)) { + if(G.ui_international == TRUE) { charmax = 0xff; } - else - { + else { charmax = 0xff; } } @@ -562,16 +559,13 @@ static void ui_draw_but_CHARTAB(uiBut *but) cs = G.charstart; /* Set the font, in case it is not FO_BUILTIN_NAME font */ - if(G.selfont && strcmp(G.selfont->name, FO_BUILTIN_NAME)) - { + if(G.selfont && strcmp(G.selfont->name, FO_BUILTIN_NAME)) { // Is the font file packed, if so then use the packed file - if(G.selfont->packedfile) - { + if(G.selfont->packedfile) { pf = G.selfont->packedfile; FTF_SetFont(pf->data, pf->size, 14.0); } - else - { + else { char tmpStr[256]; int err; @@ -580,10 +574,8 @@ static void ui_draw_but_CHARTAB(uiBut *but) err = FTF_SetFont((unsigned char *)tmpStr, 0, 14.0); } } - else - { - if(G.ui_international == TRUE) - { + else { + if(G.ui_international == TRUE) { FTF_SetFont((unsigned char *) datatoc_bfont_ttf, datatoc_bfont_ttf_size, 14.0); } } @@ -595,8 +587,7 @@ static void ui_draw_but_CHARTAB(uiBut *but) glRectf((rect->xmin), (rect->ymin), (rect->xmax), (rect->ymax)); glColor3ub(0, 0, 0); - for(y = 0; y < 6; y++) - { + for(y = 0; y < 6; y++) { // Do not draw more than the category allows if(cs > charmax) break; @@ -676,23 +667,19 @@ static void ui_draw_but_CHARTAB(uiBut *but) glShadeModel(GL_FLAT); /* Return Font Settings to original */ - if(U.fontsize && U.fontname[0]) - { + if(U.fontsize && U.fontname[0]) { result = FTF_SetFont((unsigned char *)U.fontname, 0, U.fontsize); } - else if (U.fontsize) - { + else if (U.fontsize) { result = FTF_SetFont((unsigned char *) datatoc_bfont_ttf, datatoc_bfont_ttf_size, U.fontsize); } - if (result == 0) - { + if (result == 0) { result = FTF_SetFont((unsigned char *) datatoc_bfont_ttf, datatoc_bfont_ttf_size, 11); } /* resets the font size */ - if(G.ui_international == TRUE) - { + if(G.ui_international == TRUE) { // uiSetCurFont(but->block, UI_HELV); } } @@ -1604,7 +1591,6 @@ void ui_dropshadow(rctf *rct, float radius, float aspect, int UNUSED(select)) #endif { a= i*aspect; - } for(; i--; a-=aspect) { diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 3bd29f8de3e..d7eba8c0ac7 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -800,8 +800,7 @@ static void ui_add_smart_controller(bContext *C, uiBut *from, uiBut *to) if(!act_iter) return; /* (3) add a new controller */ - if (WM_operator_name_call(C, "LOGIC_OT_controller_add", WM_OP_EXEC_DEFAULT, NULL) & OPERATOR_FINISHED) - { + if (WM_operator_name_call(C, "LOGIC_OT_controller_add", WM_OP_EXEC_DEFAULT, NULL) & OPERATOR_FINISHED) { cont = (bController *)ob->controllers.last; /* (4) link the sensor->controller->actuator */ diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index 412c0233c35..c3a0f438fbe 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -1103,8 +1103,7 @@ int ui_id_icon_get(bContext *C, ID *id, int big) int iconid= 0; /* icon */ - switch(GS(id->name)) - { + switch(GS(id->name)) { case ID_BR: iconid= ui_id_brush_get_icon(C, id); break; diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c index 80a65d3224e..5e875e40f14 100644 --- a/source/blender/editors/screen/screen_edit.c +++ b/source/blender/editors/screen/screen_edit.c @@ -533,8 +533,7 @@ int screen_area_join(bContext *C, bScreen* scr, ScrArea *sa1, ScrArea *sa2) dir = area_getorientation(sa1, sa2); /*printf("dir is : %i \n", dir);*/ - if (dir < 0) - { + if (dir < 0) { if (sa1 ) sa1->flag &= ~AREA_FLAG_DRAWJOINFROM; if (sa2 ) sa2->flag &= ~AREA_FLAG_DRAWJOINTO; return 0; diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 1410331700f..0ac30853eae 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -1544,8 +1544,7 @@ static int area_max_regionsize(ScrArea *sa, ARegion *scalear, AZEdge edge) /* subtractwidth of regions on opposite side * prevents dragging regions into other opposite regions */ - for (ar=sa->regionbase.first; ar; ar=ar->next) - { + for (ar=sa->regionbase.first; ar; ar=ar->next) { if (ar == scalear) continue; @@ -2021,12 +2020,12 @@ static void SCREEN_OT_screen_full_area(wmOperatorType *ot) */ typedef struct sAreaJoinData - { - ScrArea *sa1; /* first area to be considered */ - ScrArea *sa2; /* second area to be considered */ - ScrArea *scr; /* designed for removal */ - - } sAreaJoinData; +{ + ScrArea *sa1; /* first area to be considered */ + ScrArea *sa2; /* second area to be considered */ + ScrArea *scr; /* designed for removal */ + +} sAreaJoinData; /* validate selection inside screen, set variables OK */ diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 3133ad131bb..638d197ccf7 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -2843,18 +2843,17 @@ static int draw_mesh_object(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D Object *ob= base->object; Object *obedit= scene->obedit; Mesh *me= ob->data; - Material *ma=NULL; EditMesh *em= me->edit_mesh; int do_alpha_pass= 0, drawlinked= 0, retval= 0, glsl, check_alpha, i; - /* If we are drawing shadows and any of the materials don't cast a shadow, then don't draw the object */ - if (v3d->flag2 & V3D_RENDER_SHADOW) - { - for(i=0; i<ob->totcol; ++i) - { - ma = give_current_material(ob, i); - if (ma && !(ma->mode & MA_SHADBUF)) + /* If we are drawing shadows and any of the materials don't cast a shadow, + * then don't draw the object */ + if (v3d->flag2 & V3D_RENDER_SHADOW) { + for(i=0; i<ob->totcol; ++i) { + Material *ma= give_current_material(ob, i); + if (ma && !(ma->mode & MA_SHADBUF)) { return 1; + } } } @@ -6125,8 +6124,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) } /* draw code for smoke */ - if((md = modifiers_findByType(ob, eModifierType_Smoke))) - { + if((md = modifiers_findByType(ob, eModifierType_Smoke))) { SmokeModifierData *smd = (SmokeModifierData *)md; // draw collision objects @@ -6518,7 +6516,6 @@ void draw_object_backbufsel(Scene *scene, View3D *v3d, RegionView3D *rv3d, Objec switch( ob->type) { case OB_MESH: - { if(ob->mode & OB_MODE_EDIT) { Mesh *me= ob->data; EditMesh *em= me->edit_mesh; @@ -6552,8 +6549,9 @@ void draw_object_backbufsel(Scene *scene, View3D *v3d, RegionView3D *rv3d, Objec EM_free_index_arrays(); } - else bbs_mesh_solid(scene, ob); - } + else { + bbs_mesh_solid(scene, ob); + } break; case OB_CURVE: case OB_SURF: diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 9249d4d2bf0..80da75bc603 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -1141,12 +1141,10 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d) glRectf(x1i, y1i, x2i, y2i); #ifdef VIEW3D_CAMERA_BORDER_HACK - { - if(view3d_camera_border_hack_test == TRUE) { - glColor4fv(view3d_camera_border_hack_col); - glRectf(x1i+1, y1i+1, x2i-1, y2i-1); - view3d_camera_border_hack_test= FALSE; - } + if(view3d_camera_border_hack_test == TRUE) { + glColor4fv(view3d_camera_border_hack_col); + glRectf(x1i+1, y1i+1, x2i-1, y2i-1); + view3d_camera_border_hack_test= FALSE; } #endif diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 979a602b4f5..0e8dd38c02c 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -372,12 +372,12 @@ static void calctrackballvec(rcti *rect, int mx, int my, float *vec) y/= (float)((rect->ymax - rect->ymin)/2); d = sqrt(x*x + y*y); - if (d < radius * (float)M_SQRT1_2) /* Inside sphere */ - z = sqrt(radius*radius - d*d); - else - { /* On hyperbola */ - t = radius / (float)M_SQRT2; - z = t*t / d; + if (d < radius * (float)M_SQRT1_2) { /* Inside sphere */ + z= sqrt(radius*radius - d*d); + } + else { /* On hyperbola */ + t= radius / (float)M_SQRT2; + z= t*t / d; } vec[0]= x; @@ -1620,8 +1620,7 @@ static int viewzoom_invoke(bContext *C, wmOperator *op, wmEvent *event) vod= op->customdata; /* if one or the other zoom position aren't set, set from event */ - if (!RNA_property_is_set(op->ptr, "mx") || !RNA_property_is_set(op->ptr, "my")) - { + if (!RNA_property_is_set(op->ptr, "mx") || !RNA_property_is_set(op->ptr, "my")) { RNA_int_set(op->ptr, "mx", event->x); RNA_int_set(op->ptr, "my", event->y); } @@ -1834,8 +1833,7 @@ static int viewdolly_invoke(bContext *C, wmOperator *op, wmEvent *event) vod= op->customdata; /* if one or the other zoom position aren't set, set from event */ - if (!RNA_property_is_set(op->ptr, "mx") || !RNA_property_is_set(op->ptr, "my")) - { + if (!RNA_property_is_set(op->ptr, "mx") || !RNA_property_is_set(op->ptr, "my")) { RNA_int_set(op->ptr, "mx", event->x); RNA_int_set(op->ptr, "my", event->y); } diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index ed0b2645c99..c48459108eb 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -840,8 +840,7 @@ void project_int_noclip(ARegion *ar, const float vec[3], int adr[2]) adr[0] = (int)floor(fx); adr[1] = (int)floor(fy); } - else - { + else { adr[0] = ar->winx / 2; adr[1] = ar->winy / 2; } @@ -904,8 +903,7 @@ void project_float_noclip(ARegion *ar, const float vec[3], float adr[2]) adr[0] = (float)(ar->winx/2.0f)+(ar->winx/2.0f)*vec4[0]/vec4[3]; adr[1] = (float)(ar->winy/2.0f)+(ar->winy/2.0f)*vec4[1]/vec4[3]; } - else - { + else { adr[0] = ar->winx / 2.0f; adr[1] = ar->winy / 2.0f; } |