diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-05-01 00:40:07 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-05-01 01:04:52 +0300 |
commit | 910b88674763899c189b694aa306e03055fe33bf (patch) | |
tree | ee48bb6e4789d19ecd7dd1d66aa65d75b2e17e83 /source | |
parent | 163fb251b901f13940d6350d36e9fa46a2fbd73d (diff) |
Cleanup: comments (long lines) in modifiers
Also remove duplicate comments in headers.
Diffstat (limited to 'source')
22 files changed, 133 insertions, 105 deletions
diff --git a/source/blender/modifiers/intern/MOD_armature.c b/source/blender/modifiers/intern/MOD_armature.c index 31a1f5207c6..72215659915 100644 --- a/source/blender/modifiers/intern/MOD_armature.c +++ b/source/blender/modifiers/intern/MOD_armature.c @@ -93,7 +93,8 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte { ArmatureModifierData *amd = (ArmatureModifierData *)md; if (amd->object != NULL) { - /* If not using envelopes, create relations to individual bones for more rigging flexibility. */ + /* If not using envelopes, + * create relations to individual bones for more rigging flexibility. */ if ((amd->deformflag & ARM_DEF_ENVELOPE) == 0 && (amd->object->pose != NULL) && ELEM(ctx->object->type, OB_MESH, OB_LATTICE, OB_GPENCIL)) { /* If neither vertex groups nor envelopes are used, the modifier has no bone dependencies. */ diff --git a/source/blender/modifiers/intern/MOD_array.c b/source/blender/modifiers/intern/MOD_array.c index 3443d275c81..fd6f58a21d4 100644 --- a/source/blender/modifiers/intern/MOD_array.c +++ b/source/blender/modifiers/intern/MOD_array.c @@ -148,7 +148,8 @@ static void svert_from_mvert(SortVertsElem *sv, /** * Take as inputs two sets of verts, to be processed for detection of doubles and mapping. * Each set of verts is defined by its start within mverts array and its num_verts; - * It builds a mapping for all vertices within source, to vertices within target, or -1 if no double found + * It builds a mapping for all vertices within source, + * to vertices within target, or -1 if no double found. * The int doubles_map[num_verts_source] array must have been allocated by caller. */ static void dm_mvert_map_doubles(int *doubles_map, @@ -220,11 +221,13 @@ static void dm_mvert_map_doubles(int *doubles_map, target_scan_completed = true; continue; } - /* Test target candidates starting at the low bound of possible doubles, ordered in terms of sumco */ + /* Test target candidates starting at the low bound of possible doubles, + * ordered in terms of sumco. */ i_target = i_target_low_bound; sve_target = sve_target_low_bound; - /* i_target will scan vertices in the [v_source_sumco - dist3; v_source_sumco + dist3] range */ + /* i_target will scan vertices in the + * [v_source_sumco - dist3; v_source_sumco + dist3] range */ while ((i_target < target_num_verts) && (sve_target->sum_co <= sve_source_sumco + dist3)) { /* Testing distance for candidate double in target */ @@ -237,8 +240,9 @@ static void dm_mvert_map_doubles(int *doubles_map, /* If target is already mapped, we only follow that mapping if final target remains * close enough from current vert (otherwise no mapping at all). - * Note that if we later find another target closer than this one, then we check it. But if other - * potential targets are farther, then there will be no mapping at all for this source. */ + * Note that if we later find another target closer than this one, then we check it. + * But if other potential targets are farther, + * then there will be no mapping at all for this source. */ while (best_target_vertex != -1 && !ELEM(doubles_map[best_target_vertex], -1, best_target_vertex)) { if (compare_len_v3v3(mverts[sve_source->vertex_num].co, @@ -720,7 +724,8 @@ static Mesh *arrayModifier_doArray(ArrayModifierData *amd, for (i = 0; i < result_nverts; i++) { int new_i = full_doubles_map[i]; if (new_i != -1) { - /* We have to follow chains of doubles (merge start/end especially is likely to create some), + /* We have to follow chains of doubles + * (merge start/end especially is likely to create some), * those are not supported at all by BKE_mesh_merge_verts! */ while (!ELEM(full_doubles_map[new_i], -1, new_i)) { new_i = full_doubles_map[new_i]; diff --git a/source/blender/modifiers/intern/MOD_bevel.c b/source/blender/modifiers/intern/MOD_bevel.c index 02d3bd305be..26b45bbef0d 100644 --- a/source/blender/modifiers/intern/MOD_bevel.c +++ b/source/blender/modifiers/intern/MOD_bevel.c @@ -110,19 +110,19 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes const int miter_inner = bmd->miter_inner; const float spread = bmd->spread; - bm = BKE_mesh_to_bmesh_ex( - mesh, - &(struct BMeshCreateParams){0}, - &(struct BMeshFromMeshParams){ - .calc_face_normal = true, - .add_key_index = false, - .use_shapekey = false, - .active_shapekey = 0, - /* XXX We probably can use CD_MASK_BAREMESH_ORIGDINDEX here instead (also for other modifiers cases)? */ - .cd_mask_extra = {.vmask = CD_MASK_ORIGINDEX, - .emask = CD_MASK_ORIGINDEX, - .pmask = CD_MASK_ORIGINDEX}, - }); + bm = BKE_mesh_to_bmesh_ex(mesh, + &(struct BMeshCreateParams){0}, + &(struct BMeshFromMeshParams){ + .calc_face_normal = true, + .add_key_index = false, + .use_shapekey = false, + .active_shapekey = 0, + /* XXX We probably can use CD_MASK_BAREMESH_ORIGDINDEX here instead + * (also for other modifiers cases)? */ + .cd_mask_extra = {.vmask = CD_MASK_ORIGINDEX, + .emask = CD_MASK_ORIGINDEX, + .pmask = CD_MASK_ORIGINDEX}, + }); if ((bmd->lim_flags & MOD_BEVEL_VGROUP) && bmd->defgrp_name[0]) { MOD_get_vgroup(ctx->object, mesh, bmd->defgrp_name, &dvert, &vgroup); diff --git a/source/blender/modifiers/intern/MOD_correctivesmooth.c b/source/blender/modifiers/intern/MOD_correctivesmooth.c index 2a332bc9709..705ffb266c5 100644 --- a/source/blender/modifiers/intern/MOD_correctivesmooth.c +++ b/source/blender/modifiers/intern/MOD_correctivesmooth.c @@ -307,7 +307,8 @@ static void smooth_iter__length_weight(CorrectiveSmoothModifierData *csmd, /* fast-path */ for (i = 0; i < numVerts; i++) { struct SmoothingData_Weighted *sd = &smooth_data[i]; - /* divide by sum of all neighbour distances (weighted) and amount of neighbors, (mean average) */ + /* Divide by sum of all neighbour distances (weighted) and amount of neighbors, + * (mean average). */ const float div = sd->edge_length_sum * vertex_edge_count[i]; if (div > eps) { #if 0 diff --git a/source/blender/modifiers/intern/MOD_datatransfer.c b/source/blender/modifiers/intern/MOD_datatransfer.c index 4de99ea6fe6..3235d64cbbb 100644 --- a/source/blender/modifiers/intern/MOD_datatransfer.c +++ b/source/blender/modifiers/intern/MOD_datatransfer.c @@ -179,8 +179,8 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes if (((result == me) || (me->mvert == result->mvert) || (me->medge == result->medge)) && (dtmd->data_types & DT_TYPES_AFFECT_MESH)) { - /* We need to duplicate data here, otherwise setting custom normals, edges' shaprness, etc., could - * modify org mesh, see T43671. */ + /* We need to duplicate data here, otherwise setting custom normals, edges' shaprness, etc., + * could modify org mesh, see T43671. */ BKE_id_copy_ex(NULL, &me_mod->id, (ID **)&result, LIB_ID_COPY_LOCALIZE); } diff --git a/source/blender/modifiers/intern/MOD_dynamicpaint.c b/source/blender/modifiers/intern/MOD_dynamicpaint.c index ccd71455b21..ce488a224aa 100644 --- a/source/blender/modifiers/intern/MOD_dynamicpaint.c +++ b/source/blender/modifiers/intern/MOD_dynamicpaint.c @@ -129,7 +129,8 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte ctx->node, ctx->object, surface->effector_weights, true, 0, "Dynamic Paint Field"); } - /* Actual code uses custom loop over group/scene without layer checks in dynamicPaint_doStep */ + /* Actual code uses custom loop over group/scene + * without layer checks in dynamicPaint_doStep. */ DEG_add_collision_relations(ctx->node, ctx->object, surface->brush_group, @@ -167,7 +168,7 @@ static void foreachTexLink(ModifierData *UNUSED(md), TexWalkFunc UNUSED(walk), void *UNUSED(userData)) { - //walk(userData, ob, md, ""); /* re-enable when possible */ + // walk(userData, ob, md, ""); /* re-enable when possible */ } ModifierTypeInfo modifierType_DynamicPaint = { diff --git a/source/blender/modifiers/intern/MOD_explode.c b/source/blender/modifiers/intern/MOD_explode.c index 7d87ba240d5..4ed787810a8 100644 --- a/source/blender/modifiers/intern/MOD_explode.c +++ b/source/blender/modifiers/intern/MOD_explode.c @@ -743,7 +743,7 @@ static Mesh *cutEdges(ExplodeModifierData *emd, Mesh *mesh) * have to stop using tessface - campbell */ facepa = MEM_calloc_arrayN((totface + (totfsplit * 2)), sizeof(int), "explode_facepa"); - //memcpy(facepa, emd->facepa, totface*sizeof(int)); + // memcpy(facepa, emd->facepa, totface*sizeof(int)); emd->facepa = facepa; /* create new verts */ @@ -766,7 +766,7 @@ static Mesh *cutEdges(ExplodeModifierData *emd, Mesh *mesh) /* create new faces */ curdupface = 0; //=totface; - //curdupin=totesplit; + // curdupin=totesplit; for (i = 0, fs = facesplit; i < totface; i++, fs++) { mf = &mesh->mface[i]; diff --git a/source/blender/modifiers/intern/MOD_fluidsim_util.c b/source/blender/modifiers/intern/MOD_fluidsim_util.c index 3744c527983..0776806f541 100644 --- a/source/blender/modifiers/intern/MOD_fluidsim_util.c +++ b/source/blender/modifiers/intern/MOD_fluidsim_util.c @@ -435,8 +435,10 @@ static Mesh *fluidsim_read_cache( Object *ob, Mesh *orgmesh, FluidsimModifierData *fluidmd, int framenr, int useRenderParams) { int curFrame = framenr /* - 1 */ /*scene->r.sfra*/; /* start with 0 at start frame */ - /* why start with 0 as start frame?? Animations + time are frozen for frame 0 anyway. (See physics_fluid.c for that. - DG */ - /* If we start with frame 0, we need to remap all animation channels, too, because they will all be 1 frame late if using frame-1! - DG */ + /* why start with 0 as start frame?? Animations + time are frozen for frame 0 anyway. + * (See physics_fluid.c for that. - DG) */ + /* If we start with frame 0, we need to remap all animation channels, too, + * because they will all be 1 frame late if using frame-1! - DG */ char targetFile[FILE_MAX]; FluidsimSettings *fss = fluidmd->fss; diff --git a/source/blender/modifiers/intern/MOD_laplaciandeform.c b/source/blender/modifiers/intern/MOD_laplaciandeform.c index 71636463f70..e27d2786751 100644 --- a/source/blender/modifiers/intern/MOD_laplaciandeform.c +++ b/source/blender/modifiers/intern/MOD_laplaciandeform.c @@ -214,7 +214,8 @@ static void createVertRingMap(const int mvert_tot, } /** - * This method computes the Laplacian Matrix and Differential Coordinates for all vertex in the mesh. + * This method computes the Laplacian Matrix and Differential Coordinates + * for all vertex in the mesh.. * The Linear system is LV = d * Where L is Laplacian Matrix, V as the vertices in Mesh, d is the differential coordinates * The Laplacian Matrix is computes as a @@ -227,18 +228,21 @@ static void createVertRingMap(const int mvert_tot, * Where : * di is the Differential Coordinate i * sum (Wij) is the sum of all weights between vertex Vi and its vertices neighbors (Vj) - * sum (Wij * Vj) is the sum of the product between vertex neighbor Vj and weight Wij for all neighborhood. + * sum (Wij * Vj) is the sum of the product between vertex neighbor Vj and weight Wij + * for all neighborhood. * * This Laplacian Matrix is described in the paper: - * Desbrun M. et.al, Implicit fairing of irregular meshes using diffusion and curvature flow, SIGGRAPH '99, pag 317-324, - * New York, USA + * Desbrun M. et.al, Implicit fairing of irregular meshes using diffusion and curvature flow, + * SIGGRAPH '99, pag 317-324, New York, USA * - * The computation of Laplace Beltrami operator on Hybrid Triangle/Quad Meshes is described in the paper: - * Pinzon A., Romero E., Shape Inflation With an Adapted Laplacian Operator For Hybrid Quad/Triangle Meshes, + * The computation of Laplace Beltrami operator on Hybrid Triangle/Quad Meshes is described in the + * paper: Pinzon A., Romero E., Shape Inflation With an Adapted Laplacian Operator For + * Hybrid Quad/Triangle Meshes, * Conference on Graphics Patterns and Images, SIBGRAPI, 2013 * * The computation of Differential Coordinates is described in the paper: - * Sorkine, O. Laplacian Surface Editing. Proceedings of the EUROGRAPHICS/ACM SIGGRAPH Symposium on Geometry Processing, + * Sorkine, O. Laplacian Surface Editing. + * Proceedings of the EUROGRAPHICS/ACM SIGGRAPH Symposium on Geometry Processing, * 2004. p. 179-188. */ static void initLaplacianMatrix(LaplacianSystem *sys) diff --git a/source/blender/modifiers/intern/MOD_mask.c b/source/blender/modifiers/intern/MOD_mask.c index a13e75c76de..3417aaeeb5c 100644 --- a/source/blender/modifiers/intern/MOD_mask.c +++ b/source/blender/modifiers/intern/MOD_mask.c @@ -105,9 +105,10 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes } /* Overview of Method: - * 1. Get the vertices that are in the vertexgroup of interest - * 2. Filter out unwanted geometry (i.e. not in vertexgroup), by populating mappings with new vs old indices - * 3. Make a new mesh containing only the mapping data + * 1. Get the vertices that are in the vertexgroup of interest. + * 2. Filter out unwanted geometry (i.e. not in vertexgroup), + * by populating mappings with new vs old indices. + * 3. Make a new mesh containing only the mapping data. */ /* get original number of verts, edges, and faces */ @@ -137,9 +138,10 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes return mesh; } - /* determine whether each vertexgroup is associated with a selected bone or not - * - each cell is a boolean saying whether bone corresponding to the ith group is selected - * - groups that don't match a bone are treated as not existing (along with the corresponding ungrouped verts) + /* Determine whether each vertexgroup is associated with a selected bone or not: + * - Each cell is a boolean saying whether bone corresponding to the ith group is selected. + * - Groups that don't match a bone are treated as not existing + * (along with the corresponding ungrouped verts). */ bone_select_array = MEM_malloc_arrayN((size_t)defbase_tot, sizeof(char), "mask array"); @@ -154,7 +156,8 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes } } - /* verthash gives mapping from original vertex indices to the new indices (including selected matches only) + /* verthash gives mapping from original vertex indices to the new indices + * (including selected matches only): * key = oldindex, value = newindex */ vertHash = BLI_ghash_int_new_ex("mask vert gh", (unsigned int)maxVerts); diff --git a/source/blender/modifiers/intern/MOD_normal_edit.c b/source/blender/modifiers/intern/MOD_normal_edit.c index 5c1f0435270..10852ed6148 100644 --- a/source/blender/modifiers/intern/MOD_normal_edit.c +++ b/source/blender/modifiers/intern/MOD_normal_edit.c @@ -62,13 +62,15 @@ static void generate_vert_coordinates(Mesh *mesh, } } - /* Get size (i.e. deformation of the spheroid generating normals), either from target object, or own geometry. */ + /* Get size (i.e. deformation of the spheroid generating normals), + * either from target object, or own geometry. */ if (r_size != NULL) { if (ob_center != NULL) { /* Using 'scale' as 'size' here. The input object is typically an empty * who's scale is used to define an ellipsoid instead of a simple sphere. */ - /* Not we are not interested in signs here - they are even troublesome actually, due to security clamping! */ + /* Not we are not interested in signs here - they are even troublesome actually, + * due to security clamping! */ abs_v3_v3(r_size, ob_center->scale); } else { @@ -247,7 +249,8 @@ static void normalEditModifier_do_radial(NormalEditModifierData *enmd, * Then, we want to find out for each vert its (a, b, c) triple (proportional to (A, B, C) one). * * Ellipsoid basic equation: ``(x^2/a^2) + (y^2/b^2) + (z^2/c^2) = 1.`` - * Since we want to find (a, b, c) matching this equation and proportional to (A, B, C), we can do: + * Since we want to find (a, b, c) matching this equation and proportional to (A, B, C), + * we can do: * <pre> * m = B / A * n = C / A @@ -480,9 +483,11 @@ static Mesh *normalEditModifier_do(NormalEditModifierData *enmd, return mesh; } - /* XXX TODO ARG GRRR XYQWNMPRXTYY - * Once we fully switch to Mesh evaluation of modifiers, we can expect to get that flag from the COW copy. - * But for now, it is lost in the DM intermediate step, so we need to directly check orig object's data. */ + /* XXX TODO(Rohan Rathi): + * Once we fully switch to Mesh evaluation of modifiers, + * we can expect to get that flag from the COW copy. + * But for now, it is lost in the DM intermediate step, + * so we need to directly check orig object's data. */ #if 0 if (!(mesh->flag & ME_AUTOSMOOTH)) #else @@ -495,7 +500,8 @@ static Mesh *normalEditModifier_do(NormalEditModifierData *enmd, Mesh *result; if (mesh->medge == ((Mesh *)ob->data)->medge) { - /* We need to duplicate data here, otherwise setting custom normals (which may also affect sharp edges) could + /* We need to duplicate data here, otherwise setting custom normals + * (which may also affect sharp edges) could * modify org mesh, see T43671. */ BKE_id_copy_ex(NULL, &mesh->id, (ID **)&result, LIB_ID_COPY_LOCALIZE); } diff --git a/source/blender/modifiers/intern/MOD_ocean.c b/source/blender/modifiers/intern/MOD_ocean.c index 1ca25cbb068..cd0046b8a31 100644 --- a/source/blender/modifiers/intern/MOD_ocean.c +++ b/source/blender/modifiers/intern/MOD_ocean.c @@ -434,7 +434,8 @@ static Mesh *doOcean(ModifierData *md, const ModifierEvalContext *ctx, Mesh *mes /* displace the geometry */ - /* Note: tried to parallelized that one and previous foam loop, but gives 20% slower results... odd. */ + /* Note: tried to parallelized that one and previous foam loop, + * but gives 20% slower results... odd. */ { const int num_verts = result->totvert; diff --git a/source/blender/modifiers/intern/MOD_screw.c b/source/blender/modifiers/intern/MOD_screw.c index bfd1858df09..dd894e86dcc 100644 --- a/source/blender/modifiers/intern/MOD_screw.c +++ b/source/blender/modifiers/intern/MOD_screw.c @@ -345,8 +345,9 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes /* multiplying the steps is a bit tricky, this works best */ step_tot = ((step_tot + 1) * ltmd->iter) - (ltmd->iter - 1); - /* will the screw be closed? - * Note! smaller then FLT_EPSILON * 100 gives problems with float precision so its never closed. */ + /* Will the screw be closed? + * Note! smaller then `FLT_EPSILON * 100` + * gives problems with float precision so its never closed. */ if (fabsf(screw_ofs) <= (FLT_EPSILON * 100.0f) && fabsf(fabsf(angle) - ((float)M_PI * 2.0f)) <= (FLT_EPSILON * 100.0f)) { close = 1; @@ -493,7 +494,8 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes */ vert_connect = MEM_malloc_arrayN(totvert, sizeof(ScrewVertConnect), "ScrewVertConnect"); - //vert_connect = (ScrewVertConnect *) &medge_new[totvert]; /* skip the first slice of verts */ + /* skip the first slice of verts. */ + // vert_connect = (ScrewVertConnect *) &medge_new[totvert]; vc = vert_connect; /* Copy Vert Locations */ @@ -605,7 +607,7 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes /*printf("\t\tVERT: %i\n", lt_iter.v);*/ if (lt_iter.v_poin->flag) { /*printf("\t\t\tBreaking Found end\n");*/ - //endpoints[0] = endpoints[1] = SV_UNUSED; + // endpoints[0] = endpoints[1] = SV_UNUSED; ed_loop_closed = 1; /* circle */ break; } diff --git a/source/blender/modifiers/intern/MOD_skin.c b/source/blender/modifiers/intern/MOD_skin.c index 7ddde7236c0..a344141bf4a 100644 --- a/source/blender/modifiers/intern/MOD_skin.c +++ b/source/blender/modifiers/intern/MOD_skin.c @@ -1216,7 +1216,7 @@ static BMFace *skin_hole_target_face(BMesh *bm, Frame *frame) } /* This case is unlikely now, but could still happen. Should look - * into splitting edges to make new faces. */ + * into splitting edges to make new faces. */ #if PRINT_HOLE_INFO if (!f) { printf("no good face found\n"); diff --git a/source/blender/modifiers/intern/MOD_solidify.c b/source/blender/modifiers/intern/MOD_solidify.c index 78006147ab5..88135b8790b 100644 --- a/source/blender/modifiers/intern/MOD_solidify.c +++ b/source/blender/modifiers/intern/MOD_solidify.c @@ -380,7 +380,8 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes /* DO NOT copy here the 'copied' part of loop data, we want to reverse loops * (so that winding of copied face get reversed, so that normals get reversed * and point in expected direction...). - * If we also copy data here, then this data get overwritten (and allocated memory becomes memleak). */ + * If we also copy data here, then this data get overwritten + * (and allocated memory becomes memleak). */ CustomData_copy_data(&mesh->pdata, &result->pdata, 0, 0, (int)numPolys); CustomData_copy_data(&mesh->pdata, &result->pdata, 0, (int)numPolys, (int)numPolys); diff --git a/source/blender/modifiers/intern/MOD_surfacedeform.c b/source/blender/modifiers/intern/MOD_surfacedeform.c index 2a9fff47e5d..47c0114f02f 100644 --- a/source/blender/modifiers/intern/MOD_surfacedeform.c +++ b/source/blender/modifiers/intern/MOD_surfacedeform.c @@ -441,7 +441,8 @@ BLI_INLINE SDefBindWeightData *computeBindWeights(SDefBindCalcData *const data, bwdata->bind_polys = bpoly; - /* Loop over all adjacent edges, and build the SDefBindPoly data for each poly adjacent to those */ + /* Loop over all adjacent edges, + * and build the SDefBindPoly data for each poly adjacent to those. */ for (vedge = vert_edges; vedge; vedge = vedge->next) { unsigned int edge_ind = vedge->index; @@ -860,7 +861,8 @@ static void bindVert(void *__restrict userdata, interp_weights_poly_v2( sdbind->vert_weights, bpoly->coords_v2, bpoly->numverts, bpoly->point_v2); - /* Reproject vert based on weights and original poly verts, to reintroduce poly non-planarity */ + /* Reproject vert based on weights and original poly verts, + * to reintroduce poly non-planarity */ zero_v3(point_co_proj); for (int j = 0; j < bpoly->numverts; j++, loop++) { madd_v3_v3fl(point_co_proj, bpoly->coords[j], sdbind->vert_weights[j]); diff --git a/source/blender/modifiers/intern/MOD_triangulate.c b/source/blender/modifiers/intern/MOD_triangulate.c index 7d890b29365..1582c27960e 100644 --- a/source/blender/modifiers/intern/MOD_triangulate.c +++ b/source/blender/modifiers/intern/MOD_triangulate.c @@ -133,7 +133,7 @@ ModifierTypeInfo modifierType_Triangulate = { /* applyModifier */ applyModifier, /* initData */ initData, - /* requiredDataMask */ NULL, //requiredDataMask, + /* requiredDataMask */ NULL, // requiredDataMask, /* freeData */ NULL, /* isDisabled */ NULL, /* updateDepsgraph */ NULL, diff --git a/source/blender/modifiers/intern/MOD_util.c b/source/blender/modifiers/intern/MOD_util.c index 69cf8a651eb..1efc1aefae4 100644 --- a/source/blender/modifiers/intern/MOD_util.c +++ b/source/blender/modifiers/intern/MOD_util.c @@ -208,11 +208,13 @@ Mesh *MOD_deform_mesh_eval_get(Object *ob, } } else if (ELEM(ob->type, OB_FONT, OB_CURVE, OB_SURF)) { - /* TODO(sybren): get evaluated mesh from depsgraph once that's properly generated for curves. */ + /* TODO(sybren): get evaluated mesh from depsgraph once + * that's properly generated for curves. */ mesh = BKE_mesh_new_nomain_from_curve(ob); /* Currently, that may not be the case everytime - * (texts e.g. tend to give issues, also when deforming curve points instead of generated curve geometry... ). */ + * (texts e.g. tend to give issues, + * also when deforming curve points instead of generated curve geometry... ). */ if (mesh != NULL && mesh->totvert != num_verts) { BKE_id_free(NULL, mesh); mesh = NULL; diff --git a/source/blender/modifiers/intern/MOD_weighted_normal.c b/source/blender/modifiers/intern/MOD_weighted_normal.c index 8f464be8e06..7fbaa24b579 100644 --- a/source/blender/modifiers/intern/MOD_weighted_normal.c +++ b/source/blender/modifiers/intern/MOD_weighted_normal.c @@ -51,7 +51,8 @@ static int modepair_cmp_by_val_inverse(const void *p1, const void *p2) return (r1->val < r2->val) ? 1 : ((r1->val > r2->val) ? -1 : 0); } -/* There will be one of those per vertex (simple case, computing one normal per vertex), or per smooth fan. */ +/* There will be one of those per vertex + * (simple case, computing one normal per vertex), or per smooth fan. */ typedef struct WeightedNormalDataAggregateItem { float normal[3]; @@ -97,8 +98,10 @@ typedef struct WeightedNormalData { int *loop_to_poly; } WeightedNormalData; -/* Check strength of given poly compared to those found so far for that given item (vertex or smooth fan), - * and reset matching item_data in case we get a stronger new strength. */ +/** + * Check strength of given poly compared to those found so far for that given item + * (vertex or smooth fan), and reset matching item_data in case we get a stronger new strength. + */ static bool check_item_poly_strength(WeightedNormalData *wn_data, WeightedNormalDataAggregateItem *item_data, const int mp_index) @@ -158,7 +161,8 @@ static void aggregate_item_normal(WeightedNormalModifierData *wnmd, item_data->curr_val = curr_val; } - /* Exponentially divided weight for each normal (since a few values will be used by most cases, we cache those). */ + /* Exponentially divided weight for each normal + * (since a few values will be used by most cases, we cache those). */ const int num_loops = item_data->num_loops; if (num_loops < NUM_CACHED_INVERSE_POWERS_OF_WEIGHT && cached_inverse_powers_of_weight[num_loops] == 0.0f) { @@ -211,7 +215,8 @@ static void apply_weights_vertex_normal(WeightedNormalModifierData *wnmd, if (keep_sharp) { BLI_bitmap *done_loops = BLI_BITMAP_NEW(numLoops, __func__); - /* This will give us loop normal spaces, we do not actually care about computed loop_normals for now... */ + /* This will give us loop normal spaces, + * we do not actually care about computed loop_normals for now... */ loop_normals = MEM_calloc_arrayN((size_t)numLoops, sizeof(*loop_normals), __func__); BKE_mesh_normals_loop_split(mvert, numVerts, @@ -329,8 +334,9 @@ static void apply_weights_vertex_normal(WeightedNormalModifierData *wnmd, if (keep_sharp) { /* Set loop normals for normal computed for each lnor space (smooth fan). - * Note that loop_normals is already populated with clnors (before this modifier is applied, at start of - * this function), so no need to recompute them here. */ + * Note that loop_normals is already populated with clnors + * (before this modifier is applied, at start of this function), + * so no need to recompute them here. */ for (int ml_index = 0; ml_index < numLoops; ml_index++) { WeightedNormalDataAggregateItem *item_data = lnors_spacearr.lspacearr[ml_index]->user_data; if (!is_zero_v3(item_data->normal)) { @@ -351,12 +357,14 @@ static void apply_weights_vertex_normal(WeightedNormalModifierData *wnmd, clnors); } else { - /* TODO: Ideally, we could add an option to BKE_mesh_normals_loop_custom_[from_vertices_]set() to keep current - * clnors instead of resetting them to default autocomputed ones, when given new custom normal is zero-vec. + /* TODO: Ideally, we could add an option to BKE_mesh_normals_loop_custom_[from_vertices_]set() + * to keep current clnors instead of resetting them to default autocomputed ones, + * when given new custom normal is zero-vec. * But this is not exactly trivial change, better to keep this optimization for later... */ if (!has_vgroup) { - /* Note: in theory, we could avoid this extra allocation & copying... But think we can live with it for now, + /* Note: in theory, we could avoid this extra allocation & copying... + * But think we can live with it for now, * and it makes code simpler & cleaner. */ float(*vert_normals)[3] = MEM_calloc_arrayN( (size_t)numVerts, sizeof(*loop_normals), __func__); @@ -540,9 +548,11 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes WeightedNormalModifierData *wnmd = (WeightedNormalModifierData *)md; Object *ob = ctx->object; - /* XXX TODO ARG GRRR XYQWNMPRXTYY - * Once we fully switch to Mesh evaluation of modifiers, we can expect to get that flag from the COW copy. - * But for now, it is lost in the DM intermediate step, so we need to directly check orig object's data. */ + /* XXX TODO(Rohan Rathi): + * Once we fully switch to Mesh evaluation of modifiers, + * we can expect to get that flag from the COW copy. + * But for now, it is lost in the DM intermediate step, + * so we need to directly check orig object's data. */ #if 0 if (!(mesh->flag & ME_AUTOSMOOTH)) #else @@ -567,11 +577,11 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes MLoop *mloop = result->mloop; /* Right now: - * If weight = 50 then all faces are given equal weight. - * If weight > 50 then more weight given to faces with larger vals (face area / corner angle). - * If weight < 50 then more weight given to faces with lesser vals. However current calculation - * does not converge to min/max. - */ + * If weight = 50 then all faces are given equal weight. + * If weight > 50 then more weight given to faces with larger vals (face area / corner angle). + * If weight < 50 then more weight given to faces with lesser vals. However current calculation + * does not converge to min/max. + */ float weight = ((float)wnmd->weight) / 50.0f; if (wnmd->weight == 100) { weight = (float)SHRT_MAX; @@ -597,7 +607,8 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes CustomData *ldata = &result->ldata; clnors = CustomData_get_layer(ldata, CD_CUSTOMLOOPNORMAL); - /* Keep info whether we had clnors, it helps when generating clnor spaces and default normals. */ + /* Keep info whether we had clnors, + * it helps when generating clnor spaces and default normals. */ const bool has_clnors = clnors != NULL; if (!clnors) { clnors = CustomData_add_layer(ldata, CD_CUSTOMLOOPNORMAL, CD_CALLOC, NULL, numLoops); diff --git a/source/blender/modifiers/intern/MOD_weightvg_util.c b/source/blender/modifiers/intern/MOD_weightvg_util.c index 871da8dfba9..61872cbe464 100644 --- a/source/blender/modifiers/intern/MOD_weightvg_util.c +++ b/source/blender/modifiers/intern/MOD_weightvg_util.c @@ -50,8 +50,8 @@ /* Maps new_w weights in place, using either one of the predefined functions, or a custom curve. * Return values are in new_w. - * If indices is not NULL, it must be a table of same length as org_w and new_w, mapping to the real - * vertex index (in case the weight tables do not cover the whole vertices...). + * If indices is not NULL, it must be a table of same length as org_w and new_w, + * mapping to the real vertex index (in case the weight tables do not cover the whole vertices...). * cmap might be NULL, in which case curve mapping mode will return unmodified data. */ void weightvg_do_map(int num, float *new_w, short falloff_type, CurveMapping *cmap, RNG *rng) @@ -111,9 +111,10 @@ void weightvg_do_map(int num, float *new_w, short falloff_type, CurveMapping *cm /* Applies new_w weights to org_w ones, using either a texture, vgroup or constant value as factor. * Return values are in org_w. - * If indices is not NULL, it must be a table of same length as org_w and new_w, mapping to the real - * vertex index (in case the weight tables do not cover the whole vertices...). - * XXX The standard "factor" value is assumed in [0.0, 1.0] range. Else, weird results might appear. + * If indices is not NULL, it must be a table of same length as org_w and new_w, + * mapping to the real vertex index (in case the weight tables do not cover the whole vertices...). + * XXX The standard "factor" value is assumed in [0.0, 1.0] range. + * Else, weird results might appear. */ void weightvg_do_mask(const ModifierEvalContext *ctx, const int num, diff --git a/source/blender/modifiers/intern/MOD_weightvg_util.h b/source/blender/modifiers/intern/MOD_weightvg_util.h index d73cca935d7..08967b7400d 100644 --- a/source/blender/modifiers/intern/MOD_weightvg_util.h +++ b/source/blender/modifiers/intern/MOD_weightvg_util.h @@ -52,21 +52,9 @@ struct Tex; */ #define MOD_WVG_ZEROFLOOR 1.0e-32f -/* Maps new_w weights in place, using either one of the predefined functions, or a custom curve. - * Return values are in new_w. - * If indices is not NULL, it must be a table of same length as org_w and new_w, mapping to the real - * vertex index (in case the weight tables do not cover the whole vertices...). - * cmap might be NULL, in which case curve mapping mode will return unmodified data. - */ void weightvg_do_map( int num, float *new_w, short mode, struct CurveMapping *cmap, struct RNG *rng); -/* Applies new_w weights to org_w ones, using either a texture, vgroup or constant value as factor. - * Return values are in org_w. - * If indices is not NULL, it must be a table of same length as org_w and new_w, mapping to the real - * vertex index (in case the weight tables do not cover the whole vertices...). - * XXX The standard "factor" value is assumed in [0.0, 1.0] range. Else, weird results might appear. - */ void weightvg_do_mask(const ModifierEvalContext *ctx, const int num, const int *indices, @@ -83,10 +71,6 @@ void weightvg_do_mask(const ModifierEvalContext *ctx, Object *tex_map_object, const char *tex_uvlayer_name); -/* Applies weights to given vgroup (defgroup), and optionally add/remove vertices from the group. - * If indices is not NULL, it must be a table of same length as weights, mapping to the real - * vertex index (in case the weight table does not cover the whole vertices...). - */ void weightvg_update_vg(struct MDeformVert *dvert, int defgrp_idx, struct MDeformWeight **dws, diff --git a/source/blender/modifiers/intern/MOD_weightvgproximity.c b/source/blender/modifiers/intern/MOD_weightvgproximity.c index 9699b5f15dd..9b3bc4678a1 100644 --- a/source/blender/modifiers/intern/MOD_weightvgproximity.c +++ b/source/blender/modifiers/intern/MOD_weightvgproximity.c @@ -79,7 +79,8 @@ typedef struct Vert2GeomData { float *dist[3]; } Vert2GeomData; -/* Data which is localized to each computed chunk (i.e. thread-safe, and with continuous subset of index range). */ +/** Data which is localized to each computed chunk + * (i.e. thread-safe, and with continuous subset of index range). */ typedef struct Vert2GeomDataChunk { /* Read-only data */ float last_hit_co[3][3]; @@ -110,8 +111,8 @@ static void vert2geom_task_cb_ex(void *__restrict userdata, /* Note that we use local proximity heuristics (to reduce the nearest search). * * If we already had an hit before in same chunk of tasks (i.e. previous vertex by index), - * we assume this vertex is going to have a close hit to that other vertex, so we can initiate - * the "nearest.dist" with the expected value to that last hit. + * we assume this vertex is going to have a close hit to that other vertex, + * so we can initiate the "nearest.dist" with the expected value to that last hit. * This will lead in pruning of the search tree. */ nearest.dist_sq = data_chunk->is_init[i] ? |