main sync #3

Merged
Patrick Busch merged 318 commits from blender/blender:main into main 2023-03-17 15:52:21 +01:00
6 changed files with 6 additions and 20 deletions
Showing only changes of commit f9132e2bbf - Show all commits

View File

@ -336,14 +336,6 @@ const float (*BKE_mesh_vert_normals_ensure(const struct Mesh *mesh))[3];
*/ */
const float (*BKE_mesh_poly_normals_ensure(const struct Mesh *mesh))[3]; const float (*BKE_mesh_poly_normals_ensure(const struct Mesh *mesh))[3];
/**
* Tag mesh vertex and face normals to be recalculated when/if they are needed later.
*
* \note Dirty tagged normals are the default state of a new mesh, so tagging them
* dirty explicitly is not always necessary if the mesh is created locally.
*/
void BKE_mesh_normals_tag_dirty(struct Mesh *mesh);
/** /**
* Retrieve write access to the cached vertex normals, ensuring that they are allocated but *not* * Retrieve write access to the cached vertex normals, ensuring that they are allocated but *not*
* that they are calculated. The provided vertex normals should be the same as if they were * that they are calculated. The provided vertex normals should be the same as if they were

View File

@ -100,11 +100,6 @@ static void add_v3_v3_atomic(float r[3], const float a[3])
* Related to managing normals but not directly related to calculating normals. * Related to managing normals but not directly related to calculating normals.
* \{ */ * \{ */
void BKE_mesh_normals_tag_dirty(Mesh *mesh)
{
mesh->runtime->vert_normals_dirty = true;
mesh->runtime->poly_normals_dirty = true;
}
float (*BKE_mesh_vert_normals_for_write(Mesh *mesh))[3] float (*BKE_mesh_vert_normals_for_write(Mesh *mesh))[3]
{ {

View File

@ -246,7 +246,8 @@ void BKE_mesh_tag_edges_split(struct Mesh *mesh)
void BKE_mesh_tag_positions_changed(Mesh *mesh) void BKE_mesh_tag_positions_changed(Mesh *mesh)
{ {
BKE_mesh_normals_tag_dirty(mesh); mesh->runtime->vert_normals_dirty = true;
mesh->runtime->poly_normals_dirty = true;
free_bvh_cache(*mesh->runtime); free_bvh_cache(*mesh->runtime);
mesh->runtime->looptris_cache.tag_dirty(); mesh->runtime->looptris_cache.tag_dirty();
mesh->runtime->bounds_cache.tag_dirty(); mesh->runtime->bounds_cache.tag_dirty();

View File

@ -1116,8 +1116,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. */ /* Default state is not to have tessface's so make sure this is the case. */
BKE_mesh_tessface_clear(mesh); BKE_mesh_tessface_clear(mesh);
/* Tag lazily calculated data as dirty. */ mesh->runtime->vert_normals_dirty = true;
BKE_mesh_normals_tag_dirty(mesh); mesh->runtime->poly_normals_dirty = true;
DEG_id_tag_update(&mesh->id, 0); DEG_id_tag_update(&mesh->id, 0);
WM_event_add_notifier(C, NC_GEOM | ND_DATA, mesh); WM_event_add_notifier(C, NC_GEOM | ND_DATA, mesh);

View File

@ -315,8 +315,7 @@ static void normalEditModifier_do_radial(NormalEditModifierData *enmd,
if (do_polynors_fix && if (do_polynors_fix &&
polygons_check_flip( polygons_check_flip(
loops, nos.data(), &mesh->ldata, polys, BKE_mesh_poly_normals_for_write(mesh))) { loops, nos.data(), &mesh->ldata, polys, BKE_mesh_poly_normals_for_write(mesh))) {
/* We need to recompute vertex normals! */ mesh->runtime->vert_normals_dirty = true;
BKE_mesh_normals_tag_dirty(mesh);
} }
const bool *sharp_faces = static_cast<const bool *>( const bool *sharp_faces = static_cast<const bool *>(
CustomData_get_layer_named(&mesh->pdata, CD_PROP_BOOL, "sharp_face")); CustomData_get_layer_named(&mesh->pdata, CD_PROP_BOOL, "sharp_face"));
@ -422,7 +421,7 @@ static void normalEditModifier_do_directional(NormalEditModifierData *enmd,
if (do_polynors_fix && if (do_polynors_fix &&
polygons_check_flip( polygons_check_flip(
loops, nos.data(), &mesh->ldata, polys, BKE_mesh_poly_normals_for_write(mesh))) { loops, nos.data(), &mesh->ldata, polys, BKE_mesh_poly_normals_for_write(mesh))) {
BKE_mesh_normals_tag_dirty(mesh); mesh->runtime->vert_normals_dirty = true;
} }
const bool *sharp_faces = static_cast<const bool *>( const bool *sharp_faces = static_cast<const bool *>(
CustomData_get_layer_named(&mesh->pdata, CD_PROP_BOOL, "sharp_face")); CustomData_get_layer_named(&mesh->pdata, CD_PROP_BOOL, "sharp_face"));

View File

@ -971,7 +971,6 @@ Mesh *MOD_solidify_extrude_modifyMesh(ModifierData *md, const ModifierEvalContex
/* must recalculate normals with vgroups since they can displace unevenly #26888. */ /* must recalculate normals with vgroups since they can displace unevenly #26888. */
if (BKE_mesh_vert_normals_are_dirty(mesh) || do_rim || dvert) { if (BKE_mesh_vert_normals_are_dirty(mesh) || do_rim || dvert) {
BKE_mesh_normals_tag_dirty(result);
} }
else if (do_shell) { else if (do_shell) {
uint i; uint i;