[Bf-blender-cvs] [027c356e23c] master: Use direct access to evaluated mesh from instancing

Sergey Sharybin noreply at git.blender.org
Tue Feb 12 16:47:31 CET 2019


Commit: 027c356e23cb5a82d61d18616ab3267220f9ee56
Author: Sergey Sharybin
Date:   Tue Feb 12 16:00:46 2019 +0100
Branches: master
https://developer.blender.org/rB027c356e23cb5a82d61d18616ab3267220f9ee56

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.

===================================================================

M	source/blender/blenkernel/intern/object_dupli.c

===================================================================

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) {



More information about the Bf-blender-cvs mailing list