diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2020-03-17 17:28:24 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2020-03-17 18:41:43 +0300 |
commit | bf5151b2d29dc64d11c86d04485667f6045c0aed (patch) | |
tree | 261524365175b846b30727b2acbe1424ac59fe28 /source | |
parent | a45c34ae8eb73448726a92d0b4d79b632dc69d9e (diff) |
Mesh: Add utility to calculate deform modifier up to index
Intention is to be used to create mesh at the state which is an input
to the multires modifier.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/BKE_mesh_runtime.h | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/DerivedMesh.c | 21 |
2 files changed, 27 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_mesh_runtime.h b/source/blender/blenkernel/BKE_mesh_runtime.h index fdddafcc71f..bdf7692b89b 100644 --- a/source/blender/blenkernel/BKE_mesh_runtime.h +++ b/source/blender/blenkernel/BKE_mesh_runtime.h @@ -87,6 +87,12 @@ struct Mesh *mesh_create_eval_final_view(struct Depsgraph *depsgraph, struct Object *ob, const struct CustomData_MeshMasks *dataMask); +struct Mesh *mesh_create_eval_final_view_index(struct Depsgraph *depsgraph, + struct Scene *scene, + struct Object *ob, + const struct CustomData_MeshMasks *dataMask, + int index); + struct Mesh *mesh_create_eval_no_deform(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index 5feb51534e9..2db48e1fb13 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -2013,6 +2013,27 @@ Mesh *mesh_create_eval_final_view(Depsgraph *depsgraph, return final; } +Mesh *mesh_create_eval_final_view_index(Depsgraph *depsgraph, + Scene *scene, + Object *ob, + const CustomData_MeshMasks *dataMask, + int index) +{ + Mesh *final; + + /* XXX hack + * psys modifier updates particle state when called during dupli-list generation, + * which can lead to wrong transforms. This disables particle system modifier execution. + */ + ob->transflag |= OB_NO_PSYS_UPDATE; + + mesh_calc_modifiers(depsgraph, scene, ob, 1, false, dataMask, index, false, false, NULL, &final); + + ob->transflag &= ~OB_NO_PSYS_UPDATE; + + return final; +} + Mesh *mesh_create_eval_no_deform(Depsgraph *depsgraph, Scene *scene, Object *ob, |