diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-02-12 18:00:46 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-02-12 18:42:34 +0300 |
commit | 027c356e23cb5a82d61d18616ab3267220f9ee56 (patch) | |
tree | 8204b8828e42cb3de1bb351622157189bfacadb3 /source | |
parent | 8614f282348981d63fea7230826a22e179605219 (diff) |
Use direct access to evaluated mesh from instancing
It is supposed to be already evaluated. If for some reason it's not
doing such direct evaluation will not be reliable anyway (indirect
dependencies for example).
This fixes an assert part of T61431.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/object_dupli.c | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/source/blender/blenkernel/intern/object_dupli.c b/source/blender/blenkernel/intern/object_dupli.c index 114c5e86193..9b1d5a63356 100644 --- a/source/blender/blenkernel/intern/object_dupli.c +++ b/source/blender/blenkernel/intern/object_dupli.c @@ -387,7 +387,6 @@ static void make_child_duplis_verts(const DupliContext *ctx, void *userdata, Obj static void make_duplis_verts(const DupliContext *ctx) { - Scene *scene = ctx->scene; Object *parent = ctx->object; bool use_texcoords = (DEG_get_mode(ctx->depsgraph) == DAG_EVAL_RENDER); VertexDupliData vdd; @@ -397,16 +396,22 @@ static void make_duplis_verts(const DupliContext *ctx) /* gather mesh info */ { - CustomDataMask dm_mask = (use_texcoords ? CD_MASK_BAREMESH | CD_MASK_ORCO : CD_MASK_BAREMESH); vdd.edit_btmesh = BKE_editmesh_from_object(parent); - /* We do not need any render-smecific handling anymore, depsgraph takes care of that. */ + /* We do not need any render-specific handling anymore, depsgraph takes care of that. */ + /* NOTE: Do direct access to the evaluated mesh: this function is used + * during meta balls evaluation. But even without those all the objects + * which are needed for correct instancing are already evaluated. */ if (vdd.edit_btmesh != NULL) { /* XXX TODO replace with equivalent of editbmesh_get_eval_cage when available. */ - vdd.me_eval = mesh_get_eval_deform(ctx->depsgraph, scene, parent, dm_mask); + vdd.me_eval = parent->runtime.mesh_deform_eval; } else { - vdd.me_eval = mesh_get_eval_final(ctx->depsgraph, scene, parent, dm_mask); + vdd.me_eval = parent->runtime.mesh_eval; + } + + if (vdd.me_eval == NULL) { + return; } if (use_texcoords) { @@ -658,7 +663,6 @@ static void make_child_duplis_faces(const DupliContext *ctx, void *userdata, Obj static void make_duplis_faces(const DupliContext *ctx) { - Scene *scene = ctx->scene; Object *parent = ctx->object; bool use_texcoords = (DEG_get_mode(ctx->depsgraph) == DAG_EVAL_RENDER); FaceDupliData fdd; @@ -668,15 +672,21 @@ static void make_duplis_faces(const DupliContext *ctx) /* gather mesh info */ { BMEditMesh *em = BKE_editmesh_from_object(parent); - CustomDataMask dm_mask = (use_texcoords ? CD_MASK_BAREMESH | CD_MASK_ORCO | CD_MASK_MLOOPUV : CD_MASK_BAREMESH); /* We do not need any render-smecific handling anymore, depsgraph takes care of that. */ + /* NOTE: Do direct access to the evaluated mesh: this function is used + * during meta balls evaluation. But even without those all the objects + * which are needed for correct instancing are already evaluated. */ if (em != NULL) { /* XXX TODO replace with equivalent of editbmesh_get_eval_cage when available. */ - fdd.me_eval = mesh_get_eval_deform(ctx->depsgraph, scene, parent, dm_mask); + fdd.me_eval = parent->runtime.mesh_deform_eval; } else { - fdd.me_eval = mesh_get_eval_final(ctx->depsgraph, scene, parent, dm_mask); + fdd.me_eval = parent->runtime.mesh_eval; + } + + if (fdd.me_eval == NULL) { + return; } if (use_texcoords) { |