[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [48359] trunk/blender/source/blender/ editors/armature/meshlaplacian.c: code cleanup: when heat weighting dont loop through all polys when its not needed.

Campbell Barton ideasman42 at gmail.com
Thu Jun 28 09:18:21 CEST 2012


Revision: 48359
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48359
Author:   campbellbarton
Date:     2012-06-28 07:18:19 +0000 (Thu, 28 Jun 2012)
Log Message:
-----------
code cleanup: when heat weighting dont loop through all polys when its not needed.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/armature/meshlaplacian.c

Modified: trunk/blender/source/blender/editors/armature/meshlaplacian.c
===================================================================
--- trunk/blender/source/blender/editors/armature/meshlaplacian.c	2012-06-28 07:13:03 UTC (rev 48358)
+++ trunk/blender/source/blender/editors/armature/meshlaplacian.c	2012-06-28 07:18:19 UTC (rev 48359)
@@ -667,25 +667,27 @@
 	*err_str = NULL;
 
 	/* count triangles and create mask */
-	if (     (use_face_sel = (me->editflag & ME_EDIT_PAINT_MASK) != 0) ||
-	         (use_vert_sel = ((me->editflag & ME_EDIT_VERT_SEL) != 0)))
+	if ((use_face_sel = (me->editflag & ME_EDIT_PAINT_MASK) != 0) ||
+	    (use_vert_sel = ((me->editflag & ME_EDIT_VERT_SEL) != 0)))
 	{
 		mask = MEM_callocN(sizeof(int) * me->totvert, "heat_bone_weighting mask");
-	}
 
-	for (a = 0, mp = me->mpoly; a < me->totpoly; mp++, a++) {
 		/*  (added selectedVerts content for vertex mask, they used to just equal 1) */
 		if (use_vert_sel) {
-			for (j = 0, ml = me->mloop + mp->loopstart; j < mp->totloop; j++, ml++) {
-				if (use_vert_sel) {
-					mask[ml->v] = (mvert[ml->v].flag & SELECT) != 0;
+			for (a = 0, mp = me->mpoly; a < me->totpoly; mp++, a++) {
+				for (j = 0, ml = me->mloop + mp->loopstart; j < mp->totloop; j++, ml++) {
+					if (use_vert_sel) {
+						mask[ml->v] = (mvert[ml->v].flag & SELECT) != 0;
+					}
 				}
 			}
 		}
 		else if (use_face_sel) {
-			if (mp->flag & ME_FACE_SEL) {
-				for (j = 0, ml = me->mloop + mp->loopstart; j < mp->totloop; j++, ml++) {
-					mask[ml->v] = 1;
+			for (a = 0, mp = me->mpoly; a < me->totpoly; mp++, a++) {
+				if (mp->flag & ME_FACE_SEL) {
+					for (j = 0, ml = me->mloop + mp->loopstart; j < mp->totloop; j++, ml++) {
+						mask[ml->v] = 1;
+					}
 				}
 			}
 		}




More information about the Bf-blender-cvs mailing list