diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-04-21 17:18:34 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-04-21 23:30:04 +0300 |
commit | 0ac990d088d553c27f5360f62e142e99f087890a (patch) | |
tree | ef3637e9f8086bc937b56777ea9b1f36f97790a4 /source/blender/editors/sculpt_paint | |
parent | f8b2268f4fbe92a1860c525f70fdc293304575ff (diff) |
Cleanup: comments (long lines) in editors
Diffstat (limited to 'source/blender/editors/sculpt_paint')
9 files changed, 75 insertions, 49 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c index da183d190fa..f69ee66e15c 100644 --- a/source/blender/editors/sculpt_paint/paint_cursor.c +++ b/source/blender/editors/sculpt_paint/paint_cursor.c @@ -194,8 +194,8 @@ static void load_tex_task_cb_ex(void *__restrict userdata, len = sqrtf(x * x + y * y); if (ELEM(mtex->brush_map_mode, MTEX_MAP_MODE_TILED, MTEX_MAP_MODE_STENCIL) || len <= 1.0f) { - /* it is probably worth optimizing for those cases where the texture is not rotated by skipping the calls to - * atan2, sqrtf, sin, and cos. */ + /* It is probably worth optimizing for those cases where the texture is not rotated by + * skipping the calls to atan2, sqrtf, sin, and cos. */ if (mtex->tex && (rotation > 0.001f || rotation < -0.001f)) { const float angle = atan2f(y, x) + rotation; diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 4c978f560b3..b82014dcfec 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -81,8 +81,10 @@ #include "paint_intern.h" -/* This is a static resource for non-global access. - * Maybe it should be exposed as part of the paint operation, but for now just give a public interface. +/** + * This is a static resource for non-global access. + * Maybe it should be exposed as part of the paint operation, + * but for now just give a public interface. */ static ImagePaintPartialRedraw imapaintpartial = {0, 0, 0, 0, 0}; diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c index 50340210932..6b4951d1ca4 100644 --- a/source/blender/editors/sculpt_paint/paint_image_proj.c +++ b/source/blender/editors/sculpt_paint/paint_image_proj.c @@ -1131,7 +1131,8 @@ static bool check_seam(const ProjPaintState *ps, i1_fidx = BKE_MESH_TESSTRI_VINDEX_ORDER(lt_vtri, i1); i2_fidx = BKE_MESH_TESSTRI_VINDEX_ORDER(lt_vtri, i2); - /* Only need to check if 'i2_fidx' is valid because we know i1_fidx is the same vert on both faces */ + /* Only need to check if 'i2_fidx' is valid because + * we know i1_fidx is the same vert on both faces. */ if (i2_fidx != -1) { const float *lt_tri_uv[3] = {PS_LOOPTRI_AS_UV_3(ps->poly_to_loop_uv, lt)}; Image *tpage = project_paint_face_paint_image(ps, tri_index); @@ -1392,11 +1393,11 @@ static void insert_seam_vert_array(const ProjPaintState *ps, } } -/* - * Be tricky with flags, first 4 bits are PROJ_FACE_SEAM0 to 4, last 4 bits are PROJ_FACE_NOSEAM0 to 4 - * 1<<i - where i is (0-3) +/** + * Be tricky with flags, first 4 bits are #PROJ_FACE_SEAM0 to 4, + * last 4 bits are #PROJ_FACE_NOSEAM0 to 4. `1 << i` - where i is `(0..3)`. * - * If we're multithreadng, make sure threads are locked when this is called + * If we're multithreadng, make sure threads are locked when this is called. */ static void project_face_seams_init(const ProjPaintState *ps, MemArena *arena, @@ -1427,7 +1428,8 @@ static void project_face_seams_init(const ProjPaintState *ps, insert_seam_vert_array(ps, arena, tri_index, fidx[0], ibuf_x, ibuf_y); if (other_face != -1) { - /* Check if the other seam is already set. We don't want to insert it in the list twice. */ + /* Check if the other seam is already set. + * We don't want to insert it in the list twice. */ if ((ps->faceSeamFlags[other_face] & (PROJ_FACE_SEAM0 << other_fidx)) == 0) { ps->faceSeamFlags[other_face] |= PROJ_FACE_SEAM0 << other_fidx; insert_seam_vert_array(ps, arena, other_face, other_fidx, ibuf_x, ibuf_y); @@ -2205,17 +2207,21 @@ static float len_squared_v2v2_alt(const float v1[2], const float v2_1, const flo return x * x + y * y; } -/* note, use a squared value so we can use len_squared_v2v2 - * be sure that you have done a bounds check first or this may fail */ -/* only give bucket_bounds as an arg because we need it elsewhere */ +/** + * \note Use a squared value so we can use #len_squared_v2v2 + * be sure that you have done a bounds check first or this may fail. + * + * Only give \a bucket_bounds as an arg because we need it elsewhere. + */ static bool project_bucket_isect_circle(const float cent[2], const float radius_squared, const rctf *bucket_bounds) { - /* Would normally to a simple intersection test, however we know the bounds of these 2 already intersect - * so we only need to test if the center is inside the vertical or horizontal bounds on either axis, - * this is even less work then an intersection test + /* Would normally to a simple intersection test, + * however we know the bounds of these 2 already intersect so we only need to test + * if the center is inside the vertical or horizontal bounds on either axis, + * this is even less work then an intersection test. */ #if 0 if (BLI_rctf_isect_pt_v(bucket_bounds, cent)) @@ -3027,7 +3033,8 @@ static void project_paint_face_init(const ProjPaintState *ps, &uv_clip_tot, do_backfacecull || ps->do_occlude); - /* sometimes this happens, better just allow for 8 intersectiosn even though there should be max 6 */ + /* Sometimes this happens, better just allow for 8 intersections + * even though there should be max 6 */ #if 0 if (uv_clip_tot > 6) { printf("this should never happen! %d\n", uv_clip_tot); @@ -3132,7 +3139,12 @@ static void project_paint_face_init(const ProjPaintState *ps, (face_seam_flag & PROJ_FACE_SEAM_INIT2) == 0) { project_face_seams_init(ps, arena, tri_index, 0, true, ibuf->x, ibuf->y); face_seam_flag = ps->faceSeamFlags[tri_index]; - //printf("seams - %d %d %d %d\n", flag&PROJ_FACE_SEAM0, flag&PROJ_FACE_SEAM1, flag&PROJ_FACE_SEAM2); +# if 0 + printf("seams - %d %d %d %d\n", + flag & PROJ_FACE_SEAM0, + flag & PROJ_FACE_SEAM1, + flag & PROJ_FACE_SEAM2); +# endif } if ((face_seam_flag & (PROJ_FACE_SEAM0 | PROJ_FACE_SEAM1 | PROJ_FACE_SEAM2)) == 0) { diff --git a/source/blender/editors/sculpt_paint/paint_mask.c b/source/blender/editors/sculpt_paint/paint_mask.c index ca48030daed..4a4dbe364a0 100644 --- a/source/blender/editors/sculpt_paint/paint_mask.c +++ b/source/blender/editors/sculpt_paint/paint_mask.c @@ -354,9 +354,10 @@ typedef struct LassoMaskData { MaskTaskData task_data; } LassoMaskData; -/* Lasso select. This could be defined as part of VIEW3D_OT_select_lasso, still the shortcuts conflict, - * so we will use a separate operator */ - +/** + * Lasso select. This could be defined as part of #VIEW3D_OT_select_lasso, + * still the shortcuts conflict, so we will use a separate operator. + */ static bool is_effected_lasso(LassoMaskData *data, float co[3]) { float scr_co_f[2]; diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index 291320a520f..cc32d0a44f3 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -553,7 +553,8 @@ static void do_weight_paint_normalize_all_locked_try_active(MDeformVert *dvert, if (!success) { /** - * Locks prevented the first pass from full completion, so remove restriction on active group; e.g: + * Locks prevented the first pass from full completion, + * so remove restriction on active group; e.g: * * - With 1.0 weight painted into active: * nonzero locked weight; first pass zeroed out unlocked weight; scale 1 down to fit. @@ -845,15 +846,15 @@ static void do_weight_paint_vertex_single( dv_mirr, wpi->defbase_tot, wpi->vgroup_validmap, wpi->lock_flags, wpi->mirror.lock); } else { - /* this case accounts for... - * - painting onto a center vertex of a mesh - * - x mirror is enabled - * - auto normalize is enabled - * - the group you are painting onto has a L / R version + /* This case accounts for: + * - Painting onto a center vertex of a mesh. + * - X-mirror is enabled. + * - Auto normalize is enabled. + * - The group you are painting onto has a L / R version. * * We want L/R vgroups to have the same weight but this cant be if both are over 0.5, - * We _could_ have special check for that, but this would need its own normalize function which - * holds 2 groups from changing at once. + * We _could_ have special check for that, but this would need its own + * normalize function which holds 2 groups from changing at once. * * So! just balance out the 2 weights, it keeps them equal and everything normalized. * @@ -1289,7 +1290,8 @@ static int wpaint_mode_toggle_exec(bContext *C, wmOperator *op) BKE_paint_toolslots_brush_validate(bmain, &ts->wpaint->paint); } - /* When locked, it's almost impossible to select the pose then the object to enter weight paint mode. + /* When locked, it's almost impossible to select the pose + * then the object to enter weight paint mode. * In this case move our pose object in/out of pose mode. * This is in fits with the convention of selecting multiple objects and entering a mode. */ if (scene->toolsettings->object_flag & SCE_OBJECT_MODE_LOCK) { diff --git a/source/blender/editors/sculpt_paint/paint_vertex_color_ops.c b/source/blender/editors/sculpt_paint/paint_vertex_color_ops.c index ad7cfebb8d5..7df9ccc0e50 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex_color_ops.c +++ b/source/blender/editors/sculpt_paint/paint_vertex_color_ops.c @@ -151,7 +151,7 @@ static bool vertex_paint_from_weight(Object *ob) } /* TODO: respect selection. */ - /* TODO: Do we want to take weights from evaluated mesh instead? 2.7x was not doing it anyway... */ + /* TODO: Do we want to take weights from evaluated mesh instead? 2.7x was not doing it anyway. */ mp = me->mpoly; vgroup_active = ob->actdef - 1; for (int i = 0; i < me->totpoly; i++, mp++) { diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 6882b249f0d..9ac44c5114d 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -422,9 +422,10 @@ static void paint_mesh_restore_co(Sculpt *sd, Object *ob) BKE_pbvh_search_gather(ss->pbvh, NULL, NULL, &nodes, &totnode); - /* Disable OpenMP when dynamic-topology is enabled. Otherwise, new entries might be inserted by - * sculpt_undo_push_node() into the GHash used internally by BM_log_original_vert_co() by a different thread. - * See T33787. */ + /** + * Disable OpenMP when dynamic-topology is enabled. Otherwise, new entries might be inserted by + * #sculpt_undo_push_node() into the GHash used internally by #BM_log_original_vert_co() + * by a different thread. See T33787. */ SculptThreadedTaskData data = { .sd = sd, .ob = ob, @@ -2357,7 +2358,8 @@ static void do_crease_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnod mul_v3_v3(offset, ss->cache->scale); mul_v3_fl(offset, bstrength); - /* we divide out the squared alpha and multiply by the squared crease to give us the pinch strength */ + /* We divide out the squared alpha and multiply by the squared crease + * to give us the pinch strength. */ crease_correction = brush->crease_pinch_factor * brush->crease_pinch_factor; brush_alpha = BKE_brush_alpha_get(scene, brush); if (brush_alpha > 0.0f) @@ -2370,7 +2372,8 @@ static void do_crease_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnod if (brush->sculpt_tool == SCULPT_TOOL_BLOB) flippedbstrength *= -1.0f; - /* Use surface normal for 'spvc', so the vertices are pinched towards a line instead of a single point. + /* Use surface normal for 'spvc', + * so the vertices are pinched towards a line instead of a single point. * Without this we get a 'flat' surface surrounding the pinch */ sculpt_project_v3_cache_init(&spvc, ss->cache->sculpt_normal_symm); @@ -4271,7 +4274,8 @@ static void do_symmetrical_brush_actions(Sculpt *sd, cache->bstrength = brush_strength(sd, cache, feather, ups); cache->symmetry = symm; - /* symm is a bit combination of XYZ - 1 is mirror X; 2 is Y; 3 is XY; 4 is Z; 5 is XZ; 6 is YZ; 7 is XYZ */ + /* symm is a bit combination of XYZ - + * 1 is mirror X; 2 is Y; 3 is XY; 4 is Z; 5 is XZ; 6 is YZ; 7 is XYZ */ for (i = 0; i <= symm; ++i) { if (i == 0 || (symm & i && (symm != 5 || i != 3) && (symm != 6 || (i != 3 && i != 5)))) { cache->mirror_symmetry_pass = i; @@ -5381,8 +5385,8 @@ static void sculpt_brush_stroke_cancel(bContext *C, wmOperator *op) Sculpt *sd = CTX_data_tool_settings(C)->sculpt; const Brush *brush = BKE_paint_brush(&sd->paint); - /* XXX Canceling strokes that way does not work with dynamic topology, user will have to do real undo for now. - * See T46456. */ + /* XXX Canceling strokes that way does not work with dynamic topology, + * user will have to do real undo for now. See T46456. */ if (ss->cache && !sculpt_stroke_is_dynamic_topology(ss, brush)) { paint_mesh_restore_co(sd, ob); } diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.h b/source/blender/editors/sculpt_paint/sculpt_intern.h index 97f2ca1a143..be4ab5809e4 100644 --- a/source/blender/editors/sculpt_paint/sculpt_intern.h +++ b/source/blender/editors/sculpt_paint/sculpt_intern.h @@ -147,8 +147,10 @@ typedef struct SculptThreadedTaskData { void *custom_data; /* Data specific to some callbacks. */ - /* Note: even if only one or two of those are used at a time, keeping them separated, names help figuring out - * what it is, and memory overhead is ridiculous anyway... */ + + /* Note: even if only one or two of those are used at a time, + * keeping them separated, names help figuring out + * what it is, and memory overhead is ridiculous anyway. */ float flippedbstrength; float angle; float strength; diff --git a/source/blender/editors/sculpt_paint/sculpt_uv.c b/source/blender/editors/sculpt_paint/sculpt_uv.c index 39ada703b9b..826db204fd0 100644 --- a/source/blender/editors/sculpt_paint/sculpt_uv.c +++ b/source/blender/editors/sculpt_paint/sculpt_uv.c @@ -306,8 +306,9 @@ static void HC_relaxation_iteration_uv(BMEditMesh *em, for (i = 0; i < sculptdata->totalUniqueUvs; i++) { float dist; - /* This is supposed to happen only if "Pin Edges" is on, since we have initialization on stroke start - * If ever uv brushes get their own mode we should check for toolsettings option too */ + /* This is supposed to happen only if "Pin Edges" is on, + * since we have initialization on stroke start. + * If ever uv brushes get their own mode we should check for toolsettings option too. */ if ((sculptdata->uv[i].flag & MARK_BOUNDARY)) { continue; } @@ -375,8 +376,8 @@ static void laplacian_relaxation_iteration_uv(BMEditMesh *em, add_v2_v2(tmp_uvdata[tmpedge->uv1].sum_co, sculptdata->uv[tmpedge->uv2].uv); } - /* Original Lacplacian algorithm included removal of normal component of translation. here it is not - * needed since we translate along the UV plane always.*/ + /* Original Lacplacian algorithm included removal of normal component of translation. + * here it is not needed since we translate along the UV plane always. */ for (i = 0; i < sculptdata->totalUniqueUvs; i++) { copy_v2_v2(tmp_uvdata[i].p, tmp_uvdata[i].sum_co); mul_v2_fl(tmp_uvdata[i].p, 1.f / tmp_uvdata[i].ncounter); @@ -384,8 +385,9 @@ static void laplacian_relaxation_iteration_uv(BMEditMesh *em, for (i = 0; i < sculptdata->totalUniqueUvs; i++) { float dist; - /* This is supposed to happen only if "Pin Edges" is on, since we have initialization on stroke start - * If ever uv brushes get their own mode we should check for toolsettings option too */ + /* This is supposed to happen only if "Pin Edges" is on, + * since we have initialization on stroke start. + * If ever uv brushes get their own mode we should check for toolsettings option too. */ if ((sculptdata->uv[i].flag & MARK_BOUNDARY)) { continue; } @@ -463,8 +465,9 @@ static void uv_sculpt_stroke_apply(bContext *C, alpha *= invert; for (i = 0; i < sculptdata->totalUniqueUvs; i++) { float dist, diff[2]; - /* This is supposed to happen only if "Lock Borders" is on, since we have initialization on stroke start - * If ever uv brushes get their own mode we should check for toolsettings option too */ + /* This is supposed to happen only if "Lock Borders" is on, + * since we have initialization on stroke start. + * If ever uv brushes get their own mode we should check for toolsettings option too. */ if (sculptdata->uv[i].flag & MARK_BOUNDARY) { continue; } |