[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [58509] trunk/blender/source/blender/ editors/sculpt_paint/paint_image_proj.c: fix regression in 2.68 [#36240] Painting Undo Enable Face paint Crash

Campbell Barton ideasman42 at gmail.com
Mon Jul 22 20:19:02 CEST 2013


Revision: 58509
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=58509
Author:   campbellbarton
Date:     2013-07-22 18:19:02 +0000 (Mon, 22 Jul 2013)
Log Message:
-----------
fix regression in 2.68 [#36240] Painting Undo Enable Face paint Crash

Modified Paths:
--------------
    trunk/blender/source/blender/editors/sculpt_paint/paint_image_proj.c

Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_image_proj.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_image_proj.c	2013-07-22 18:01:27 UTC (rev 58508)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_image_proj.c	2013-07-22 18:19:02 UTC (rev 58509)
@@ -2816,7 +2816,11 @@
 
 	int a, i; /* generic looping vars */
 	int image_index = -1, face_index;
-	int *mpoly_origindex;
+
+	/* double lookup */
+	const int *index_mf_to_mpoly = NULL;
+	const int *index_mp_to_orig  = NULL;
+
 	MVert *mv;
 
 	MemArena *arena; /* at the moment this is just ps->arena_mt[0], but use this to show were not multithreading */
@@ -2871,12 +2875,17 @@
 	ps->dm_totface = ps->dm->getNumTessFaces(ps->dm);
 
 	if (ps->do_face_sel) {
-		mpoly_orig = ((Mesh *)ps->ob->data)->mpoly;
-		mpoly_origindex = ps->dm->getPolyDataArray(ps->dm, CD_ORIGINDEX);
+		index_mf_to_mpoly = ps->dm->getTessFaceDataArray(ps->dm, CD_ORIGINDEX);
+		index_mp_to_orig  = ps->dm->getPolyDataArray(ps->dm, CD_ORIGINDEX);
+		if (index_mf_to_mpoly == NULL) {
+			index_mp_to_orig = NULL;
+		}
+		else {
+			mpoly_orig = ((Mesh *)ps->ob->data)->mpoly;
+		}
 	}
 	else {
 		mpoly_orig = NULL;
-		mpoly_origindex = NULL;
 	}
 
 	/* use clone mtface? */
@@ -3166,8 +3175,10 @@
 
 		if (ps->do_face_sel) {
 			int orig_index;
-			if (mpoly_origindex && ((orig_index = mpoly_origindex[face_index])) != ORIGINDEX_NONE) {
-				MPoly *mp = mpoly_orig + orig_index;
+			if (index_mp_to_orig && ((orig_index = DM_origindex_mface_mpoly(index_mf_to_mpoly, index_mp_to_orig,
+			                                                                face_index))) != ORIGINDEX_NONE)
+			{
+				MPoly *mp = &mpoly_orig[orig_index];
 				is_face_sel = ((mp->flag & ME_FACE_SEL) != 0);
 			}
 			else {




More information about the Bf-blender-cvs mailing list