[Bf-blender-cvs] [32f7b4a] master: Avoid getting the original index if its not needed

Campbell Barton noreply at git.blender.org
Fri Jul 17 21:50:41 CEST 2015


Commit: 32f7b4a3588f108c7ab4ec733ad4d97738017658
Author: Campbell Barton
Date:   Sat Jul 18 04:57:58 2015 +1000
Branches: master
https://developer.blender.org/rB32f7b4a3588f108c7ab4ec733ad4d97738017658

Avoid getting the original index if its not needed

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

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

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

diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c
index 8d91fe8..9307abc 100644
--- a/source/blender/blenkernel/intern/cdderivedmesh.c
+++ b/source/blender/blenkernel/intern/cdderivedmesh.c
@@ -636,7 +636,7 @@ static void cdDM_drawMappedFaces(
 	const MPoly *mpoly = cddm->mpoly;
 	const MLoopCol *mloopcol = NULL;
 	int colType, useColors = flag & DM_DRAW_USE_COLORS, useHide = flag & DM_DRAW_SKIP_HIDDEN;
-	int i, j, orig;
+	int i, j;
 	int start_element = 0, tot_element, tot_drawn;
 	int totpoly;
 	int tottri;
@@ -662,7 +662,7 @@ static void cdDM_drawMappedFaces(
 		if (fi_map) {
 			for (i = 0; i < totpoly; i++, mpoly++) {
 				int selcol = 0xFFFFFFFF;
-				orig = (index_mp_to_orig) ? index_mp_to_orig[i] : i;
+				const int orig = (index_mp_to_orig) ? index_mp_to_orig[i] : i;
 
 				if ((orig != ORIGINDEX_NONE) && (!useHide || !(me->mpoly[orig].flag & ME_HIDE))) {
 					WM_framebuffer_index_get(orig + 1, &selcol);
@@ -739,10 +739,13 @@ static void cdDM_drawMappedFaces(
 					if (i != totpoly - 1)
 						next_actualFace = bufmat->polys[i + 1];
 
-					orig = (index_mp_to_orig) ? index_mp_to_orig[actualFace] : actualFace;
+					if (setDrawOptions) {
+						const int orig = (index_mp_to_orig) ? index_mp_to_orig[actualFace] : actualFace;
 
-					if (setDrawOptions != NULL && (orig != ORIGINDEX_NONE))
-						draw_option = setDrawOptions(userData, orig);
+						if (orig != ORIGINDEX_NONE) {
+							draw_option = setDrawOptions(userData, orig);
+						}
+					}
 
 					if (draw_option == DM_DRAW_OPTION_STIPPLE) {
 						glEnable(GL_POLYGON_STIPPLE);




More information about the Bf-blender-cvs mailing list