diff options
author | Hans Goudey <h.goudey@me.com> | 2022-05-13 19:31:29 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-05-13 19:35:22 +0300 |
commit | cf69652618fefcd22b2cde9a2e0338b63f9a003e (patch) | |
tree | 013435f2e181f1332681bd513903c0cacf1baeda /source/blender/modifiers/intern/MOD_weighted_normal.c | |
parent | fa7224d8ed88fbfbf55e5d1a83cef49c309785cb (diff) |
Cleanup: Use const when retrieving custom data layers
Knowing when layers are retrieved for write access will be essential
when adding proper copy-on-write support. This commit makes that
clearer by adding `const` where the retrieved data is not modified.
Ref T95842
Diffstat (limited to 'source/blender/modifiers/intern/MOD_weighted_normal.c')
-rw-r--r-- | source/blender/modifiers/intern/MOD_weighted_normal.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/source/blender/modifiers/intern/MOD_weighted_normal.c b/source/blender/modifiers/intern/MOD_weighted_normal.c index c79dbdb0b1a..4c06a77e719 100644 --- a/source/blender/modifiers/intern/MOD_weighted_normal.c +++ b/source/blender/modifiers/intern/MOD_weighted_normal.c @@ -82,7 +82,7 @@ typedef struct WeightedNormalData { MPoly *mpoly; const float (*polynors)[3]; - int *poly_strength; + const int *poly_strength; MDeformVert *dvert; const int defgrp_index; @@ -195,7 +195,7 @@ static void apply_weights_vertex_normal(WeightedNormalModifierData *wnmd, MPoly *mpoly = wn_data->mpoly; const float(*polynors)[3] = wn_data->polynors; - int *poly_strength = wn_data->poly_strength; + const int *poly_strength = wn_data->poly_strength; MDeformVert *dvert = wn_data->dvert; @@ -603,15 +603,13 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh * } const float split_angle = mesh->smoothresh; - short(*clnors)[2]; - CustomData *ldata = &result->ldata; - clnors = CustomData_get_layer(ldata, CD_CUSTOMLOOPNORMAL); + short(*clnors)[2] = CustomData_get_layer(&result->ldata, CD_CUSTOMLOOPNORMAL); /* 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, loops_num); + clnors = CustomData_add_layer(&result->ldata, CD_CUSTOMLOOPNORMAL, CD_CALLOC, NULL, loops_num); } MDeformVert *dvert; |