[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [52562] trunk/blender/source: fix [#33303] face selection masking for painting does not work with mesh with n-gon

Campbell Barton ideasman42 at gmail.com
Mon Nov 26 11:15:35 CET 2012


Revision: 52562
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=52562
Author:   campbellbarton
Date:     2012-11-26 10:15:32 +0000 (Mon, 26 Nov 2012)
Log Message:
-----------
fix [#33303] face selection masking for painting does not work with mesh with n-gon
caused by own change to how origindex is used, now if mpoly's CD_ORIGINDEX array is missing its assumes that its the original mpoly array.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/BKE_DerivedMesh.h
    trunk/blender/source/blender/blenkernel/intern/cdderivedmesh.c
    trunk/blender/source/blender/blenkernel/intern/particle.c
    trunk/blender/source/blender/editors/sculpt_paint/paint_utils.c
    trunk/blender/source/blender/render/intern/source/convertblender.c
    trunk/blender/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp

Modified: trunk/blender/source/blender/blenkernel/BKE_DerivedMesh.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_DerivedMesh.h	2012-11-26 09:46:15 UTC (rev 52561)
+++ trunk/blender/source/blender/blenkernel/BKE_DerivedMesh.h	2012-11-26 10:15:32 UTC (rev 52562)
@@ -709,10 +709,16 @@
 void DM_debug_print_cdlayers(CustomData *cdata);
 #endif
 
+#ifdef __GNUC__
 BLI_INLINE int DM_origindex_mface_mpoly(const int *index_mf_to_mpoly, const int *index_mp_to_orig, const int i)
+	__attribute__((nonnull(1)))
+;
+#endif
+
+BLI_INLINE int DM_origindex_mface_mpoly(const int *index_mf_to_mpoly, const int *index_mp_to_orig, const int i)
 {
 	const int j = index_mf_to_mpoly[i];
-	return (j != ORIGINDEX_NONE) ? index_mp_to_orig[j] : ORIGINDEX_NONE;
+	return (j != ORIGINDEX_NONE) ? (index_mp_to_orig ? index_mp_to_orig[j] : j) : ORIGINDEX_NONE;
 }
 
 #endif

Modified: trunk/blender/source/blender/blenkernel/intern/cdderivedmesh.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/cdderivedmesh.c	2012-11-26 09:46:15 UTC (rev 52561)
+++ trunk/blender/source/blender/blenkernel/intern/cdderivedmesh.c	2012-11-26 10:15:32 UTC (rev 52562)
@@ -623,8 +623,8 @@
 	/* double lookup */
 	const int *index_mf_to_mpoly = dm->getTessFaceDataArray(dm, CD_ORIGINDEX);
 	const int *index_mp_to_orig  = dm->getPolyDataArray(dm, CD_ORIGINDEX);
-	if ((index_mf_to_mpoly && index_mp_to_orig) == FALSE) {
-		index_mf_to_mpoly = index_mp_to_orig = NULL;
+	if (index_mf_to_mpoly == NULL) {
+		index_mp_to_orig = NULL;
 	}
 
 	colType = CD_TEXTURE_MCOL;
@@ -812,8 +812,8 @@
 	/* double lookup */
 	const int *index_mf_to_mpoly = dm->getTessFaceDataArray(dm, CD_ORIGINDEX);
 	const int *index_mp_to_orig  = dm->getPolyDataArray(dm, CD_ORIGINDEX);
-	if ((index_mf_to_mpoly && index_mp_to_orig) == FALSE) {
-		index_mf_to_mpoly = index_mp_to_orig = NULL;
+	if (index_mf_to_mpoly == NULL) {
+		index_mp_to_orig = NULL;
 	}
 
 
@@ -1048,8 +1048,8 @@
 	/* double lookup */
 	const int *index_mf_to_mpoly = dm->getTessFaceDataArray(dm, CD_ORIGINDEX);
 	const int *index_mp_to_orig  = dm->getPolyDataArray(dm, CD_ORIGINDEX);
-	if ((index_mf_to_mpoly && index_mp_to_orig) == FALSE) {
-		index_mf_to_mpoly = index_mp_to_orig = NULL;
+	if (index_mf_to_mpoly == NULL) {
+		index_mp_to_orig = NULL;
 	}
 
 	cdDM_update_normals_from_pbvh(dm);
@@ -1349,8 +1349,8 @@
 	/* double lookup */
 	const int *index_mf_to_mpoly = dm->getTessFaceDataArray(dm, CD_ORIGINDEX);
 	const int *index_mp_to_orig  = dm->getPolyDataArray(dm, CD_ORIGINDEX);
-	if ((index_mf_to_mpoly && index_mp_to_orig) == FALSE) {
-		index_mf_to_mpoly = index_mp_to_orig = NULL;
+	if (index_mf_to_mpoly == NULL) {
+		index_mp_to_orig = NULL;
 	}
 
 	cdDM_update_normals_from_pbvh(dm);

Modified: trunk/blender/source/blender/blenkernel/intern/particle.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/particle.c	2012-11-26 09:46:15 UTC (rev 52561)
+++ trunk/blender/source/blender/blenkernel/intern/particle.c	2012-11-26 10:15:32 UTC (rev 52562)
@@ -822,8 +822,8 @@
 
 	index_mf_to_mpoly = dm->getTessFaceDataArray(dm, CD_ORIGINDEX);
 	index_mp_to_orig  = dm->getPolyDataArray(dm, CD_ORIGINDEX);
-	if ((index_mf_to_mpoly && index_mp_to_orig) == FALSE) {
-		index_mf_to_mpoly = index_mp_to_orig = NULL;
+	if (index_mf_to_mpoly == NULL) {
+		index_mp_to_orig = NULL;
 	}
 
 	facearea = MEM_callocN(sizeof(float) * totorigface, "SimplifyFaceArea");
@@ -1645,8 +1645,8 @@
 	/* double lookup */
 	const int *index_mf_to_mpoly = dm->getTessFaceDataArray(dm, CD_ORIGINDEX);
 	const int *index_mp_to_orig  = dm->getPolyDataArray(dm, CD_ORIGINDEX);
-	if ((index_mf_to_mpoly && index_mp_to_orig) == FALSE) {
-		index_mf_to_mpoly = index_mp_to_orig = NULL;
+	if (index_mf_to_mpoly == NULL) {
+		index_mp_to_orig = NULL;
 	}
 
 	mpoly = dm->getPolyArray(dm);

Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_utils.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_utils.c	2012-11-26 09:46:15 UTC (rev 52561)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_utils.c	2012-11-26 10:15:32 UTC (rev 52562)
@@ -257,8 +257,8 @@
 	/* double lookup */
 	const int *index_mf_to_mpoly = dm->getTessFaceDataArray(dm, CD_ORIGINDEX);
 	const int *index_mp_to_orig  = dm->getPolyDataArray(dm, CD_ORIGINDEX);
-	if ((index_mf_to_mpoly && index_mp_to_orig) == FALSE) {
-		index_mf_to_mpoly = index_mp_to_orig = NULL;
+	if (index_mf_to_mpoly == NULL) {
+		index_mp_to_orig = NULL;
 	}
 
 	minabsw = 1e10;

Modified: trunk/blender/source/blender/render/intern/source/convertblender.c
===================================================================
--- trunk/blender/source/blender/render/intern/source/convertblender.c	2012-11-26 09:46:15 UTC (rev 52561)
+++ trunk/blender/source/blender/render/intern/source/convertblender.c	2012-11-26 10:15:32 UTC (rev 52562)
@@ -1707,8 +1707,8 @@
 			totface= psmd->dm->getNumTessFaces(psmd->dm);
 			index_mf_to_mpoly = psmd->dm->getTessFaceDataArray(psmd->dm, CD_ORIGINDEX);
 			index_mp_to_orig = psmd->dm->getPolyDataArray(psmd->dm, CD_ORIGINDEX);
-			if ((index_mf_to_mpoly && index_mp_to_orig) == FALSE) {
-				index_mf_to_mpoly = index_mp_to_orig = NULL;
+			if (index_mf_to_mpoly == NULL) {
+				index_mp_to_orig = NULL;
 			}
 			for (a=0; a<totface; a++)
 				strandbuf->totbound = max_ii(strandbuf->totbound, (index_mf_to_mpoly) ? DM_origindex_mface_mpoly(index_mf_to_mpoly, index_mp_to_orig, a): a);

Modified: trunk/blender/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
===================================================================
--- trunk/blender/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp	2012-11-26 09:46:15 UTC (rev 52561)
+++ trunk/blender/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp	2012-11-26 10:15:32 UTC (rev 52562)
@@ -1507,8 +1507,8 @@
 	/* double lookup */
 	const int *index_mf_to_mpoly = (const int *)dm->getTessFaceDataArray(dm, CD_ORIGINDEX);
 	const int *index_mp_to_orig  = (const int *)dm->getPolyDataArray(dm, CD_ORIGINDEX);
-	if ((index_mf_to_mpoly && index_mp_to_orig) == false) {
-		index_mf_to_mpoly = index_mp_to_orig = NULL;
+	if (index_mf_to_mpoly == NULL) {
+		index_mp_to_orig = NULL;
 	}
 
 	m_shapeType = (polytope) ? PHY_SHAPE_POLYTOPE : PHY_SHAPE_MESH;
@@ -1816,8 +1816,8 @@
 		/* double lookup */
 		const int *index_mf_to_mpoly = (const int *)dm->getTessFaceDataArray(dm, CD_ORIGINDEX);
 		const int *index_mp_to_orig  = (const int *)dm->getPolyDataArray(dm, CD_ORIGINDEX);
-		if ((index_mf_to_mpoly && index_mp_to_orig) == false) {
-			index_mf_to_mpoly = index_mp_to_orig = NULL;
+		if (index_mf_to_mpoly == NULL) {
+			index_mp_to_orig = NULL;
 		}
 
 		MFace *mf;




More information about the Bf-blender-cvs mailing list