Mesh: Avoid unnecessary normal calculation and dirty tags

This is mostly a cleanup to avoid hardcoding the eager calculation of
normals it isn't necessary, by reducing calls to `BKE_mesh_calc_normals`
and by removing calls to `BKE_mesh_normals_tag_dirty` when the mesh
is newly created and already has dirty normals anyway. This reduces
boilerplate code and makes the "dirty by default" state more clear.
Any regressions from this commit should be easy to fix, though the
lazy calculation is solid enough that none are expected.
This commit is contained in:
Hans Goudey 2022-04-19 17:08:02 -05:00
parent 9ec94c3882
commit 6a3c3c77b3
Notes: blender-bot 2023-03-03 21:19:03 +01:00
Referenced by commit d83a418c45, Fix T98727: Dynamic Paint does not update normals
Referenced by commit fe43c17083, Fix: Assert failure with certain screw modifier settings
Referenced by issue #98727, Regression: Dynamic Paint displacement do not update normals in 3.2
Referenced by issue #97542, Regression: Hair Particles Freeze Entire MacOS!
Referenced by commit d0eeb3d155, Cleanup: Remove mesh normals function, deprecate in RNA
56 changed files with 28 additions and 120 deletions

View File

@ -1171,6 +1171,7 @@ static Mesh *cloth_make_rest_mesh(ClothModifierData *clmd, Mesh *mesh)
for (unsigned i = 0; i < mesh->totvert; i++, verts++) {
copy_v3_v3(mvert[i].co, verts->xrest);
}
BKE_mesh_normals_tag_dirty(new_mesh);
return new_mesh;
}
@ -1507,7 +1508,6 @@ static bool cloth_build_springs(ClothModifierData *clmd, Mesh *mesh)
if (clmd->sim_parms->shapekey_rest &&
!(clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_DYNAMIC_BASEMESH)) {
tmp_mesh = cloth_make_rest_mesh(clmd, mesh);
BKE_mesh_calc_normals(tmp_mesh);
}
EdgeSet *existing_vert_pairs = BLI_edgeset_new("cloth_sewing_edges_graph");

View File

@ -649,7 +649,6 @@ Mesh *curve_to_mesh_sweep(const CurvesGeometry &main,
offsets.vert.last(), offsets.edge.last(), 0, offsets.loop.last(), offsets.poly.last());
mesh->flag |= ME_AUTOSMOOTH;
mesh->smoothresh = DEG2RADF(180.0f);
BKE_mesh_normals_tag_dirty(mesh);
MutableSpan<MVert> verts(mesh->mvert, mesh->totvert);
MutableSpan<MEdge> edges(mesh->medge, mesh->totedge);
MutableSpan<MLoop> loops(mesh->mloop, mesh->totloop);

View File

@ -887,17 +887,11 @@ static GeometrySet curve_calc_modifiers_post(Depsgraph *depsgraph,
if (mti->type == eModifierTypeType_OnlyDeform) {
int totvert;
float(*vertex_coords)[3] = BKE_mesh_vert_coords_alloc(mesh, &totvert);
if (mti->dependsOnNormals != nullptr && mti->dependsOnNormals(md)) {
BKE_mesh_vertex_normals_ensure(mesh);
}
mti->deformVerts(md, &mectx_deform, mesh, vertex_coords, totvert);
BKE_mesh_vert_coords_apply(mesh, vertex_coords);
MEM_freeN(vertex_coords);
}
else {
if (mti->dependsOnNormals != nullptr && mti->dependsOnNormals(md)) {
BKE_mesh_vertex_normals_ensure(mesh);
}
Mesh *output_mesh = mti->modifyMesh(md, &mectx_apply, mesh);
if (mesh != output_mesh) {
geometry_set.replace_mesh(output_mesh);

View File

@ -1899,7 +1899,6 @@ static Mesh *dynamicPaint_Modifier_apply(DynamicPaintModifierData *pmd, Object *
pmd->type == MOD_DYNAMICPAINT_TYPE_CANVAS) {
DynamicPaintSurface *surface;
bool update_normals = false;
/* loop through surfaces */
for (surface = pmd->canvas->surfaces.first; surface; surface = surface->next) {
@ -2018,21 +2017,17 @@ static Mesh *dynamicPaint_Modifier_apply(DynamicPaintModifierData *pmd, Object *
settings.use_threading = (sData->total_points > 1000);
BLI_task_parallel_range(
0, sData->total_points, &data, dynamic_paint_apply_surface_wave_cb, &settings);
update_normals = true;
BKE_mesh_normals_tag_dirty(mesh);
}
/* displace */
if (surface->type == MOD_DPAINT_SURFACE_T_DISPLACE) {
dynamicPaint_applySurfaceDisplace(surface, result);
update_normals = true;
BKE_mesh_normals_tag_dirty(mesh);
}
}
}
}
if (update_normals) {
BKE_mesh_normals_tag_dirty(result);
}
}
/* make a copy of mesh to use as brush data */
else if (pmd->brush && pmd->type == MOD_DYNAMICPAINT_TYPE_BRUSH) {

View File

@ -3537,7 +3537,6 @@ static Mesh *create_smoke_geometry(FluidDomainSettings *fds, Mesh *orgmesh, Obje
}
BKE_mesh_calc_edges(result, false, false);
BKE_mesh_normals_tag_dirty(result);
return result;
}

View File

@ -1112,6 +1112,9 @@ Mesh *BKE_mesh_new_nomain_from_template_ex(const Mesh *me_src,
mesh_ensure_cdlayers_primary(me_dst, do_tessface);
BKE_mesh_update_customdata_pointers(me_dst, false);
/* Expect that normals aren't copied at all, since the destination mesh is new. */
BLI_assert(BKE_mesh_vertex_normals_are_dirty(me_dst));
return me_dst;
}
@ -1688,6 +1691,7 @@ void BKE_mesh_transform(Mesh *me, const float mat[4][4], bool do_keys)
mul_m3_v3(m3, *lnors);
}
}
BKE_mesh_normals_tag_dirty(me);
}
void BKE_mesh_translate(Mesh *me, const float offset[3], const bool do_keys)

View File

@ -782,7 +782,6 @@ static Mesh *imesh_to_mesh(IMesh *im, MeshesToIMeshInfo &mim)
}
}
BKE_mesh_calc_normals(result);
if (dbg_level > 0) {
BKE_mesh_validate(result, true, true);
}

View File

@ -120,9 +120,6 @@ void BKE_mesh_from_metaball(ListBase *lb, Mesh *me)
}
BKE_mesh_update_customdata_pointers(me, true);
BKE_mesh_normals_tag_dirty(me);
BKE_mesh_calc_edges(me, true, false);
}
}
@ -514,7 +511,6 @@ Mesh *BKE_mesh_new_nomain_from_curve_displist(const Object *ob, const ListBase *
}
mesh = BKE_mesh_new_nomain(totvert, totedge, 0, totloop, totpoly);
BKE_mesh_normals_tag_dirty(mesh);
if (totvert != 0) {
memcpy(mesh->mvert, allvert, totvert * sizeof(MVert));

View File

@ -140,7 +140,6 @@ static Mesh *remesh_quadriflow(const Mesh *input_mesh,
}
BKE_mesh_calc_edges(mesh, false, false);
BKE_mesh_calc_normals(mesh);
MEM_freeN(qrd.out_faces);
MEM_freeN(qrd.out_verts);
@ -257,7 +256,6 @@ static Mesh *remesh_voxel_volume_to_mesh(const openvdb::FloatGrid::Ptr level_set
}
BKE_mesh_calc_edges(mesh, false, false);
BKE_mesh_normals_tag_dirty(mesh);
return mesh;
}

View File

@ -944,8 +944,10 @@ static void modwrap_dependsOnNormals(Mesh *me)
break;
}
case ME_WRAPPER_TYPE_SUBD:
/* Not an expected case. */
break;
case ME_WRAPPER_TYPE_MDATA:
BKE_mesh_calc_normals(me);
/* Normals are calculated lazily. */
break;
}
}
@ -992,7 +994,7 @@ void BKE_modifier_deform_vertsEM(ModifierData *md,
{
const ModifierTypeInfo *mti = BKE_modifier_get_info(md->type);
if (me && mti->dependsOnNormals && mti->dependsOnNormals(md)) {
BKE_mesh_calc_normals(me);
modwrap_dependsOnNormals(me);
}
mti->deformVertsEM(md, ctx, em, me, vertexCos, numVerts);
}

View File

@ -156,7 +156,7 @@ void multires_reshape_apply_base_refit_base_mesh(MultiresReshapeContext *reshape
/* Vertices were moved around, need to update normals after all the vertices are updated
* Probably this is possible to do in the loop above, but this is rather tricky because
* we don't know all needed vertices' coordinates there yet. */
BKE_mesh_calc_normals(base_mesh);
BKE_mesh_normals_tag_dirty(base_mesh);
}
void multires_reshape_apply_base_refine_from_base(MultiresReshapeContext *reshape_context)

View File

@ -1155,7 +1155,7 @@ Mesh *BKE_subdiv_to_mesh(Subdiv *subdiv,
* calculation. Since vertex normals are supposed to be a consistent cache, don't bother
* calculating them here. The work may have been pointless anyway if the mesh is deformed or
* changed afterwards. */
BKE_mesh_normals_tag_dirty(result);
BLI_assert(BKE_mesh_vertex_normals_are_dirty(result) || BKE_mesh_poly_normals_are_dirty(result));
/* Free used memory. */
subdiv_mesh_context_free(&subdiv_context);
return result;

View File

@ -183,7 +183,6 @@ Mesh *volume_to_mesh(const openvdb::GridBase &grid,
{mesh->mloop, mesh->totloop});
BKE_mesh_calc_edges(mesh, false, false);
BKE_mesh_normals_tag_dirty(mesh);
return mesh;
}

View File

@ -230,8 +230,6 @@ static int geometry_extract_apply(bContext *C,
}
}
BKE_mesh_calc_normals(new_ob->data);
WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, new_ob);
BKE_mesh_batch_cache_dirty_tag(new_ob->data, BKE_MESH_BATCH_DIRTY_ALL);
DEG_relations_tag_update(bmain);
@ -551,7 +549,6 @@ static int paint_mask_slice_exec(bContext *C, wmOperator *op)
CustomData_free_layers(&new_ob_mesh->vdata, CD_PAINT_MASK, new_ob_mesh->totvert);
BKE_mesh_nomain_to_mesh(new_ob_mesh, new_ob->data, new_ob, &CD_MASK_MESH, true);
BKE_mesh_calc_normals(new_ob->data);
BKE_mesh_copy_parameters_for_eval(new_ob->data, mesh);
WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, new_ob);
BKE_mesh_batch_cache_dirty_tag(new_ob->data, BKE_MESH_BATCH_DIRTY_ALL);
@ -561,7 +558,6 @@ static int paint_mask_slice_exec(bContext *C, wmOperator *op)
}
BKE_mesh_nomain_to_mesh(new_mesh, ob->data, ob, &CD_MASK_MESH, true);
BKE_mesh_calc_normals(ob->data);
if (ob->mode == OB_MODE_SCULPT) {
SculptSession *ss = ob->sculpt;

View File

@ -1092,7 +1092,8 @@ void ED_mesh_update(Mesh *mesh, bContext *C, bool calc_edges, bool calc_edges_lo
/* Default state is not to have tessface's so make sure this is the case. */
BKE_mesh_tessface_clear(mesh);
BKE_mesh_calc_normals(mesh);
/* Tag lazily calculated data as dirty. */
BKE_mesh_normals_tag_dirty(mesh);
DEG_id_tag_update(&mesh->id, 0);
WM_event_add_notifier(C, NC_GEOM | ND_DATA, mesh);

View File

@ -681,8 +681,8 @@ int ED_mesh_join_objects_exec(bContext *C, wmOperator *op)
/* tessface data removed above, no need to update */
BKE_mesh_update_customdata_pointers(me, false);
/* update normals in case objects with non-uniform scale are joined */
BKE_mesh_calc_normals(me);
/* Tag normals dirty because vertex positions could be changed from the original. */
BKE_mesh_normals_tag_dirty(me);
/* old material array */
for (a = 1; a <= ob->totcol; a++) {

View File

@ -885,9 +885,6 @@ static void quadriflow_start_job(void *customdata, short *stop, short *do_update
BKE_mesh_nomain_to_mesh(new_mesh, mesh, ob, &CD_MASK_MESH, true);
if (qj->smooth_normals) {
if (qj->use_mesh_symmetry) {
BKE_mesh_calc_normals(static_cast<Mesh *>(ob->data));
}
BKE_mesh_smooth_flag_set(static_cast<Mesh *>(ob->data), true);
}

View File

@ -884,9 +884,6 @@ static int apply_objects_internal(bContext *C,
/* adjust data */
BKE_mesh_transform(me, mat, true);
/* If normal layers exist, they are now dirty. */
BKE_mesh_normals_tag_dirty(me);
}
else if (ob->type == OB_ARMATURE) {
bArmature *arm = static_cast<bArmature *>(ob->data);

View File

@ -950,7 +950,6 @@ static void sculpt_gesture_trim_normals_update(SculptGestureContext *sgcontext)
{
SculptGestureTrimOperation *trim_operation = (SculptGestureTrimOperation *)sgcontext->operation;
Mesh *trim_mesh = trim_operation->mesh;
BKE_mesh_calc_normals(trim_mesh);
const BMAllocTemplate allocsize = BMALLOC_TEMPLATE_FROM_ME(trim_mesh);
BMesh *bm;
@ -1288,7 +1287,6 @@ static void sculpt_gesture_apply_trim(SculptGestureContext *sgcontext)
}),
sculpt_mesh);
BM_mesh_free(bm);
BKE_mesh_normals_tag_dirty(result);
BKE_mesh_nomain_to_mesh(
result, sgcontext->vc.obact->data, sgcontext->vc.obact, &CD_MASK_MESH, true);
}

View File

@ -3097,8 +3097,7 @@ void SCULPT_vertcos_to_key(Object *ob, KeyBlock *kb, const float (*vertCos)[3])
for (a = 0; a < me->totvert; a++, mvert++) {
copy_v3_v3(mvert->co, vertCos[a]);
}
BKE_mesh_calc_normals(me);
BKE_mesh_normals_tag_dirty(me);
}
/* Apply new coords on active key block, no need to re-allocate kb->data here! */

View File

@ -245,7 +245,7 @@ static int sculpt_symmetrize_exec(bContext *C, wmOperator *op)
BKE_mesh_mirror_apply_mirror_on_axis(bmain, mesh, sd->symmetrize_direction, dist);
ED_sculpt_undo_geometry_end(ob);
BKE_mesh_calc_normals(ob->data);
BKE_mesh_normals_tag_dirty(mesh);
BKE_mesh_batch_cache_dirty_tag(ob->data, BKE_MESH_BATCH_DIRTY_ALL);
break;

View File

@ -854,7 +854,7 @@ static void sculpt_undo_restore_list(bContext *C, Depsgraph *depsgraph, ListBase
if (tag_update) {
Mesh *mesh = ob->data;
BKE_mesh_calc_normals(mesh);
BKE_mesh_normals_tag_dirty(mesh);
BKE_sculptsession_free_deformMats(ss);
}

View File

@ -1580,10 +1580,6 @@ static Mesh *create_merged_mesh(const Mesh &mesh,
BLI_assert((int)r_i == result_npolys);
BLI_assert(loop_cur == result_nloops);
/* We could only update the normals of the elements in context, but the next modifier can make it
* dirty anyway which would make the work useless. */
BKE_mesh_normals_tag_dirty(result);
return result;
}

View File

@ -1015,8 +1015,6 @@ static void execute_realize_mesh_tasks(const RealizeInstancesOptions &options,
if (vertex_ids) {
vertex_ids.save();
}
BKE_mesh_normals_tag_dirty(dst_mesh);
}
/** \} */

View File

@ -245,7 +245,7 @@ static void read_mpolys(CDStreamConfig &config, const AbcMeshData &mesh_data)
static void process_no_normals(CDStreamConfig &config)
{
/* Absence of normals in the Alembic mesh is interpreted as 'smooth'. */
BKE_mesh_calc_normals(config.mesh);
BKE_mesh_normals_tag_dirty(config.mesh);
}
static void process_loop_normals(CDStreamConfig &config, const N3fArraySamplePtr loop_normals_ptr)

View File

@ -1057,7 +1057,6 @@ Object *MeshImporter::create_mesh_object(
Mesh *new_mesh = uid_mesh_map[*geom_uid];
BKE_mesh_assign_object(m_bmain, ob, new_mesh);
BKE_mesh_calc_normals(new_mesh);
/* Because BKE_mesh_assign_object would have already decreased it... */
id_us_plus(&old_mesh->id);

View File

@ -159,7 +159,6 @@ static void rna_Mesh_normals_split_custom_set_from_vertices(Mesh *mesh,
static void rna_Mesh_transform(Mesh *mesh, float mat[16], bool shape_keys)
{
BKE_mesh_transform(mesh, (float(*)[4])mat, shape_keys);
BKE_mesh_normals_tag_dirty(mesh);
DEG_id_tag_update(&mesh->id, 0);
}

View File

@ -789,13 +789,6 @@ static Mesh *arrayModifier_doArray(ArrayModifierData *amd,
MEM_freeN(full_doubles_map);
}
/* In case org dm has dirty normals, or we made some merging, mark normals as dirty in new mesh!
* TODO: we may need to set other dirty flags as well?
*/
if (use_recalc_normals) {
BKE_mesh_normals_tag_dirty(result);
}
if (vgroup_start_cap_remap) {
MEM_freeN(vgroup_start_cap_remap);
}

View File

@ -229,8 +229,6 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
BM_mesh_free(bm);
BKE_mesh_normals_tag_dirty(result);
return result;
}

View File

@ -501,7 +501,6 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
result = BKE_mesh_from_bmesh_for_eval_nomain(bm, nullptr, mesh);
BM_mesh_free(bm);
BKE_mesh_normals_tag_dirty(result);
}
if (result == nullptr) {
@ -536,7 +535,6 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
result = BKE_mesh_from_bmesh_for_eval_nomain(bm, nullptr, mesh);
BM_mesh_free(bm);
BKE_mesh_normals_tag_dirty(result);
}
}
}

View File

@ -263,8 +263,6 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, struct
MEM_freeN(edgeMap);
MEM_freeN(faceMap);
BKE_mesh_normals_tag_dirty(result);
/* TODO(sybren): also copy flags & tags? */
return result;
}

View File

@ -120,7 +120,7 @@ static void deformVerts(ModifierData *md,
uint mvert_num = 0;
BKE_mesh_vert_coords_apply(mesh_src, vertexCos);
BKE_mesh_calc_normals(mesh_src);
BKE_mesh_normals_tag_dirty(mesh_src);
current_time = DEG_get_ctime(ctx->depsgraph);

View File

@ -212,8 +212,6 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
TIMEIT_END(decim);
#endif
BKE_mesh_normals_tag_dirty(result);
return result;
}

View File

@ -102,7 +102,6 @@ Mesh *doEdgeSplit(const Mesh *mesh, EdgeSplitModifierData *emd)
result = BKE_mesh_from_bmesh_for_eval_nomain(bm, NULL, mesh);
BM_mesh_free(bm);
BKE_mesh_normals_tag_dirty(result);
return result;
}

View File

@ -1102,7 +1102,6 @@ static Mesh *explodeMesh(ExplodeModifierData *emd,
/* finalization */
BKE_mesh_calc_edges_tessface(explode);
BKE_mesh_convert_mfaces_to_mpolys(explode);
BKE_mesh_normals_tag_dirty(explode);
if (psmd->psys->lattice_deform_data) {
BKE_lattice_deform_data_destroy(psmd->psys->lattice_deform_data);

View File

@ -748,7 +748,6 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *UNUSED(ctx)
}
BKE_mesh_calc_edges_loose(result);
BKE_mesh_normals_tag_dirty(result);
return result;
}

View File

@ -302,8 +302,6 @@ static Mesh *generate_ocean_geometry(OceanModifierData *omd, Mesh *mesh_orig, co
}
}
BKE_mesh_normals_tag_dirty(result);
return result;
}
@ -361,7 +359,6 @@ static Mesh *doOcean(ModifierData *md, const ModifierEvalContext *ctx, Mesh *mes
if (omd->geometry_mode == MOD_OCEAN_GEOM_GENERATE) {
result = generate_ocean_geometry(omd, mesh, resolution);
BKE_mesh_normals_tag_dirty(result);
}
else if (omd->geometry_mode == MOD_OCEAN_GEOM_DISPLACE) {
result = (Mesh *)BKE_id_copy_ex(NULL, &mesh->id, NULL, LIB_ID_COPY_LOCALIZE);
@ -472,6 +469,8 @@ static Mesh *doOcean(ModifierData *md, const ModifierEvalContext *ctx, Mesh *mes
}
}
BKE_mesh_normals_tag_dirty(mesh);
if (allocated_ocean) {
BKE_ocean_free(omd->ocean);
omd->ocean = NULL;
@ -490,15 +489,7 @@ static Mesh *doOcean(ModifierData *UNUSED(md), const ModifierEvalContext *UNUSED
static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *mesh)
{
Mesh *result;
result = doOcean(md, ctx, mesh);
if (result != mesh) {
BKE_mesh_normals_tag_dirty(result);
}
return result;
return doOcean(md, ctx, mesh);
}
// #define WITH_OCEANSIM
static void panel_draw(const bContext *UNUSED(C), Panel *panel)

View File

@ -530,8 +530,6 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
MEM_SAFE_FREE(vert_part_index);
MEM_SAFE_FREE(vert_part_value);
BKE_mesh_normals_tag_dirty(result);
return result;
}

View File

@ -158,7 +158,6 @@ static void deformVerts(ModifierData *md,
/* make new mesh */
psmd->mesh_final = BKE_mesh_copy_for_eval(mesh_src, false);
BKE_mesh_vert_coords_apply(psmd->mesh_final, vertexCos);
BKE_mesh_calc_normals(psmd->mesh_final);
BKE_mesh_tessface_ensure(psmd->mesh_final);

View File

@ -206,7 +206,6 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *UNUSED(ctx)
BKE_mesh_copy_parameters_for_eval(result, mesh);
BKE_mesh_calc_edges(result, true, false);
BKE_mesh_normals_tag_dirty(result);
return result;
}

View File

@ -384,7 +384,6 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
mvert_new = result->mvert;
float(*vert_normals_new)[3] = BKE_mesh_vertex_normals_for_write(result);
BKE_mesh_vertex_normals_clear_dirty(result);
mpoly_new = result->mpoly;
mloop_new = result->mloop;
medge_new = result->medge;
@ -1120,7 +1119,6 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
}
if ((ltmd->flag & MOD_SCREW_MERGE) && (screw_ofs == 0.0f)) {
Mesh *result_prev = result;
result = mesh_remove_doubles_on_axis(result,
mvert_new,
totvert,
@ -1128,13 +1126,10 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
axis_vec,
ob_axis != NULL ? mtx_tx[3] : NULL,
ltmd->merge_dist);
if (result != result_prev) {
BKE_mesh_normals_tag_dirty(result);
}
}
if ((ltmd->flag & MOD_SCREW_NORMAL_CALC) == 0) {
BKE_mesh_normals_tag_dirty(result);
if ((ltmd->flag & MOD_SCREW_NORMAL_CALC)) {
BKE_mesh_vertex_normals_clear_dirty(mesh);
}
return result;

View File

@ -1950,8 +1950,6 @@ static Mesh *base_skin(Mesh *origmesh, SkinModifierData *smd, eSkinErrorFlag *r_
result = BKE_mesh_from_bmesh_for_eval_nomain(bm, NULL, origmesh);
BM_mesh_free(bm);
BKE_mesh_normals_tag_dirty(result);
skin_set_orig_indices(result);
return result;

View File

@ -2016,8 +2016,6 @@ Mesh *MOD_solidify_nonmanifold_modifyMesh(ModifierData *md,
}
}
BKE_mesh_normals_tag_dirty(result);
/* Make edges. */
{
uint i = 0;

View File

@ -129,7 +129,7 @@ static void deformVerts(ModifierData *md,
MVert *x, *v;
BKE_mesh_vert_coords_apply(surmd->mesh, vertexCos);
BKE_mesh_calc_normals(surmd->mesh);
BKE_mesh_normals_tag_dirty(surmd->mesh);
mesh_verts_num = surmd->mesh->totvert;

View File

@ -89,8 +89,6 @@ static Mesh *triangulate_mesh(Mesh *mesh,
me->flag |= ME_EDGEDRAW | ME_EDGERENDER;
}
BKE_mesh_normals_tag_dirty(result);
return result;
}

View File

@ -97,8 +97,6 @@ static Mesh *WireframeModifier_do(WireframeModifierData *wmd, Object *ob, Mesh *
result = BKE_mesh_from_bmesh_for_eval_nomain(bm, NULL, mesh);
BM_mesh_free(bm);
BKE_mesh_normals_tag_dirty(result);
return result;
}

View File

@ -131,8 +131,6 @@ static Mesh *hull_from_bullet(const Mesh *mesh, Span<float3> coords)
}
plConvexHullDelete(hull);
BKE_mesh_normals_tag_dirty(result);
return result;
}

View File

@ -1225,8 +1225,6 @@ static void do_mesh_separation(GeometrySet &geometry_set,
}
BKE_mesh_calc_edges_loose(mesh_out);
/* Tag to recalculate normals later. */
BKE_mesh_normals_tag_dirty(mesh_out);
geometry_set.replace_mesh(mesh_out);
}

View File

@ -897,7 +897,6 @@ static void calc_dual_mesh(GeometrySet &geometry_set,
copy_v3_v3(mesh_out->mvert[i].co, vertex_positions[i]);
}
memcpy(mesh_out->medge, new_edges.data(), sizeof(MEdge) * new_edges.size());
BKE_mesh_normals_tag_dirty(mesh_out);
geometry_set.replace_mesh(mesh_out);
}

View File

@ -41,8 +41,6 @@ static Mesh *mesh_edge_split(const Mesh &mesh, const IndexMask selection)
Mesh *result = BKE_mesh_from_bmesh_for_eval_nomain(bm, nullptr, &mesh);
BM_mesh_free(bm);
BKE_mesh_normals_tag_dirty(result);
return result;
}

View File

@ -407,7 +407,6 @@ Mesh *create_cuboid_mesh(const float3 size,
calculate_polys(config, {mesh->mpoly, mesh->totpoly}, {mesh->mloop, mesh->totloop});
BKE_mesh_calc_edges(mesh, false, false);
BKE_mesh_normals_tag_dirty(mesh);
calculate_uvs(config, mesh);

View File

@ -50,7 +50,6 @@ static void geometry_set_mesh_subdivide(GeometrySet &geometry_set, const int lev
}
Mesh *mesh_out = BKE_subdiv_to_mesh(subdiv, &mesh_settings, mesh_in);
BKE_mesh_normals_tag_dirty(mesh_out);
MeshComponent &mesh_component = geometry_set.get_component_for_write<MeshComponent>();
mesh_component.replace(mesh_out);

View File

@ -119,7 +119,6 @@ static void node_geo_exec(GeoNodeExecParams params)
}
Mesh *mesh_out = BKE_subdiv_to_mesh(subdiv, &mesh_settings, mesh_in);
BKE_mesh_normals_tag_dirty(mesh_out);
mesh_component.replace(mesh_out);

View File

@ -43,7 +43,6 @@ static void translate_mesh(Mesh &mesh, const float3 translation)
static void transform_mesh(Mesh &mesh, const float4x4 &transform)
{
BKE_mesh_transform(&mesh, transform.values, false);
BKE_mesh_normals_tag_dirty(&mesh);
}
static void translate_pointcloud(PointCloud &pointcloud, const float3 translation)

View File

@ -62,7 +62,6 @@ static Mesh *triangulate_mesh_selection(const Mesh &mesh,
BM_mesh_triangulate(bm, quad_method, ngon_method, min_vertices, true, nullptr, nullptr, nullptr);
Mesh *result = BKE_mesh_from_bmesh_for_eval_nomain(bm, &cd_mask_extra, &mesh);
BM_mesh_free(bm);
BKE_mesh_normals_tag_dirty(result);
return result;
}

View File

@ -139,7 +139,6 @@ static Mesh *create_mesh_from_volume_grids(Span<openvdb::GridBase::ConstPtr> gri
}
BKE_mesh_calc_edges(mesh, false, false);
BKE_mesh_normals_tag_dirty(mesh);
return mesh;
}