Commit: 395e91b87cf73a9f4d6490f4eb1e462c2a02b71b Author: Pablo Dobarro Date: Sat Feb 8 23:59:22 2020 +0100 Branches: master https://developer.blender.org/rB395e91b87cf73a9f4d6490f4eb1e462c2a02b71b
Cleanup: Sculpt, Comment formatting Reviewed By: brecht Differential Revision: https://developer.blender.org/D6792 =================================================================== M source/blender/editors/sculpt_paint/paint_cursor.c M source/blender/editors/sculpt_paint/paint_hide.c M source/blender/editors/sculpt_paint/paint_mask.c M source/blender/editors/sculpt_paint/sculpt.c M source/blender/editors/sculpt_paint/sculpt_undo.c =================================================================== diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c index cf796c7dd3c..906387fc63b 100644 --- a/source/blender/editors/sculpt_paint/paint_cursor.c +++ b/source/blender/editors/sculpt_paint/paint_cursor.c @@ -98,7 +98,7 @@ static TexSnapshot primary_snap = {0}; static TexSnapshot secondary_snap = {0}; static CursorSnapshot cursor_snap = {0}; -/* delete overlay cursor textures to preserve memory and invalidate all overlay flags */ +/* Delete overlay cursor textures to preserve memory and invalidate all overlay flags. */ void paint_cursor_delete_textures(void) { if (primary_snap.overlay_texture) { @@ -173,7 +173,7 @@ static void load_tex_task_cb_ex(void *__restrict userdata, if (mtex->tex && mtex->tex->type == TEX_IMAGE && mtex->tex->ima) { ImBuf *tex_ibuf = BKE_image_pool_acquire_ibuf(mtex->tex->ima, &mtex->tex->iuser, pool); - /* For consistency, sampling always returns color in linear space */ + /* For consistency, sampling always returns color in linear space. */ if (tex_ibuf && tex_ibuf->rect_float == NULL) { convert_to_linear = true; colorspace = tex_ibuf->rect_colorspace; @@ -182,7 +182,7 @@ static void load_tex_task_cb_ex(void *__restrict userdata, } for (int i = 0; i < size; i++) { - // largely duplicated from tex_strength + /* Largely duplicated from tex_strength. */ int index = j * size + i; @@ -227,7 +227,7 @@ static void load_tex_task_cb_ex(void *__restrict userdata, avg += br->texture_sample_bias; - /* clamp to avoid precision overflow */ + /* Clamp to avoid precision overflow. */ CLAMP(avg, 0.0f, 1.0f); buffer[index] = 255 - (GLubyte)(255 * avg); } @@ -269,7 +269,7 @@ static int load_tex(Brush *br, ViewContext *vc, float zoom, bool col, bool prima if (refresh) { struct ImagePool *pool = NULL; - /* stencil is rotated later */ + /* Stencil is rotated later. */ const float rotation = (mtex->brush_map_mode != MTEX_MAP_MODE_STENCIL) ? -mtex->rot : 0.0f; const float radius = BKE_brush_size_get(vc->scene, br) * zoom; @@ -317,7 +317,7 @@ static int load_tex(Brush *br, ViewContext *vc, float zoom, bool col, bool prima pool = BKE_image_pool_new(); if (mtex->tex && mtex->tex->nodetree) { - /* has internal flag to detect it only does it once */ + /* Has internal flag to detect it only does it once. */ ntreeTexBeginExecTree(mtex->tex->nodetree); } @@ -400,7 +400,7 @@ static void load_tex_cursor_task_cb(void *__restrict userdata, const int size = data->size; for (int i = 0; i < size; i++) { - // largely duplicated from tex_strength + /* Largely duplicated from tex_strength. */ const int index = j * size + i; const float x = (((float)i / size) - 0.5f) * 2.0f; @@ -408,7 +408,9 @@ static void load_tex_cursor_task_cb(void *__restrict userdata, const float len = sqrtf(x * x + y * y); if (len <= 1.0f) { - float avg = BKE_brush_curve_strength_clamped(br, len, 1.0f); /* Falloff curve */ + + /* Falloff curve. */ + float avg = BKE_brush_curve_strength_clamped(br, len, 1.0f); buffer[index] = (GLubyte)(255 * avg); } @@ -520,7 +522,7 @@ static int project_brush_radius(ViewContext *vc, float radius, const float locat ED_view3d_global_to_vector(vc->rv3d, location, view); - /* create a vector that is not orthogonal to view */ + /* Create a vector that is not orthogonal to view. */ if (fabsf(view[0]) < 0.1f) { nonortho[0] = view[0] + 1.0f; @@ -538,23 +540,24 @@ static int project_brush_radius(ViewContext *vc, float radius, const float locat nonortho[2] = view[2] + 1.0f; } - /* get a vector in the plane of the view */ + /* Get a vector in the plane of the view. */ cross_v3_v3v3(ortho, nonortho, view); normalize_v3(ortho); - /* make a point on the surface of the brush tangent to the view */ + /* Make a point on the surface of the brush tangent to the view. */ mul_v3_fl(ortho, radius); add_v3_v3v3(offset, location, ortho); - /* project the center of the brush, and the tangent point to the view onto the screen */ + /* Project the center of the brush, and the tangent point to the view onto the screen. */ if ((ED_view3d_project_float_global(vc->ar, location, p1, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK) && (ED_view3d_project_float_global(vc->ar, offset, p2, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK)) { - /* the distance between these points is the size of the projected brush in pixels */ + /* The distance between these points is the size of the projected brush in pixels. */ return len_v2v2(p1, p2); } else { - BLI_assert(0); /* assert because the code that sets up the vectors should disallow this */ + /* Assert because the code that sets up the vectors should disallow this. */ + BLI_assert(0); return 0; } } @@ -608,7 +611,7 @@ static bool sculpt_get_brush_geometry(bContext *C, } /* Draw an overlay that shows what effect the brush's texture will - * have on brush strength */ + * have on brush strength. */ static bool paint_draw_tex_overlay(UnifiedPaintSettings *ups, Brush *brush, ViewContext *vc, @@ -619,7 +622,7 @@ static bool paint_draw_tex_overlay(UnifiedPaintSettings *ups, bool primary) { rctf quad; - /* check for overlay mode */ + /* Check for overlay mode. */ MTex *mtex = (primary) ? &brush->mtex : &brush->mask_mtex; bool valid = ((primary) ? (brush->overlay_flags & BRUSH_OVERLAY_PRIMARY) != 0 : @@ -642,12 +645,12 @@ static bool paint_draw_tex_overlay(UnifiedPaintSettings *ups, if (mtex->brush_map_mode == MTEX_MAP_MODE_VIEW) { GPU_matrix_push(); - /* brush rotation */ + /* Brush rotation. */ GPU_matrix_translate_2f(x, y); GPU_matrix_rotate_2d(-RAD2DEGF(primary ? ups->brush_rotation : ups->brush_rotation_sec)); GPU_matrix_translate_2f(-x, -y); - /* scale based on tablet pressure */ + /* Scale based on tablet pressure. */ if (primary && ups->stroke_active && BKE_brush_use_size_pressure(brush)) { const float scale = ups->size_pressure_value; GPU_matrix_translate_2f(x, y); @@ -675,7 +678,7 @@ static bool paint_draw_tex_overlay(UnifiedPaintSettings *ups, quad.xmax = BLI_rcti_size_x(&vc->ar->winrct); quad.ymax = BLI_rcti_size_y(&vc->ar->winrct); } - /* Stencil code goes here */ + /* Stencil code goes here. */ else { if (primary) { quad.xmin = -brush->stencil_dimension[0]; @@ -699,7 +702,7 @@ static bool paint_draw_tex_overlay(UnifiedPaintSettings *ups, GPU_matrix_rotate_2d(RAD2DEGF(mtex->rot)); } - /* set quad color. Colored overlay does not get blending */ + /* Set quad color. Colored overlay does not get blending. */ GPUVertFormat *format = immVertexFormat(); uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); uint texCoord = GPU_vertformat_attr_add(format, "texCoord", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); @@ -714,7 +717,7 @@ static bool paint_draw_tex_overlay(UnifiedPaintSettings *ups, immUniformColor3fvAlpha(U.sculpt_paint_overlay_col, overlay_alpha * 0.01f); } - /* draw textured quad */ + /* Draw textured quad. */ immUniform1i("image", 0); immBegin(GPU_PRIM_TRI_FAN, 4); @@ -739,12 +742,12 @@ static bool paint_draw_tex_overlay(UnifiedPaintSettings *ups, } /* Draw an overlay that shows what effect the brush's texture will - * have on brush strength */ + * have on brush strength. */ static bool paint_draw_cursor_overlay( UnifiedPaintSettings *ups, Brush *brush, ViewContext *vc, int x, int y, float zoom) { rctf quad; - /* check for overlay mode */ + /* Check for overlay mode. */ if (!(brush->overlay_flags & BRUSH_OVERLAY_CURSOR)) { return false; @@ -777,7 +780,7 @@ static bool paint_draw_cursor_overlay( quad.ymax = y + radius; } - /* scale based on tablet pressure */ + /* Scale based on tablet pressure. */ if (ups->stroke_active && BKE_brush_use_size_pressure(brush)) { do_pop = true; GPU_matrix_push(); @@ -795,9 +798,9 @@ static bool paint_draw_cursor_overlay( immUniformColor3fvAlpha(U.sculpt_paint_overlay_col, brush->cursor_overlay_alpha * 0.01f); - /* draw textured quad */ + /* Draw textured quad. */ - /* draw textured quad */ + /* Draw textured quad. */ immUniform1i("image", 0); immBegin(GPU_PRIM_TRI_FAN, 4); @@ -980,7 +983,7 @@ static void paint_draw_curve_cursor(Brush *brush, ViewContext *vc) GPU_line_smooth(true); GPU_blend(true); - /* draw the bezier handles and the curve segment between the current and next point */ + /* Draw the bezier handles and the curve segment between the current and next point. */ uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -994,7 +997,7 @@ static void paint_draw_curve_cursor(Brush *brush, ViewContext *vc) int j; PaintCurvePoint *cp_next = cp + 1; float data[(PAINT_CURVE_NUM_SEGMENTS + 1) * 2]; - /* use color coding to distinguish handles vs curve segments */ + /* Use color coding to distinguish handles vs curve segments. */ draw_bezier_handle_lines(pos, selec_col, &cp->bez); draw_tri_point(pos, selec_col, pivot_col, &cp->bez.vec[1][0], 10.0f, cp->bez.f2); draw_rect_point( @@ -1031,7 +1034,7 @@ static void paint_draw_curve_cursor(Brush *brush, ViewContext *vc) immEnd(); } - /* draw last line segment */ + /* Draw last line segment. */ draw_bezier_handle_lines(pos, selec_col, &cp->bez); draw_tri_point(pos, selec_col, pivot_col, &cp->bez.vec[1][0], 10.0f, cp->bez.f2); draw_rect_point( @@ -1048,7 +1051,7 @@ static void paint_draw_curve_cursor(Brush *brush, ViewContext *vc) } /* Special actions taken when paint cursor goes over mesh */ -/* TODO: sculpt only for now */ +/ @@ Diff output truncated at 10240 characters. @@ _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs