Page MenuHome

Fix T80159: Custom Normals Averaging crash after clearing custom split normals data
ClosedPublic

Authored by Philipp Oeser (lichtwerk) on Aug 27 2020, 3:50 PM.

Details

Summary

Clearing custom split normals would get rid of the CD_CUSTOMLOOPNORMAL layer - but editing data lnor_spacearr would be kept.

Adding a CD_CUSTOMLOOPNORMAL layer (if none exists yet) should be done in edbm_average_normals_exec / BKE_editmesh_lnorspace_update / BM_lnorspace_update / BM_lnorspacearr_store.
The thing is that if the editing data lnor_spacearr would still be valid after Clear Custom Split Normals Data, blender would happily call BM_lnorspace_rebuild instead.
Doing that without a CD_CUSTOMLOOPNORMAL layer is asking for trouble.

Now clear lnor_spacearr on Clear Custom Split Normals Data as well.

Thx @Bastien Montagne (mont29) for feedback here.

Diff Detail

Repository
rB Blender

Event Timeline

Philipp Oeser (lichtwerk) requested review of this revision.Aug 27 2020, 3:50 PM
Philipp Oeser (lichtwerk) created this revision.

Would go for solution 3, makes no sense to keep that temp editing data around when we have no clnors anymore.

source/blender/editors/mesh/mesh_data.c
1017–1022

I think this should be the proper solution yes, it will also save some useless memory usage.

get rid of other proposed solutions

Philipp Oeser (lichtwerk) retitled this revision from Fix T80159 (propposal): Custom Normals Averaging crash after clearing custom split normals data to Fix T80159: Custom Normals Averaging crash after clearing custom split normals data.Aug 27 2020, 5:26 PM
Philipp Oeser (lichtwerk) edited the summary of this revision. (Show Details)
Philipp Oeser (lichtwerk) edited the summary of this revision. (Show Details)
Philipp Oeser (lichtwerk) edited the summary of this revision. (Show Details)
This revision is now accepted and ready to land.Aug 27 2020, 5:31 PM