[Bf-blender-cvs] [be10d6d] master: Cleanup: rename uvflag -> flag for dm drawing

Campbell Barton noreply at git.blender.org
Tue Feb 2 07:47:28 CET 2016


Commit: be10d6d3f046cc628824c372dd5f96d17cc95dbc
Author: Campbell Barton
Date:   Tue Feb 2 17:37:00 2016 +1100
Branches: master
https://developer.blender.org/rBbe10d6d3f046cc628824c372dd5f96d17cc95dbc

Cleanup: rename uvflag -> flag for dm drawing

Was called both, however this isn't mainly for uv's so just call 'flag'.
Also remove redundant NULL check.

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

M	source/blender/blenkernel/BKE_DerivedMesh.h
M	source/blender/blenkernel/intern/cdderivedmesh.c
M	source/blender/editors/space_view3d/drawmesh.c

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

diff --git a/source/blender/blenkernel/BKE_DerivedMesh.h b/source/blender/blenkernel/BKE_DerivedMesh.h
index 3eed4b5..d7d6daa 100644
--- a/source/blender/blenkernel/BKE_DerivedMesh.h
+++ b/source/blender/blenkernel/BKE_DerivedMesh.h
@@ -410,7 +410,7 @@ struct DerivedMesh {
 	void (*drawFacesTex)(DerivedMesh *dm,
 	                     DMSetDrawOptionsTex setDrawOptions,
 	                     DMCompareDrawOptions compareDrawOptions,
-	                     void *userData, DMDrawFlag uvflag);
+	                     void *userData, DMDrawFlag flag);
 
 	/** Draw all faces with GLSL materials
 	 *  o setMaterial is called for every different material nr
@@ -444,7 +444,7 @@ struct DerivedMesh {
 	void (*drawMappedFacesTex)(DerivedMesh *dm,
 	                           DMSetDrawOptionsMappedTex setDrawOptions,
 	                           DMCompareDrawOptions compareDrawOptions,
-	                           void *userData, DMDrawFlag uvflag);
+	                           void *userData, DMDrawFlag flag);
 
 	/** Draw mapped faces with GLSL materials
 	 * - setMaterial is called for every different material nr
diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c
index 0d3848f..3aa451f 100644
--- a/source/blender/blenkernel/intern/cdderivedmesh.c
+++ b/source/blender/blenkernel/intern/cdderivedmesh.c
@@ -490,7 +490,7 @@ static void cdDM_drawFacesTex_common(
         DMSetDrawOptionsTex drawParams,
         DMSetDrawOptionsMappedTex drawParamsMapped,
         DMCompareDrawOptions compareDrawOptions,
-        void *userData, DMDrawFlag uvflag)
+        void *userData, DMDrawFlag flag)
 {
 	CDDerivedMesh *cddm = (CDDerivedMesh *) dm;
 	const MPoly *mpoly = cddm->mpoly;
@@ -498,8 +498,8 @@ static void cdDM_drawFacesTex_common(
 	const  MLoopCol *mloopcol;
 	int i;
 	int colType, start_element, tot_drawn;
-	const bool use_hide = (uvflag & DM_DRAW_SKIP_HIDDEN) != 0;
-	const bool use_tface = (uvflag & DM_DRAW_USE_ACTIVE_UV) != 0;
+	const bool use_hide = (flag & DM_DRAW_SKIP_HIDDEN) != 0;
+	const bool use_tface = (flag & DM_DRAW_USE_ACTIVE_UV) != 0;
 	int totpoly;
 	int next_actualFace;
 	int mat_index;
@@ -543,7 +543,7 @@ static void cdDM_drawFacesTex_common(
 	GPU_vertex_setup(dm);
 	GPU_normal_setup(dm);
 	GPU_triangle_setup(dm);
-	if (uvflag & DM_DRAW_USE_TEXPAINT_UV)
+	if (flag & DM_DRAW_USE_TEXPAINT_UV)
 		GPU_texpaint_uv_setup(dm);
 	else
 		GPU_uv_setup(dm);
@@ -638,9 +638,9 @@ static void cdDM_drawFacesTex(
         DerivedMesh *dm,
         DMSetDrawOptionsTex setDrawOptions,
         DMCompareDrawOptions compareDrawOptions,
-        void *userData, DMDrawFlag uvflag)
+        void *userData, DMDrawFlag flag)
 {
-	cdDM_drawFacesTex_common(dm, setDrawOptions, NULL, compareDrawOptions, userData, uvflag);
+	cdDM_drawFacesTex_common(dm, setDrawOptions, NULL, compareDrawOptions, userData, flag);
 }
 
 static void cdDM_drawMappedFaces(
@@ -653,7 +653,9 @@ static void cdDM_drawMappedFaces(
 	CDDerivedMesh *cddm = (CDDerivedMesh *) dm;
 	const MPoly *mpoly = cddm->mpoly;
 	const MLoopCol *mloopcol = NULL;
-	int colType, useColors = flag & DM_DRAW_USE_COLORS, useHide = flag & DM_DRAW_SKIP_HIDDEN;
+	const bool use_colors = (flag & DM_DRAW_USE_COLORS) != 0;
+	const bool use_hide = (flag & DM_DRAW_SKIP_HIDDEN) != 0;
+	int colType;
 	int i, j;
 	int start_element = 0, tot_element, tot_drawn;
 	int totpoly;
@@ -690,7 +692,7 @@ static void cdDM_drawMappedFaces(
 					const int orig = (index_mp_to_orig) ? index_mp_to_orig[i] : i;
 					bool is_hidden;
 
-					if (useHide) {
+					if (use_hide) {
 						if (flag & DM_DRAW_SELECT_USE_EDITMODE) {
 							BMFace *efa = BM_face_at_index(bm, orig);
 							is_hidden = BM_elem_flag_test(efa, BM_ELEM_HIDDEN) != 0;
@@ -720,7 +722,7 @@ static void cdDM_drawMappedFaces(
 	else {
 		GPU_normal_setup(dm);
 
-		if (useColors) {
+		if (use_colors) {
 			colType = CD_TEXTURE_MLOOPCOL;
 			mloopcol = DM_get_loop_data_layer(dm, colType);
 			if (!mloopcol) {
@@ -732,7 +734,7 @@ static void cdDM_drawMappedFaces(
 				mloopcol = DM_get_loop_data_layer(dm, colType);
 			}
 
-			if (useColors && mloopcol) {
+			if (use_colors && mloopcol) {
 				GPU_color_setup(dm, colType);
 			}
 		}
@@ -755,7 +757,7 @@ static void cdDM_drawMappedFaces(
 			GPUBufferMaterial *bufmat = dm->drawObject->materials + mat_index;
 			DMDrawOption draw_option = DM_DRAW_OPTION_NORMAL;
 			int next_actualFace = bufmat->polys[0];
-			totpoly = useHide ? bufmat->totvisiblepolys : bufmat->totpolys;
+			totpoly = use_hide ? bufmat->totvisiblepolys : bufmat->totpolys;
 
 			tot_element = 0;
 			start_element = 0;
@@ -950,7 +952,7 @@ static void cdDM_drawMappedFacesGLSL(
 			if (!do_draw) {
 				continue;
 			}
-			else if (setDrawOptions) {
+			else /* if (setDrawOptions) */ {
 				orig = (index_mp_to_orig) ? index_mp_to_orig[lt->poly] : lt->poly;
 
 				if (orig == ORIGINDEX_NONE) {
diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c
index 5ded3a9..039cc74 100644
--- a/source/blender/editors/space_view3d/drawmesh.c
+++ b/source/blender/editors/space_view3d/drawmesh.c
@@ -971,18 +971,18 @@ static void draw_mesh_textured_old(Scene *scene, View3D *v3d, RegionView3D *rv3d
 		                    DM_DRAW_USE_COLORS | DM_DRAW_ALWAYS_SMOOTH | DM_DRAW_SKIP_HIDDEN);
 	}
 	else {
-		DMDrawFlag uvflag;
+		DMDrawFlag dm_draw_flag;
 		drawTFace_userData userData;
 
 		if (ob->mode & OB_MODE_TEXTURE_PAINT) {
-			uvflag = DM_DRAW_USE_TEXPAINT_UV;
+			dm_draw_flag = DM_DRAW_USE_TEXPAINT_UV;
 		}
 		else {
-			uvflag = DM_DRAW_USE_ACTIVE_UV;
+			dm_draw_flag = DM_DRAW_USE_ACTIVE_UV;
 		}
 
 		if ((ob->mode & OB_MODE_SCULPT) && (ob == OBACT)) {
-			uvflag |= DM_DRAW_SKIP_HIDDEN;
+			dm_draw_flag |= DM_DRAW_SKIP_HIDDEN;
 		}
 
 
@@ -994,7 +994,7 @@ static void draw_mesh_textured_old(Scene *scene, View3D *v3d, RegionView3D *rv3d
 
 			dm->drawMappedFacesTex(
 			        dm, me->mpoly ? draw_tface_mapped__set_draw : NULL, compareDrawOptions,
-			        &userData, uvflag);
+			        &userData, dm_draw_flag);
 		}
 		else {
 			userData.me = NULL;
@@ -1002,7 +1002,7 @@ static void draw_mesh_textured_old(Scene *scene, View3D *v3d, RegionView3D *rv3d
 			update_tface_color_layer(dm, !(ob->mode & OB_MODE_TEXTURE_PAINT));
 			dm->drawFacesTex(
 			        dm, draw_tface__set_draw, compareDrawOptions,
-			        &userData, uvflag);
+			        &userData, dm_draw_flag);
 		}
 	}




More information about the Bf-blender-cvs mailing list