[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [52909] trunk/blender/source/blender: use htype flags as arguments to EDBM_index_arrays_init(), no functional changes.

Campbell Barton ideasman42 at gmail.com
Wed Dec 12 06:27:58 CET 2012


Revision: 52909
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=52909
Author:   campbellbarton
Date:     2012-12-12 05:27:52 +0000 (Wed, 12 Dec 2012)
Log Message:
-----------
use htype flags as arguments to EDBM_index_arrays_init(), no functional changes.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/BKE_tessmesh.h
    trunk/blender/source/blender/blenkernel/intern/editderivedmesh.c
    trunk/blender/source/blender/editors/include/ED_mesh.h
    trunk/blender/source/blender/editors/mesh/editface.c
    trunk/blender/source/blender/editors/mesh/editmesh_utils.c
    trunk/blender/source/blender/editors/mesh/mesh_navmesh.c
    trunk/blender/source/blender/editors/space_view3d/drawobject.c
    trunk/blender/source/blender/editors/space_view3d/view3d_iterators.c
    trunk/blender/source/blender/editors/space_view3d/view3d_snap.c
    trunk/blender/source/blender/editors/transform/transform_snap.c
    trunk/blender/source/blender/editors/uvedit/uvedit_ops.c
    trunk/blender/source/blender/editors/uvedit/uvedit_smart_stitch.c
    trunk/blender/source/blender/editors/uvedit/uvedit_unwrap_ops.c

Modified: trunk/blender/source/blender/blenkernel/BKE_tessmesh.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_tessmesh.h	2012-12-12 05:04:01 UTC (rev 52908)
+++ trunk/blender/source/blender/blenkernel/BKE_tessmesh.h	2012-12-12 05:27:52 UTC (rev 52909)
@@ -83,9 +83,9 @@
 	int mirr_free_arrays;
 } BMEditMesh;
 
-void BMEdit_RecalcTessellation(BMEditMesh *tm);
+void BMEdit_RecalcTessellation(BMEditMesh *em);
 BMEditMesh *BMEdit_Create(BMesh *bm, int do_tessellate);
-BMEditMesh *BMEdit_Copy(BMEditMesh *tm);
+BMEditMesh *BMEdit_Copy(BMEditMesh *em);
 BMEditMesh *BMEdit_FromObject(struct Object *ob);
 void BMEdit_Free(BMEditMesh *em);
 void BMEdit_UpdateLinkedCustomData(BMEditMesh *em);

Modified: trunk/blender/source/blender/blenkernel/intern/editderivedmesh.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/editderivedmesh.c	2012-12-12 05:04:01 UTC (rev 52908)
+++ trunk/blender/source/blender/blenkernel/intern/editderivedmesh.c	2012-12-12 05:27:52 UTC (rev 52909)
@@ -71,24 +71,24 @@
 
 BMEditMesh *BMEdit_Create(BMesh *bm, int do_tessellate)
 {
-	BMEditMesh *tm = MEM_callocN(sizeof(BMEditMesh), __func__);
+	BMEditMesh *em = MEM_callocN(sizeof(BMEditMesh), __func__);
 
-	tm->bm = bm;
+	em->bm = bm;
 	if (do_tessellate) {
-		BMEdit_RecalcTessellation(tm);
+		BMEdit_RecalcTessellation(em);
 	}
 
-	return tm;
+	return em;
 }
 
-BMEditMesh *BMEdit_Copy(BMEditMesh *tm)
+BMEditMesh *BMEdit_Copy(BMEditMesh *em)
 {
-	BMEditMesh *tm2 = MEM_callocN(sizeof(BMEditMesh), __func__);
-	*tm2 = *tm;
+	BMEditMesh *em_copy = MEM_callocN(sizeof(BMEditMesh), __func__);
+	*em_copy = *em;
 
-	tm2->derivedCage = tm2->derivedFinal = NULL;
+	em_copy->derivedCage = em_copy->derivedFinal = NULL;
 
-	tm2->bm = BM_mesh_copy(tm->bm);
+	em_copy->bm = BM_mesh_copy(em->bm);
 
 	/* The tessellation is NOT calculated on the copy here,
 	 * because currently all the callers of this function use
@@ -97,22 +97,22 @@
 	 * reasons, in that case it makes more sense to do the
 	 * tessellation only when/if that copy ends up getting
 	 * used.*/
-	tm2->looptris = NULL;
+	em_copy->looptris = NULL;
 
-	tm2->vert_index = NULL;
-	tm2->edge_index = NULL;
-	tm2->face_index = NULL;
+	em_copy->vert_index = NULL;
+	em_copy->edge_index = NULL;
+	em_copy->face_index = NULL;
 
-	return tm2;
+	return em_copy;
 }
 
-static void BMEdit_RecalcTessellation_intern(BMEditMesh *tm)
+static void BMEdit_RecalcTessellation_intern(BMEditMesh *em)
 {
 	/* use this to avoid locking pthread for _every_ polygon
 	 * and calling the fill function */
 #define USE_TESSFACE_SPEEDUP
 
-	BMesh *bm = tm->bm;
+	BMesh *bm = em->bm;
 	BMLoop *(*looptris)[3] = NULL;
 	BLI_array_declare(looptris);
 	BMIter iter, liter;
@@ -125,26 +125,26 @@
 #if 0
 	/* note, we could be clever and re-use this array but would need to ensure
 	 * its realloced at some point, for now just free it */
-	if (tm->looptris) MEM_freeN(tm->looptris);
+	if (em->looptris) MEM_freeN(em->looptris);
 
-	/* Use tm->tottri when set, this means no reallocs while transforming,
+	/* Use em->tottri when set, this means no reallocs while transforming,
 	 * (unless scanfill fails), otherwise... */
 	/* allocate the length of totfaces, avoid many small reallocs,
 	 * if all faces are tri's it will be correct, quads == 2x allocs */
-	BLI_array_reserve(looptris, (tm->tottri && tm->tottri < bm->totface * 3) ? tm->tottri : bm->totface);
+	BLI_array_reserve(looptris, (em->tottri && em->tottri < bm->totface * 3) ? em->tottri : bm->totface);
 #else
 
 	/* this means no reallocs for quad dominant models, for */
-	if ( (tm->looptris != NULL) &&
-	     (tm->tottri != 0) &&
+	if ( (em->looptris != NULL) &&
+	     (em->tottri != 0) &&
 	     /* (totrti <= bm->totface * 2) would be fine for all quads,
 	      * but in case there are some ngons, still re-use the array */
-	     (tm->tottri <= bm->totface * 3))
+	     (em->tottri <= bm->totface * 3))
 	{
-		looptris = tm->looptris;
+		looptris = em->looptris;
 	}
 	else {
-		if (tm->looptris) MEM_freeN(tm->looptris);
+		if (em->looptris) MEM_freeN(em->looptris);
 		BLI_array_reserve(looptris, bm->totface);
 	}
 
@@ -237,8 +237,8 @@
 		}
 	}
 
-	tm->tottri = i;
-	tm->looptris = looptris;
+	em->tottri = i;
+	em->looptris = looptris;
 
 #undef USE_TESSFACE_SPEEDUP
 

Modified: trunk/blender/source/blender/editors/include/ED_mesh.h
===================================================================
--- trunk/blender/source/blender/editors/include/ED_mesh.h	2012-12-12 05:04:01 UTC (rev 52908)
+++ trunk/blender/source/blender/editors/include/ED_mesh.h	2012-12-12 05:27:52 UTC (rev 52909)
@@ -86,10 +86,10 @@
 
 void EDBM_selectmode_to_scene(struct bContext *C);
 void EDBM_mesh_make(struct ToolSettings *ts, struct Scene *scene, struct Object *ob);
-void EDBM_mesh_free(struct BMEditMesh *tm);
+void EDBM_mesh_free(struct BMEditMesh *em);
 void EDBM_mesh_load(struct Object *ob);
 
-void           EDBM_index_arrays_init(struct BMEditMesh *em, int forvert, int foredge, int forface);
+void           EDBM_index_arrays_init(struct BMEditMesh *em, const char htype);
 void           EDBM_index_arrays_free(struct BMEditMesh *em);
 struct BMVert *EDBM_vert_at_index(struct BMEditMesh *em, int index);
 struct BMEdge *EDBM_edge_at_index(struct BMEditMesh *em, int index);

Modified: trunk/blender/source/blender/editors/mesh/editface.c
===================================================================
--- trunk/blender/source/blender/editors/mesh/editface.c	2012-12-12 05:04:01 UTC (rev 52908)
+++ trunk/blender/source/blender/editors/mesh/editface.c	2012-12-12 05:27:52 UTC (rev 52909)
@@ -852,7 +852,7 @@
 
 	if (em) {
 		if (skip_em_vert_array_init == FALSE) {
-			EDBM_index_arrays_init(em, 1, 0, 0);
+			EDBM_index_arrays_init(em, BM_VERT);
 		}
 	}
 

Modified: trunk/blender/source/blender/editors/mesh/editmesh_utils.c
===================================================================
--- trunk/blender/source/blender/editors/mesh/editmesh_utils.c	2012-12-12 05:04:01 UTC (rev 52908)
+++ trunk/blender/source/blender/editors/mesh/editmesh_utils.c	2012-12-12 05:27:52 UTC (rev 52909)
@@ -391,74 +391,76 @@
 	BMEdit_Free(em);
 }
 
-void EDBM_index_arrays_init(BMEditMesh *tm, int forvert, int foredge, int forface)
+void EDBM_index_arrays_init(BMEditMesh *em, const char htype)
 {
-	EDBM_index_arrays_free(tm);
+	BLI_assert((htype & ~BM_ALL_NOLOOP) == 0);
 
-	if (forvert) {
-		tm->vert_index = MEM_mallocN(sizeof(void **) * tm->bm->totvert, "tm->vert_index");
+	EDBM_index_arrays_free(em);
+
+	if (htype & BM_VERT) {
+		em->vert_index = MEM_mallocN(sizeof(void **) * em->bm->totvert, "em->vert_index");
 	}
-	if (foredge) {
-		tm->edge_index = MEM_mallocN(sizeof(void **) * tm->bm->totedge, "tm->edge_index");
+	if (htype & BM_EDGE) {
+		em->edge_index = MEM_mallocN(sizeof(void **) * em->bm->totedge, "em->edge_index");
 	}
-	if (forface) {
-		tm->face_index = MEM_mallocN(sizeof(void **) * tm->bm->totface, "tm->face_index");
+	if (htype & BM_FACE) {
+		em->face_index = MEM_mallocN(sizeof(void **) * em->bm->totface, "em->face_index");
 	}
 
 #pragma omp parallel sections
 	{
 #pragma omp section
 		{
-			if (forvert) {
-				BM_iter_as_array(tm->bm, BM_VERTS_OF_MESH, NULL, (void **)tm->vert_index, tm->bm->totvert);
+			if (htype & BM_VERT) {
+				BM_iter_as_array(em->bm, BM_VERTS_OF_MESH, NULL, (void **)em->vert_index, em->bm->totvert);
 			}
 		}
 #pragma omp section
 		{
-			if (foredge) {
-				BM_iter_as_array(tm->bm, BM_EDGES_OF_MESH, NULL, (void **)tm->edge_index, tm->bm->totedge);
+			if (htype & BM_EDGE) {
+				BM_iter_as_array(em->bm, BM_EDGES_OF_MESH, NULL, (void **)em->edge_index, em->bm->totedge);
 			}
 		}
 #pragma omp section
 		{
-			if (forface) {
-				BM_iter_as_array(tm->bm, BM_FACES_OF_MESH, NULL, (void **)tm->face_index, tm->bm->totface);
+			if (htype & BM_FACE) {
+				BM_iter_as_array(em->bm, BM_FACES_OF_MESH, NULL, (void **)em->face_index, em->bm->totface);
 			}
 		}
 	}
 }
 
-void EDBM_index_arrays_free(BMEditMesh *tm)
+void EDBM_index_arrays_free(BMEditMesh *em)
 {
-	if (tm->vert_index) {
-		MEM_freeN(tm->vert_index);
-		tm->vert_index = NULL;
+	if (em->vert_index) {
+		MEM_freeN(em->vert_index);
+		em->vert_index = NULL;
 	}
 
-	if (tm->edge_index) {
-		MEM_freeN(tm->edge_index);
-		tm->edge_index = NULL;
+	if (em->edge_index) {
+		MEM_freeN(em->edge_index);
+		em->edge_index = NULL;
 	}
 
-	if (tm->face_index) {
-		MEM_freeN(tm->face_index);
-		tm->face_index = NULL;
+	if (em->face_index) {
+		MEM_freeN(em->face_index);
+		em->face_index = NULL;
 	}
 }
 
-BMVert *EDBM_vert_at_index(BMEditMesh *tm, int index)
+BMVert *EDBM_vert_at_index(BMEditMesh *em, int index)
 {
-	return tm->vert_index && index < tm->bm->totvert ? tm->vert_index[index] : NULL;
+	return em->vert_index && index < em->bm->totvert ? em->vert_index[index] : NULL;
 }
 
-BMEdge *EDBM_edge_at_index(BMEditMesh *tm, int index)
+BMEdge *EDBM_edge_at_index(BMEditMesh *em, int index)
 {
-	return tm->edge_index && index < tm->bm->totedge ? tm->edge_index[index] : NULL;
+	return em->edge_index && index < em->bm->totedge ? em->edge_index[index] : NULL;
 }
 
-BMFace *EDBM_face_at_index(BMEditMesh *tm, int index)
+BMFace *EDBM_face_at_index(BMEditMesh *em, int index)
 {
-	return (tm->face_index && index < tm->bm->totface && index >= 0) ? tm->face_index[index] : NULL;
+	return (em->face_index && index < em->bm->totface && index >= 0) ? em->face_index[index] : NULL;
 }
 
 void EDBM_selectmode_flush_ex(BMEditMesh *em, const short selectmode)
@@ -647,7 +649,7 @@
 	int totverts, i, totuv;
 	
 	if (do_face_idx_array)
-		EDBM_index_arrays_init(em, 0, 0, 1);
+		EDBM_index_arrays_init(em, BM_FACE);
 
 	BM_mesh_elem_index_ensure(em->bm, BM_VERT);
 	
@@ -1104,7 +1106,7 @@
 	}
 
 	if (!em->vert_index) {
-		EDBM_index_arrays_init(em, 1, 0, 0);
+		EDBM_index_arrays_init(em, BM_VERT);
 		em->mirr_free_arrays = 1;
 	}
 

Modified: trunk/blender/source/blender/editors/mesh/mesh_navmesh.c
===================================================================
--- trunk/blender/source/blender/editors/mesh/mesh_navmesh.c	2012-12-12 05:04:01 UTC (rev 52908)
+++ trunk/blender/source/blender/editors/mesh/mesh_navmesh.c	2012-12-12 05:27:52 UTC (rev 52909)
@@ -375,7 +375,7 @@
 			BM_vert_create(em->bm, co, NULL, 0);
 		}
 
-		EDBM_index_arrays_init(em, 1, 0, 0);
+		EDBM_index_arrays_init(em, BM_VERT);
 
 		/* create faces */
 		for (j = 0; j < trinum; j++) {


@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list