Fix T92288, T96041: instancing of shared mesh objects without modifiers broken

New code from the vertex normal refactor cfa53e0fbe combined with older code
from 592759e3d6 that disabled instancing for custom normals and autosmooth
meant that instancing was always disabled.

However we do not need to disable instancing for custom normals and autosmooth
at all, this can be shared between instances just fine.
This commit is contained in:
Brecht Van Lommel 2022-02-28 17:17:40 +01:00
parent 37d2c774c1
commit 44b0c70919
Notes: blender-bot 2023-02-14 05:41:57 +01:00
Referenced by issue #97035, Regression: Crash when transferring face corner data
Referenced by issue #96041, Memory usage of linked duplicates is extremely high (regression from 3.0)
Referenced by issue #92288, High memory consumption on instances in some cases (in 2.93 to render in Cycles, in 3.1 worse: also on file load)
1 changed files with 1 additions and 6 deletions

View File

@ -1304,12 +1304,7 @@ static void mesh_calc_modifiers(struct Depsgraph *depsgraph,
* we need to apply these back onto the Mesh. If we have no
* Mesh then we need to build one. */
if (mesh_final == nullptr) {
/* NOTE: this check on cdmask is a bit dodgy, it handles the issue at stake here (see T68211),
* but other cases might require similar handling?
* Could be a good idea to define a proper CustomData_MeshMask for that then. */
if (deformed_verts == nullptr && allow_shared_mesh &&
(final_datamask.lmask & CD_MASK_NORMAL) == 0 &&
(final_datamask.pmask & CD_MASK_NORMAL) == 0) {
if (deformed_verts == nullptr && allow_shared_mesh) {
mesh_final = mesh_input;
}
else {