[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [41605] branches/bmesh/blender/source/ blender: replace bmesh specific macros with math functions, also some pedantic formatting edits.
Campbell Barton
ideasman42 at gmail.com
Mon Nov 7 10:02:11 CET 2011
Revision: 41605
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=41605
Author: campbellbarton
Date: 2011-11-07 09:02:10 +0000 (Mon, 07 Nov 2011)
Log Message:
-----------
replace bmesh specific macros with math functions, also some pedantic formatting edits.
Modified Paths:
--------------
branches/bmesh/blender/source/blender/blenkernel/intern/BME_tools.c
branches/bmesh/blender/source/blender/blenkernel/intern/cdderivedmesh.c
branches/bmesh/blender/source/blender/blenkernel/intern/customdata.c
branches/bmesh/blender/source/blender/blenkernel/intern/editderivedbmesh.c
branches/bmesh/blender/source/blender/blenlib/intern/BLI_mempool.c
branches/bmesh/blender/source/blender/bmesh/editmesh_tools.c
branches/bmesh/blender/source/blender/bmesh/intern/bmesh_construct.c
branches/bmesh/blender/source/blender/bmesh/intern/bmesh_eulers.c
branches/bmesh/blender/source/blender/bmesh/intern/bmesh_interp.c
branches/bmesh/blender/source/blender/bmesh/intern/bmesh_marking.c
branches/bmesh/blender/source/blender/bmesh/intern/bmesh_mesh.c
branches/bmesh/blender/source/blender/bmesh/intern/bmesh_mods.c
branches/bmesh/blender/source/blender/bmesh/intern/bmesh_newcore.c
branches/bmesh/blender/source/blender/bmesh/intern/bmesh_operators.c
branches/bmesh/blender/source/blender/bmesh/intern/bmesh_polygon.c
branches/bmesh/blender/source/blender/bmesh/intern/bmesh_queries.c
branches/bmesh/blender/source/blender/bmesh/intern/bmesh_structure.c
branches/bmesh/blender/source/blender/bmesh/intern/bmesh_to_editmesh.c
branches/bmesh/blender/source/blender/bmesh/intern/bmesh_walkers.c
branches/bmesh/blender/source/blender/bmesh/intern/bmesh_walkers_impl.c
branches/bmesh/blender/source/blender/bmesh/intern/editmesh_to_bmesh.c
branches/bmesh/blender/source/blender/bmesh/intern/in-progress/BME_conversions.c
branches/bmesh/blender/source/blender/bmesh/operators/bmesh_dupeops.c
branches/bmesh/blender/source/blender/bmesh/operators/createops.c
branches/bmesh/blender/source/blender/bmesh/operators/dissolveops.c
branches/bmesh/blender/source/blender/bmesh/operators/mesh_conv.c
branches/bmesh/blender/source/blender/bmesh/operators/mirror.c
branches/bmesh/blender/source/blender/bmesh/operators/removedoubles.c
branches/bmesh/blender/source/blender/bmesh/tools/BME_bevel.c
branches/bmesh/blender/source/blender/bmesh/tools/BME_duplicate.c
branches/bmesh/blender/source/blender/bmesh/tools/BME_extrude.c
branches/bmesh/blender/source/blender/bmesh/tools/BME_weld.c
branches/bmesh/blender/source/blender/editors/mesh/bmesh_tools.c
branches/bmesh/blender/source/blender/editors/mesh/bmeshutils.c
branches/bmesh/blender/source/blender/editors/mesh/editbmesh_add.c
branches/bmesh/blender/source/blender/editors/mesh/editbmesh_bvh.c
branches/bmesh/blender/source/blender/editors/mesh/editface.c
branches/bmesh/blender/source/blender/gpu/intern/gpu_buffers.c
Modified: branches/bmesh/blender/source/blender/blenkernel/intern/BME_tools.c
===================================================================
--- branches/bmesh/blender/source/blender/blenkernel/intern/BME_tools.c 2011-11-07 07:16:30 UTC (rev 41604)
+++ branches/bmesh/blender/source/blender/blenkernel/intern/BME_tools.c 2011-11-07 09:02:10 UTC (rev 41605)
@@ -341,14 +341,14 @@
if (compare_v3v3(vtd1->org,vtd2->org,0.000001f)) {
VECSUB(vec,v2->co,v1->co);
if (len_v3(vec) < 0.000001f) {
- mul_v3_fl(vec,0);
+ zero_v3(vec);
}
return 0;
}
else {
VECSUB(vec,vtd2->org,vtd1->org);
if (len_v3(vec) < 0.000001f) {
- mul_v3_fl(vec,0);
+ zero_v3(vec);
}
return 1;
}
Modified: branches/bmesh/blender/source/blender/blenkernel/intern/cdderivedmesh.c
===================================================================
--- branches/bmesh/blender/source/blender/blenkernel/intern/cdderivedmesh.c 2011-11-07 07:16:30 UTC (rev 41604)
+++ branches/bmesh/blender/source/blender/blenkernel/intern/cdderivedmesh.c 2011-11-07 09:02:10 UTC (rev 41605)
@@ -1939,7 +1939,7 @@
for (i=0; eve; eve=BMIter_Step(&iter), i++, index++) {
MVert *mv = &mvert[i];
- VECCOPY(mv->co, eve->co);
+ copy_v3_v3(mv->co, eve->co);
BM_SetIndex(eve, i);
Modified: branches/bmesh/blender/source/blender/blenkernel/intern/customdata.c
===================================================================
--- branches/bmesh/blender/source/blender/blenkernel/intern/customdata.c 2011-11-07 07:16:30 UTC (rev 41604)
+++ branches/bmesh/blender/source/blender/blenkernel/intern/customdata.c 2011-11-07 09:02:10 UTC (rev 41605)
@@ -2336,7 +2336,8 @@
CustomData_add_layer_named(ldata, CD_MDISPS, CD_CALLOC, NULL, totloop, fdata->layers[i].name);
}
}
-void CustomData_from_bmeshpoly(CustomData *fdata, CustomData *pdata, CustomData *ldata, int total){
+void CustomData_from_bmeshpoly(CustomData *fdata, CustomData *pdata, CustomData *ldata, int total)
+{
int i;
for(i=0; i < pdata->totlayer; i++){
if(pdata->layers[i].type == CD_MTEXPOLY)
@@ -2351,7 +2352,8 @@
}
-void CustomData_bmesh_init_pool(CustomData *data, int allocsize){
+void CustomData_bmesh_init_pool(CustomData *data, int allocsize)
+{
/* Dispose old pools before calling here to avoid leaks */
BLI_assert(data->pool == NULL);
Modified: branches/bmesh/blender/source/blender/blenkernel/intern/editderivedbmesh.c
===================================================================
--- branches/bmesh/blender/source/blender/blenkernel/intern/editderivedbmesh.c 2011-11-07 07:16:30 UTC (rev 41604)
+++ branches/bmesh/blender/source/blender/blenkernel/intern/editderivedbmesh.c 2011-11-07 09:02:10 UTC (rev 41605)
@@ -542,21 +542,21 @@
BMIter iter;
BMLoop *l;
int tot = 0;
-
- cent[0] = cent[1] = cent[2] = 0.0f;
-
+
+ zero_v3(cent);
+
/*simple (and stupid) median (average) based method :/ */
if (vertexCos) {
l = BMIter_New(&iter, bm, BM_LOOPS_OF_FACE, efa);
for (; l; l=BMIter_Step(&iter)) {
- VECADD(cent, cent, vertexCos[BM_GetIndex(l->v)]);
+ add_v3_v3(cent, vertexCos[BM_GetIndex(l->v)]);
tot++;
}
} else {
l = BMIter_New(&iter, bm, BM_LOOPS_OF_FACE, efa);
for (; l; l=BMIter_Step(&iter)) {
- VECADD(cent, cent, l->v->co);
+ add_v3_v3(cent, l->v->co);
tot++;
}
}
Modified: branches/bmesh/blender/source/blender/blenlib/intern/BLI_mempool.c
===================================================================
--- branches/bmesh/blender/source/blender/blenlib/intern/BLI_mempool.c 2011-11-07 07:16:30 UTC (rev 41604)
+++ branches/bmesh/blender/source/blender/blenlib/intern/BLI_mempool.c 2011-11-07 09:02:10 UTC (rev 41605)
@@ -52,8 +52,9 @@
#include "BLI_mempool.h"
BLI_mempool *BLI_mempool_create(int esize, int tote, int pchunk,
- int use_sysmalloc, int allow_iter)
-{ BLI_mempool *pool = NULL;
+ int use_sysmalloc, int allow_iter)
+{
+ BLI_mempool *pool = NULL;
BLI_freenode *lasttail = NULL, *curnode = NULL;
int i,j, maxchunks;
char *addr;
@@ -119,7 +120,8 @@
return pool;
}
#if 0
-void *BLI_mempool_alloc(BLI_mempool *pool){
+void *BLI_mempool_alloc(BLI_mempool *pool)
+{
void *retval=NULL;
BLI_freenode *curnode=NULL;
char *addr=NULL;
@@ -165,7 +167,8 @@
}
#endif
-void *BLI_mempool_calloc(BLI_mempool *pool){
+void *BLI_mempool_calloc(BLI_mempool *pool)
+{
void *retval=NULL;
retval = BLI_mempool_alloc(pool);
BMEMSET(retval, 0, pool->esize);
@@ -173,7 +176,8 @@
}
-void BLI_mempool_free(BLI_mempool *pool, void *addr){ //doesnt protect against double frees, dont be stupid!
+void BLI_mempool_free(BLI_mempool *pool, void *addr) //doesnt protect against double frees, dont be stupid!
+{
BLI_freenode *newhead = addr;
BLI_freenode *curnode=NULL;
char *tmpaddr=NULL;
Modified: branches/bmesh/blender/source/blender/bmesh/editmesh_tools.c
===================================================================
--- branches/bmesh/blender/source/blender/bmesh/editmesh_tools.c 2011-11-07 07:16:30 UTC (rev 41604)
+++ branches/bmesh/blender/source/blender/bmesh/editmesh_tools.c 2011-11-07 09:02:10 UTC (rev 41605)
@@ -786,7 +786,7 @@
invert_m3_m3(imat,bmat);
curs= give_cursor();
- VECCOPY(cent, curs);
+ copy_v3_v3(cent, curs);
cent[0]-= G.obedit->obmat[3][0];
cent[1]-= G.obedit->obmat[3][1];
cent[2]-= G.obedit->obmat[3][2];
@@ -908,7 +908,7 @@
dvec[1]= ( (v1->co[1]- v2->co[1]) )/(steps);
dvec[2]= ( (v1->co[2]- v2->co[2]) )/(steps);
- VECCOPY(nor, G.obedit->obmat[2]);
+ copy_v3_v3(nor, G.obedit->obmat[2]);
if(nor[0]*dvec[0]+nor[1]*dvec[1]+nor[2]*dvec[2]>0.000) {
dvec[0]= -dvec[0];
@@ -1230,8 +1230,8 @@
sub_v3_v3v3(nor, edge->v1->co, edge->v2->co);
len= 0.5f*normalize_v3(nor);
- VECCOPY(nor1, edge->v1->no);
- VECCOPY(nor2, edge->v2->no);
+ copy_v3_v3(nor1, edge->v1->no);
+ copy_v3_v3(nor2, edge->v2->no);
/* cosine angle */
fac= nor[0]*nor1[0] + nor[1]*nor1[1] + nor[2]*nor1[2] ;
@@ -2259,7 +2259,8 @@
//Next two fill types are for knife exact only and are provided to allow for knifing through vertices
//This means there is no multicut!
-static void fill_quad_doublevert(EditFace *efa, int v1, int v2){
+static void fill_quad_doublevert(EditFace *efa, int v1, int v2)
+{
EditFace *hold;
/*
Depending on which two vertices have been knifed through (v1 and v2), we
@@ -2484,10 +2485,10 @@
continue;
}
if(ef->f & SELECT) {
- VECCOPY(v1mat, ef->v1->co);
- VECCOPY(v2mat, ef->v2->co);
- VECCOPY(v3mat, ef->v3->co);
- VECCOPY(v4mat, ef->v4->co);
+ copy_v3_v3(v1mat, ef->v1->co);
+ copy_v3_v3(v2mat, ef->v2->co);
+ copy_v3_v3(v3mat, ef->v3->co);
+ copy_v3_v3(v4mat, ef->v4->co);
mul_mat3_m4_v3(G.obedit->obmat, v1mat);
mul_mat3_m4_v3(G.obedit->obmat, v2mat);
mul_mat3_m4_v3(G.obedit->obmat, v3mat);
@@ -3150,7 +3151,8 @@
/* ******************** BEGIN TRIANGLE TO QUAD ************************************* */
-static float measure_facepair(EditVert *v1, EditVert *v2, EditVert *v3, EditVert *v4, float limit){
+static float measure_facepair(EditVert *v1, EditVert *v2, EditVert *v3, EditVert *v4, float limit)
+{
/*gives a 'weight' to a pair of triangles that join an edge to decide how good a join they would make*/
/*Note: this is more complicated than it needs to be and should be cleaned up...*/
@@ -3909,48 +3911,48 @@
// Edge 1 inverted
if (wrap[0] == 1 && wrap[1] == 0 && wrap[2] == 0 && wrap[3] == 0) {
fix_bevel_wrap(vec, o_v2, o_v3, o_v4, o_v1, d, no);
- VECCOPY(v1, vec);
- VECCOPY(v2, vec);
+ copy_v3_v3(v1, vec);
+ copy_v3_v3(v2, vec);
}
// Edge 2 inverted
else if (wrap[0] == 0 && wrap[1] == 1 && wrap[2] == 0 && wrap[3] == 0) {
fix_bevel_wrap(vec, o_v3, o_v4, o_v1, o_v2, d, no);
- VECCOPY(v2, vec);
- VECCOPY(v3, vec);
+ copy_v3_v3(v2, vec);
+ copy_v3_v3(v3, vec);
}
// Edge 3 inverted
else if (wrap[0] == 0 && wrap[1] == 0 && wrap[2] == 1 && wrap[3] == 0) {
fix_bevel_wrap(vec, o_v4, o_v1, o_v2, o_v3, d, no);
- VECCOPY(v3, vec);
- VECCOPY(v4, vec);
+ copy_v3_v3(v3, vec);
+ copy_v3_v3(v4, vec);
}
// Edge 4 inverted
else if (wrap[0] == 0 && wrap[1] == 0 && wrap[2] == 0 && wrap[3] == 1) {
fix_bevel_wrap(vec, o_v1, o_v2, o_v3, o_v4, d, no);
- VECCOPY(v4, vec);
- VECCOPY(v1, vec);
+ copy_v3_v3(v4, vec);
+ copy_v3_v3(v1, vec);
}
// Edge 2 and 4 inverted
else if (wrap[0] == 0 && wrap[1] == 1 && wrap[2] == 0 && wrap[3] == 1) {
add_v3_v3v3(vec, v2, v3);
mul_v3_fl(vec, 0.5);
- VECCOPY(v2, vec);
- VECCOPY(v3, vec);
+ copy_v3_v3(v2, vec);
+ copy_v3_v3(v3, vec);
add_v3_v3v3(vec, v1, v4);
mul_v3_fl(vec, 0.5);
- VECCOPY(v1, vec);
- VECCOPY(v4, vec);
+ copy_v3_v3(v1, vec);
+ copy_v3_v3(v4, vec);
}
// Edge 1 and 3 inverted
else if (wrap[0] == 1 && wrap[1] == 0 && wrap[2] == 1 && wrap[3] == 0) {
add_v3_v3v3(vec, v1, v2);
mul_v3_fl(vec, 0.5);
- VECCOPY(v1, vec);
- VECCOPY(v2, vec);
+ copy_v3_v3(v1, vec);
+ copy_v3_v3(v2, vec);
add_v3_v3v3(vec, v3, v4);
mul_v3_fl(vec, 0.5);
- VECCOPY(v3, vec);
- VECCOPY(v4, vec);
+ copy_v3_v3(v3, vec);
+ copy_v3_v3(v4, vec);
}
// Totally inverted
else if (wrap[0] == 1 && wrap[1] == 1 && wrap[2] == 1 && wrap[3] == 1) {
@@ -3958,10 +3960,10 @@
add_v3_v3v3(vec, vec, v3);
add_v3_v3v3(vec, vec, v4);
mul_v3_fl(vec, 0.25);
- VECCOPY(v1, vec);
- VECCOPY(v2, vec);
- VECCOPY(v3, vec);
- VECCOPY(v4, vec);
+ copy_v3_v3(v1, vec);
+ copy_v3_v3(v2, vec);
+ copy_v3_v3(v3, vec);
+ copy_v3_v3(v4, vec);
}
}
@@ -3976,9 +3978,9 @@
add_v3_v3v3(vec, o_v1, o_v2);
add_v3_v3v3(vec, vec, o_v3);
mul_v3_fl(vec, 1.0f/3.0f);
- VECCOPY(v1, vec);
- VECCOPY(v2, vec);
- VECCOPY(v3, vec);
+ copy_v3_v3(v1, vec);
+ copy_v3_v3(v2, vec);
+ copy_v3_v3(v3, vec);
}
}
@@ -3992,29 +3994,29 @@
efa= em->faces.first;
while (efa) {
if (efa->f1 & flag) {
- VECCOPY(v1, efa->v1->co);
- VECCOPY(v2, efa->v2->co);
- VECCOPY(v3, efa->v3->co);
- VECCOPY(no, efa->n);
+ copy_v3_v3(v1, efa->v1->co);
+ copy_v3_v3(v2, efa->v2->co);
+ copy_v3_v3(v3, efa->v3->co);
+ copy_v3_v3(no, efa->n);
if (efa->v4 == NULL) {
bevel_displace_vec(vec, v1, v2, v3, d, no);
- VECCOPY(efa->v2->co, vec);
+ copy_v3_v3(efa->v2->co, vec);
bevel_displace_vec(vec, v2, v3, v1, d, no);
- VECCOPY(efa->v3->co, vec);
+ copy_v3_v3(efa->v3->co, vec);
bevel_displace_vec(vec, v3, v1, v2, d, no);
- VECCOPY(efa->v1->co, vec);
+ copy_v3_v3(efa->v1->co, vec);
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list