diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-05-30 18:00:05 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-05-30 18:00:47 +0300 |
commit | 7661f8a65bace62987e0bb419d4fcaced9000667 (patch) | |
tree | 45feb7947b73561dfc222862e6c8468ad33dc89f /source/blender/modifiers/intern/MOD_normal_edit.c | |
parent | 41fac4fa76d677ce6bf8b1411d46dd18d04d6943 (diff) |
Modifiers: Bring back custom data referencing logic
Brings dependency graph evaluation time to similar time than 2.79
for file reported in T55228.
Diffstat (limited to 'source/blender/modifiers/intern/MOD_normal_edit.c')
-rw-r--r-- | source/blender/modifiers/intern/MOD_normal_edit.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/source/blender/modifiers/intern/MOD_normal_edit.c b/source/blender/modifiers/intern/MOD_normal_edit.c index 5ac6569ea1f..bbb4608ee71 100644 --- a/source/blender/modifiers/intern/MOD_normal_edit.c +++ b/source/blender/modifiers/intern/MOD_normal_edit.c @@ -405,13 +405,19 @@ static Mesh *normalEditModifier_do(NormalEditModifierData *enmd, Object *ob, Mes } Mesh *result; - BKE_id_copy_ex( - NULL, &mesh->id, (ID **)&result, - LIB_ID_CREATE_NO_MAIN | - LIB_ID_CREATE_NO_USER_REFCOUNT | - LIB_ID_CREATE_NO_DEG_TAG | - LIB_ID_COPY_NO_PREVIEW, - false); + if (mesh->medge == ((Mesh *)ob->data)->medge) { + /* We need to duplicate data here, otherwise setting custom normals (which may also affect sharp edges) could + * modify org mesh, see T43671. */ + BKE_id_copy_ex( + NULL, &mesh->id, (ID **)&result, + LIB_ID_CREATE_NO_MAIN | + LIB_ID_CREATE_NO_USER_REFCOUNT | + LIB_ID_CREATE_NO_DEG_TAG | + LIB_ID_COPY_NO_PREVIEW, + false); + } else { + result = mesh; + } const int num_verts = result->totvert; const int num_edges = result->totedge; |