[Bf-blender-cvs] [dabd6615cc0] blender2.8: Fix T58150: crash in Texture Paint after changing selection in Edit Mode.

Alexander Gavrilov noreply at git.blender.org
Fri Nov 30 15:29:56 CET 2018


Commit: dabd6615cc0ecbb82f52415e81c734ad041f7598
Author: Alexander Gavrilov
Date:   Fri Nov 30 17:10:52 2018 +0300
Branches: blender2.8
https://developer.blender.org/rBdabd6615cc0ecbb82f52415e81c734ad041f7598

Fix T58150: crash in Texture Paint after changing selection in Edit Mode.

Texture paint code was retrieving the evaluated mesh from the
original object, which isn't supposed to happen, so the cached
mesh isn't properly cleaned up by Edit Mode toggle.

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

M	source/blender/editors/sculpt_paint/paint_image_proj.c

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

diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c
index c1bf308797c..5275d899a56 100644
--- a/source/blender/editors/sculpt_paint/paint_image_proj.c
+++ b/source/blender/editors/sculpt_paint/paint_image_proj.c
@@ -3404,17 +3404,24 @@ static bool proj_paint_state_mesh_eval_init(const bContext *C, ProjPaintState *p
 	Depsgraph *depsgraph = CTX_data_depsgraph(C);
 	Object *ob = ps->ob;
 
+	Scene *scene_eval = DEG_get_evaluated_scene(depsgraph);
+	Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob);
+
+	if (scene_eval == NULL || ob_eval == NULL) {
+		return false;
+	}
+
 	/* Workaround for subsurf selection, try the display mesh first */
 	if (ps->source == PROJ_SRC_IMAGE_CAM) {
 		/* using render mesh, assume only camera was rendered from */
 		ps->me_eval = mesh_create_eval_final_render(
-		             depsgraph, ps->scene, ps->ob, ps->scene->customdata_mask | CD_MASK_MLOOPUV | CD_MASK_MTFACE);
+		             depsgraph, scene_eval, ob_eval, scene_eval->customdata_mask | CD_MASK_MLOOPUV | CD_MASK_MTFACE);
 		ps->me_eval_free = true;
 	}
 	else {
 		ps->me_eval = mesh_get_eval_final(
-		        depsgraph, ps->scene, ps->ob,
-		        ps->scene->customdata_mask | CD_MASK_MLOOPUV | CD_MASK_MTFACE | (ps->do_face_sel ? CD_MASK_ORIGINDEX : 0));
+		        depsgraph, scene_eval, ob_eval,
+		        scene_eval->customdata_mask | CD_MASK_MLOOPUV | CD_MASK_MTFACE | (ps->do_face_sel ? CD_MASK_ORIGINDEX : 0));
 		ps->me_eval_free = false;
 	}



More information about the Bf-blender-cvs mailing list