diff options
author | Mike Erwin <significant.bit@gmail.com> | 2015-04-13 23:56:43 +0300 |
---|---|---|
committer | Mike Erwin <significant.bit@gmail.com> | 2015-04-13 23:56:43 +0300 |
commit | 27ded012d68751c3705b4a49d3d59259a2ef8d5c (patch) | |
tree | 6249c17951377537b391076196981f4e8472bbc7 /source/blender | |
parent | 057c7c6fabdb6106079fe4af90721c79c5c59142 (diff) |
cleanup: style
to match my earlier commit in temp_viewport_fx_merge branch
https://developer.blender.org/rBc3f3b958dc0b
plus more
no functional changes
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/interface/interface_widgets.c | 63 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/drawobject.c | 23 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_draw.c | 22 |
3 files changed, 47 insertions, 61 deletions
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index 51a98231c8b..b3c3d7f53a9 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -70,7 +70,7 @@ * - return: array of [size][2][x,y] points, the edges of the roundbox, + UV coords * * - draw black box with alpha 0 on exact button boundbox - * - for ever AA step: + * - for every AA step: * - draw the inner part for a round filled box, with color blend codes or texture coords * - draw outline in outline color * - draw outer part, bottom half, extruded 1 pixel to bottom, for emboss shadow @@ -547,12 +547,12 @@ static void widget_menu_trias(uiWidgetTrias *tria, const rcti *rect) { float centx, centy, size; int a; - + /* center position and size */ centx = rect->xmax - 0.32f * BLI_rcti_size_y(rect); centy = rect->ymin + 0.50f * BLI_rcti_size_y(rect); - size = 0.4f * (float)BLI_rcti_size_y(rect); - + size = 0.4f * BLI_rcti_size_y(rect); + for (a = 0; a < 6; a++) { tria->vec[a][0] = size * menu_tria_vert[a][0] + centx; tria->vec[a][1] = size * menu_tria_vert[a][1] + centy; @@ -585,7 +585,6 @@ static void widget_check_trias(uiWidgetTrias *tria, const rcti *rect) /* prepares shade colors */ static void shadecolors4(char coltop[4], char coldown[4], const char *color, short shadetop, short shadedown) { - coltop[0] = CLAMPIS(color[0] + shadetop, 0, 255); coltop[1] = CLAMPIS(color[1] + shadetop, 0, 255); coltop[2] = CLAMPIS(color[2] + shadetop, 0, 255); @@ -781,6 +780,7 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol) wcol->item[1], wcol->item[2], (unsigned char)((float)wcol->item[3] / WIDGET_AA_JITTER)}; + /* for each AA step */ for (j = 0; j < WIDGET_AA_JITTER; j++) { glTranslatef(jit[j][0], jit[j][1], 0.0f); @@ -799,7 +799,6 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol) } glDisable(GL_BLEND); - } /* *********************** text/icon ************************************** */ @@ -1215,7 +1214,6 @@ static void ui_text_clip_right_label(uiFontStyle *fstyle, uiBut *but, const rcti but->strwidth = BLF_width(fstyle->uifont_id, but->drawstr + but->ofs, sizeof(but->drawstr) - but->ofs); if (but->strwidth < 10) break; } - } @@ -1382,7 +1380,7 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b t = 0; } - glColor3f(0.20, 0.6, 0.9); + glColor3f(0.2, 0.6, 0.9); tx = rect->xmin + t + 2; ty = rect->ymin + 2; @@ -2188,7 +2186,6 @@ static void widget_menu_back(uiWidgetColors *wcol, rcti *rect, int flag, int dir static void ui_hsv_cursor(float x, float y) { - glPushMatrix(); glTranslatef(x, y, 0.0f); @@ -2203,7 +2200,6 @@ static void ui_hsv_cursor(float x, float y) glDisable(GL_LINE_SMOOTH); glPopMatrix(); - } void ui_hsvcircle_vals_from_pos(float *val_rad, float *val_dist, const rcti *rect, @@ -2278,12 +2274,12 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, const rcti * * Useful for color correction tools where you're only interested in hue. */ if (but->flag & UI_BUT_COLOR_LOCK) { if (U.color_picker_type == USER_CP_CIRCLE_HSV) - hsv[2] = 1.f; + hsv[2] = 1.0f; else hsv[2] = 0.5f; } - ui_color_picker_to_rgb(0.f, 0.f, hsv[2], colcent, colcent + 1, colcent + 2); + ui_color_picker_to_rgb(0.0f, 0.0f, hsv[2], colcent, colcent + 1, colcent + 2); glShadeModel(GL_SMOOTH); @@ -2329,7 +2325,7 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, const rcti * void ui_draw_gradient(const rcti *rect, const float hsv[3], const int type, const float alpha) { /* allows for 4 steps (red->yellow) */ - const float color_step = (1.0 / 48.0); + const float color_step = 1.0f / 48.0f; int a; float h = hsv[0], s = hsv[1], v = hsv[2]; float dx, dy, sx1, sx2, sy; @@ -2359,26 +2355,26 @@ void ui_draw_gradient(const rcti *rect, const float hsv[3], const int type, cons hsv_to_rgb(0.0, 1.0, v, &col1[3][0], &col1[3][1], &col1[3][2]); break; case UI_GRAD_H: - hsv_to_rgb(0.0, 1.0, 1.0, &col1[0][0], &col1[0][1], &col1[0][2]); + hsv_to_rgb(0.0, 1.0, 1.0, &col1[0][0], &col1[0][1], &col1[0][2]); copy_v3_v3(col1[1], col1[0]); copy_v3_v3(col1[2], col1[0]); copy_v3_v3(col1[3], col1[0]); break; case UI_GRAD_S: - hsv_to_rgb(1.0, 0.0, 1.0, &col1[1][0], &col1[1][1], &col1[1][2]); + hsv_to_rgb(1.0, 0.0, 1.0, &col1[1][0], &col1[1][1], &col1[1][2]); copy_v3_v3(col1[0], col1[1]); copy_v3_v3(col1[2], col1[1]); copy_v3_v3(col1[3], col1[1]); break; case UI_GRAD_V: - hsv_to_rgb(1.0, 1.0, 0.0, &col1[2][0], &col1[2][1], &col1[2][2]); + hsv_to_rgb(1.0, 1.0, 0.0, &col1[2][0], &col1[2][1], &col1[2][2]); copy_v3_v3(col1[0], col1[2]); copy_v3_v3(col1[1], col1[2]); copy_v3_v3(col1[3], col1[2]); break; default: assert(!"invalid 'type' argument"); - hsv_to_rgb(1.0, 1.0, 1.0, &col1[2][0], &col1[2][1], &col1[2][2]); + hsv_to_rgb(1.0, 1.0, 1.0, &col1[2][0], &col1[2][1], &col1[2][2]); copy_v3_v3(col1[0], col1[2]); copy_v3_v3(col1[1], col1[2]); copy_v3_v3(col1[3], col1[2]); @@ -2417,23 +2413,21 @@ void ui_draw_gradient(const rcti *rect, const float hsv[3], const int type, cons hsv_to_rgb(dx_next, 1.0, v, &col1[3][0], &col1[3][1], &col1[3][2]); break; case UI_GRAD_H: - { /* annoying but without this the color shifts - could be solved some other way * - campbell */ - hsv_to_rgb(dx_next, 1.0, 1.0, &col1[0][0], &col1[0][1], &col1[0][2]); + hsv_to_rgb(dx_next, 1.0, 1.0, &col1[0][0], &col1[0][1], &col1[0][2]); copy_v3_v3(col1[1], col1[0]); copy_v3_v3(col1[2], col1[0]); copy_v3_v3(col1[3], col1[0]); break; - } case UI_GRAD_S: - hsv_to_rgb(h, dx, 1.0, &col1[1][0], &col1[1][1], &col1[1][2]); + hsv_to_rgb(h, dx, 1.0, &col1[1][0], &col1[1][1], &col1[1][2]); copy_v3_v3(col1[0], col1[1]); copy_v3_v3(col1[2], col1[1]); copy_v3_v3(col1[3], col1[1]); break; case UI_GRAD_V: - hsv_to_rgb(h, 1.0, dx, &col1[2][0], &col1[2][1], &col1[2][2]); + hsv_to_rgb(h, 1.0, dx, &col1[2][0], &col1[2][1], &col1[2][2]); copy_v3_v3(col1[0], col1[2]); copy_v3_v3(col1[1], col1[2]); copy_v3_v3(col1[3], col1[2]); @@ -2462,9 +2456,8 @@ void ui_draw_gradient(const rcti *rect, const float hsv[3], const int type, cons } glEnd(); } - + glShadeModel(GL_FLAT); - } bool ui_but_is_colorpicker_display_space(uiBut *but) @@ -2507,11 +2500,10 @@ void ui_hsvcube_pos_from_vals(uiBut *but, const rcti *rect, float *hsv, float *x y = (hsv[2] - but->softmin) / (but->softmax - but->softmin); break; } - + /* cursor */ *xp = rect->xmin + x * BLI_rcti_size_x(rect); *yp = rect->ymin + y * BLI_rcti_size_y(rect); - } static void ui_draw_but_HSVCUBE(uiBut *but, const rcti *rect) @@ -2592,9 +2584,8 @@ static void ui_draw_but_HSV_v(uiBut *but, const rcti *rect) x = rect->xmin + 0.5f * BLI_rcti_size_x(rect); y = rect->ymin + v * BLI_rcti_size_y(rect); CLAMP(y, rect->ymin + 3.0f, rect->ymax - 3.0f); - + ui_hsv_cursor(x, y); - } @@ -2679,7 +2670,8 @@ bool ui_link_bezier_points(const rcti *rect, float coord_array[][2], int resol) BKE_curve_forward_diff_bezier(vec[0][0], vec[1][0], vec[2][0], vec[3][0], &coord_array[0][0], resol, sizeof(float[2])); BKE_curve_forward_diff_bezier(vec[0][1], vec[1][1], vec[2][1], vec[3][1], &coord_array[0][1], resol, sizeof(float[2])); - return 1; + /* TODO: why return anything if always true? */ + return true; } #define LINK_RESOL 24 @@ -2688,9 +2680,10 @@ void ui_draw_link_bezier(const rcti *rect) float coord_array[LINK_RESOL + 1][2]; if (ui_link_bezier_points(rect, coord_array, LINK_RESOL)) { +#if 0 /* unused */ /* we can reuse the dist variable here to increment the GL curve eval amount*/ - // const float dist = 1.0f / (float)LINK_RESOL; // UNUSED - + const float dist = 1.0f / (float)LINK_RESOL; +#endif glEnable(GL_BLEND); glEnable(GL_LINE_SMOOTH); @@ -2701,7 +2694,6 @@ void ui_draw_link_bezier(const rcti *rect) glDisable(GL_BLEND); glDisable(GL_LINE_SMOOTH); - } } @@ -2965,7 +2957,6 @@ static void widget_numslider(uiBut *but, uiWidgetColors *wcol, rcti *rect, int s rect->xmax -= toffs; rect->xmin += toffs; } - } /* I think 3 is sufficient border to indicate keyed status */ @@ -3080,7 +3071,6 @@ static void widget_textbut(uiWidgetColors *wcol, rcti *rect, int state, int roun round_box_edges(&wtb, roundboxalign, rect, rad); widgetbase_draw(&wtb, wcol); - } @@ -3276,7 +3266,6 @@ static void widget_radiobut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), round_box_edges(&wtb, roundboxalign, rect, rad); widgetbase_draw(&wtb, wcol); - } static void widget_box(uiBut *but, uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int roundboxalign) @@ -3317,7 +3306,6 @@ static void widget_but(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int round_box_edges(&wtb, roundboxalign, rect, rad); widgetbase_draw(&wtb, wcol); - } static void widget_roundbut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int roundboxalign) @@ -3361,7 +3349,6 @@ static void widget_draw_extra_mask(const bContext *C, uiBut *but, uiWidgetType * wtb.outline = 1; wtb.inner = 0; widgetbase_draw(&wtb, &wt->wcol); - } static uiWidgetType *widget_type(uiWidgetTypeEnum type) @@ -3928,7 +3915,6 @@ static void draw_disk_shaded( glVertex2f(c * radius_ext, s * radius_ext); } glEnd(); - } void ui_draw_pie_center(uiBlock *block) @@ -4017,7 +4003,6 @@ void ui_draw_search_back(uiStyle *UNUSED(style), uiBlock *block, rcti *rect) wt->draw(&wt->wcol, rect, block->flag, UI_CNR_ALL); else wt->draw(&wt->wcol, rect, 0, UI_CNR_ALL); - } diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index f0b78649307..8dcf1d388ea 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -403,13 +403,13 @@ static const float cosval[CIRCLE_RESOL] = { static void draw_xyz_wire(const float c[3], float size, int axis) { - float v1[3] = {0.f, 0.f, 0.f}, v2[3] = {0.f, 0.f, 0.f}; + float v1[3] = {0.0f, 0.0f, 0.0f}, v2[3] = {0.0f, 0.0f, 0.0f}; float dim = size * 0.1f; float dx[3], dy[3], dz[3]; - dx[0] = dim; dx[1] = 0.f; dx[2] = 0.f; - dy[0] = 0.f; dy[1] = dim; dy[2] = 0.f; - dz[0] = 0.f; dz[1] = 0.f; dz[2] = dim; + dx[0] = dim; dx[1] = 0.0f; dx[2] = 0.0f; + dy[0] = 0.0f; dy[1] = dim; dy[2] = 0.0f; + dz[0] = 0.0f; dz[1] = 0.0f; dz[2] = dim; switch (axis) { case 0: /* x axis */ @@ -425,7 +425,7 @@ static void draw_xyz_wire(const float c[3], float size, int axis) glVertex3fv(v2); /* top left to bottom right */ - mul_v3_fl(dy, 2.f); + mul_v3_fl(dy, 2.0f); add_v3_v3(v1, dy); sub_v3_v3(v2, dy); @@ -448,7 +448,7 @@ static void draw_xyz_wire(const float c[3], float size, int axis) glVertex3fv(v2); /* top left to center */ - mul_v3_fl(dy, 2.f); + mul_v3_fl(dy, 2.0f); add_v3_v3(v1, dy); copy_v3_v3(v2, c); @@ -466,12 +466,12 @@ static void draw_xyz_wire(const float c[3], float size, int axis) glVertex3fv(v1); - mul_v3_fl(dx, 2.f); + mul_v3_fl(dx, 2.0f); add_v3_v3(v1, dx); glVertex3fv(v1); - mul_v3_fl(dz, 2.f); + mul_v3_fl(dz, 2.0f); sub_v3_v3(v1, dx); sub_v3_v3(v1, dz); @@ -484,7 +484,6 @@ static void draw_xyz_wire(const float c[3], float size, int axis) glEnd(); break; } - } void drawaxes(float size, char drawtype) @@ -1619,7 +1618,7 @@ static void draw_viewport_object_reconstruction(Scene *scene, Base *base, View3D glColor3ubv(ob_wire_col); } - glLineWidth(2.f); + glLineWidth(2.0f); glDisable(GL_LIGHTING); glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); @@ -1627,7 +1626,7 @@ static void draw_viewport_object_reconstruction(Scene *scene, Base *base, View3D glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); glEnable(GL_LIGHTING); - glLineWidth(1.f); + glLineWidth(1.0f); } if ((dflag & DRAW_CONSTCOLOR) == 0) { @@ -5240,7 +5239,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv BLI_assert(0); break; } - CLAMP(intensity, 0.f, 1.f); + CLAMP(intensity, 0.0f, 1.0f); weight_to_rgb(ma_col, intensity); } } diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 195dffe74a0..fd6288b1601 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -657,7 +657,7 @@ static void draw_rotation_guide(RegionView3D *rv3d) glEnable(GL_POINT_SMOOTH); glDepthMask(0); /* don't overwrite zbuf */ - if (rv3d->rot_angle != 0.f) { + if (rv3d->rot_angle != 0.0f) { /* -- draw rotation axis -- */ float scaled_axis[3]; const float scale = rv3d->dist; @@ -665,19 +665,21 @@ static void draw_rotation_guide(RegionView3D *rv3d) glBegin(GL_LINE_STRIP); - color[3] = 0.f; /* more transparent toward the ends */ + color[3] = 0.0f; /* more transparent toward the ends */ glColor4fv(color); add_v3_v3v3(end, o, scaled_axis); glVertex3fv(end); - // color[3] = 0.2f + fabsf(rv3d->rot_angle); /* modulate opacity with angle */ - // ^^ neat idea, but angle is frame-rate dependent, so it's usually close to 0.2 +#if 0 + color[3] = 0.2f + fabsf(rv3d->rot_angle); /* modulate opacity with angle */ + /* ^^ neat idea, but angle is frame-rate dependent, so it's usually close to 0.2 */ +#endif color[3] = 0.5f; /* more opaque toward the center */ glColor4fv(color); glVertex3fv(o); - color[3] = 0.f; + color[3] = 0.0f; glColor4fv(color); sub_v3_v3v3(end, o, scaled_axis); glVertex3fv(end); @@ -688,14 +690,14 @@ static void draw_rotation_guide(RegionView3D *rv3d) #define ROT_AXIS_DETAIL 13 const float s = 0.05f * scale; - const float step = 2.f * (float)(M_PI / ROT_AXIS_DETAIL); + const float step = 2.0f * (float)(M_PI / ROT_AXIS_DETAIL); float angle; int i; float q[4]; /* rotate ring so it's perpendicular to axis */ const int upright = fabsf(rv3d->rot_axis[2]) >= 0.95f; if (!upright) { - const float up[3] = {0.f, 0.f, 1.f}; + const float up[3] = {0.0f, 0.0f, 1.0f}; float vis_angle, vis_axis[3]; cross_v3_v3v3(vis_axis, up, rv3d->rot_axis); @@ -706,7 +708,7 @@ static void draw_rotation_guide(RegionView3D *rv3d) color[3] = 0.25f; /* somewhat faint */ glColor4fv(color); glBegin(GL_LINE_LOOP); - for (i = 0, angle = 0.f; i < ROT_AXIS_DETAIL; ++i, angle += step) { + for (i = 0, angle = 0.0f; i < ROT_AXIS_DETAIL; ++i, angle += step) { float p[3] = {s * cosf(angle), s * sinf(angle), 0.0f}; if (!upright) { @@ -732,12 +734,12 @@ static void draw_rotation_guide(RegionView3D *rv3d) glVertex3fv(o); glEnd(); - /* find screen coordinates for rotation center, then draw pretty icon */ #if 0 + /* find screen coordinates for rotation center, then draw pretty icon */ mul_m4_v3(rv3d->persinv, rot_center); UI_icon_draw(rot_center[0], rot_center[1], ICON_NDOF_TURN); -#endif /* ^^ just playing around, does not work */ +#endif glDisable(GL_BLEND); glDisable(GL_POINT_SMOOTH); |