style cleanup
This commit is contained in:
@@ -220,7 +220,7 @@ void defvert_normalize_lock(MDeformVert *dvert, const int def_nr_lock)
|
|||||||
float lock_iweight = 1.0f;
|
float lock_iweight = 1.0f;
|
||||||
|
|
||||||
for (i = dvert->totweight, dw = dvert->dw; i != 0; i--, dw++) {
|
for (i = dvert->totweight, dw = dvert->dw; i != 0; i--, dw++) {
|
||||||
if(dw->def_nr != def_nr_lock) {
|
if (dw->def_nr != def_nr_lock) {
|
||||||
tot_weight += dw->weight;
|
tot_weight += dw->weight;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -235,7 +235,7 @@ void defvert_normalize_lock(MDeformVert *dvert, const int def_nr_lock)
|
|||||||
|
|
||||||
float scalar = (1.0f / tot_weight) * lock_iweight;
|
float scalar = (1.0f / tot_weight) * lock_iweight;
|
||||||
for (i = dvert->totweight, dw = dvert->dw; i != 0; i--, dw++) {
|
for (i = dvert->totweight, dw = dvert->dw; i != 0; i--, dw++) {
|
||||||
if(dw != dw_lock) {
|
if (dw != dw_lock) {
|
||||||
dw->weight *= scalar;
|
dw->weight *= scalar;
|
||||||
|
|
||||||
/* in case of division errors with very low weights */
|
/* in case of division errors with very low weights */
|
||||||
@@ -638,7 +638,7 @@ void defvert_add_index_notest(MDeformVert *dvert, int defgroup, const float weig
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
dw_new = MEM_callocN(sizeof(MDeformWeight) * (dvert->totweight + 1), "defvert_add_to group, new deformWeight");
|
dw_new = MEM_callocN(sizeof(MDeformWeight) * (dvert->totweight + 1), "defvert_add_to group, new deformWeight");
|
||||||
if(dvert->dw) {
|
if (dvert->dw) {
|
||||||
memcpy(dw_new, dvert->dw, sizeof(MDeformWeight) * dvert->totweight);
|
memcpy(dw_new, dvert->dw, sizeof(MDeformWeight) * dvert->totweight);
|
||||||
MEM_freeN(dvert->dw);
|
MEM_freeN(dvert->dw);
|
||||||
}
|
}
|
||||||
@@ -659,7 +659,7 @@ void defvert_remove_group(MDeformVert *dvert, MDeformWeight *dw)
|
|||||||
int i = dw - dvert->dw;
|
int i = dw - dvert->dw;
|
||||||
|
|
||||||
/* Security check! */
|
/* Security check! */
|
||||||
if(i < 0 || i >= dvert->totweight) {
|
if (i < 0 || i >= dvert->totweight) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -607,9 +607,9 @@ void BM_editselection_plane(BMesh *bm, float r_plane[3], BMEditSelection *ese)
|
|||||||
* we cant make a crossvec from a vec thats the same as the vec
|
* we cant make a crossvec from a vec thats the same as the vec
|
||||||
* unlikely but possible, so make sure if the normal is (0, 0, 1)
|
* unlikely but possible, so make sure if the normal is (0, 0, 1)
|
||||||
* that vec isn't the same or in the same direction even. */
|
* that vec isn't the same or in the same direction even. */
|
||||||
if (eve->no[0] < 0.5f) vec[0] = 1.0f;
|
if (eve->no[0] < 0.5f) vec[0] = 1.0f;
|
||||||
else if (eve->no[1] < 0.5f) vec[1] = 1.0f;
|
else if (eve->no[1] < 0.5f) vec[1] = 1.0f;
|
||||||
else vec[2] = 1.0f;
|
else vec[2] = 1.0f;
|
||||||
cross_v3_v3v3(r_plane, eve->no, vec);
|
cross_v3_v3v3(r_plane, eve->no, vec);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -329,8 +329,8 @@ int BM_vert_edge_count_nonwire(BMVert *v)
|
|||||||
int count = 0;
|
int count = 0;
|
||||||
BMIter eiter;
|
BMIter eiter;
|
||||||
BMEdge *edge;
|
BMEdge *edge;
|
||||||
BM_ITER(edge, &eiter, NULL, BM_EDGES_OF_VERT, v){
|
BM_ITER(edge, &eiter, NULL, BM_EDGES_OF_VERT, v) {
|
||||||
if(edge->l) {
|
if (edge->l) {
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -467,7 +467,7 @@ static void *bmw_LoopWalker_step(BMWalker *walker)
|
|||||||
l = BM_face_other_vert_loop(owalk.f_hub, lwalk->lastv, v);
|
l = BM_face_other_vert_loop(owalk.f_hub, lwalk->lastv, v);
|
||||||
nexte = BM_edge_exists(v, l->v);
|
nexte = BM_edge_exists(v, l->v);
|
||||||
|
|
||||||
if(!BLI_ghash_haskey(walker->visithash, nexte)){
|
if (!BLI_ghash_haskey(walker->visithash, nexte)) {
|
||||||
lwalk = BMW_state_add(walker);
|
lwalk = BMW_state_add(walker);
|
||||||
lwalk->cur = nexte;
|
lwalk->cur = nexte;
|
||||||
lwalk->lastv = v;
|
lwalk->lastv = v;
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ void bmo_extrude_edge_only_exec(BMesh *bm, BMOperator *op)
|
|||||||
v3 = e->v2;
|
v3 = e->v2;
|
||||||
v4 = e->v1;
|
v4 = e->v1;
|
||||||
}
|
}
|
||||||
/* not sure what to do about example face, pass NULL for now */
|
/* not sure what to do about example face, pass NULL for now */
|
||||||
f = BM_face_create_quad_tri(bm, v1, v2, v3, v4, NULL, FALSE);
|
f = BM_face_create_quad_tri(bm, v1, v2, v3, v4, NULL, FALSE);
|
||||||
|
|
||||||
if (BMO_elem_flag_test(bm, e, EXT_INPUT))
|
if (BMO_elem_flag_test(bm, e, EXT_INPUT))
|
||||||
|
|||||||
@@ -657,7 +657,7 @@ static SubDPattern *patterns[] = {
|
|||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
#define PLEN (sizeof(patterns) / sizeof(void *))
|
#define PLEN (sizeof(patterns) / sizeof(void *))
|
||||||
|
|
||||||
typedef struct SubDFaceData {
|
typedef struct SubDFaceData {
|
||||||
BMVert *start; SubDPattern *pat;
|
BMVert *start; SubDPattern *pat;
|
||||||
|
|||||||
@@ -466,11 +466,11 @@ void bmo_vertexsmooth_exec(BMesh *bm, BMOperator *op)
|
|||||||
*/
|
*/
|
||||||
static float ngon_perimeter(BMesh *bm, BMFace *f)
|
static float ngon_perimeter(BMesh *bm, BMFace *f)
|
||||||
{
|
{
|
||||||
BMIter liter;
|
BMIter liter;
|
||||||
BMLoop *l;
|
BMLoop *l;
|
||||||
int num_verts = 0;
|
int num_verts = 0;
|
||||||
float v[3], sv[3];
|
float v[3], sv[3];
|
||||||
float perimeter = 0.0f;
|
float perimeter = 0.0f;
|
||||||
|
|
||||||
BM_ITER(l, &liter, bm, BM_LOOPS_OF_FACE, f) {
|
BM_ITER(l, &liter, bm, BM_LOOPS_OF_FACE, f) {
|
||||||
if (num_verts == 0) {
|
if (num_verts == 0) {
|
||||||
@@ -498,11 +498,11 @@ static float ngon_perimeter(BMesh *bm, BMFace *f)
|
|||||||
*/
|
*/
|
||||||
static float ngon_fake_area(BMesh *bm, BMFace *f)
|
static float ngon_fake_area(BMesh *bm, BMFace *f)
|
||||||
{
|
{
|
||||||
BMIter liter;
|
BMIter liter;
|
||||||
BMLoop *l;
|
BMLoop *l;
|
||||||
int num_verts = 0;
|
int num_verts = 0;
|
||||||
float v[3], sv[3], c[3];
|
float v[3], sv[3], c[3];
|
||||||
float area = 0.0f;
|
float area = 0.0f;
|
||||||
|
|
||||||
BM_face_center_mean_calc(bm, f, c);
|
BM_face_center_mean_calc(bm, f, c);
|
||||||
|
|
||||||
@@ -528,13 +528,13 @@ static float ngon_fake_area(BMesh *bm, BMFace *f)
|
|||||||
* extra face data (computed data)
|
* extra face data (computed data)
|
||||||
*/
|
*/
|
||||||
typedef struct SimSel_FaceExt {
|
typedef struct SimSel_FaceExt {
|
||||||
BMFace *f; /* the face */
|
BMFace *f; /* the face */
|
||||||
float c[3]; /* center */
|
float c[3]; /* center */
|
||||||
union {
|
union {
|
||||||
float area; /* area */
|
float area; /* area */
|
||||||
float perim; /* perimeter */
|
float perim; /* perimeter */
|
||||||
float d; /* 4th component of plane (the first three being the normal) */
|
float d; /* 4th component of plane (the first three being the normal) */
|
||||||
struct Image *t; /* image pointer */
|
struct Image *t; /* image pointer */
|
||||||
};
|
};
|
||||||
} SimSel_FaceExt;
|
} SimSel_FaceExt;
|
||||||
|
|
||||||
@@ -572,7 +572,7 @@ void bmo_similarfaces_exec(BMesh *bm, BMOperator *op)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* allocate memory for the selected faces indices and for all temporary faces */
|
/* allocate memory for the selected faces indices and for all temporary faces */
|
||||||
indices = (int *)MEM_callocN(sizeof(int) * num_sels, "face indices util.c");
|
indices = (int *)MEM_callocN(sizeof(int) * num_sels, "face indices util.c");
|
||||||
f_ext = (SimSel_FaceExt *)MEM_callocN(sizeof(SimSel_FaceExt) * num_total, "f_ext util.c");
|
f_ext = (SimSel_FaceExt *)MEM_callocN(sizeof(SimSel_FaceExt) * num_total, "f_ext util.c");
|
||||||
|
|
||||||
/* loop through all the faces and fill the faces/indices structure */
|
/* loop through all the faces and fill the faces/indices structure */
|
||||||
@@ -692,15 +692,15 @@ void bmo_similarfaces_exec(BMesh *bm, BMOperator *op)
|
|||||||
/**************************************************************************** *
|
/**************************************************************************** *
|
||||||
* Similar Edges
|
* Similar Edges
|
||||||
**************************************************************************** */
|
**************************************************************************** */
|
||||||
#define EDGE_MARK 1
|
#define EDGE_MARK 1
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* compute the angle of an edge (i.e. the angle between two faces)
|
* compute the angle of an edge (i.e. the angle between two faces)
|
||||||
*/
|
*/
|
||||||
static float edge_angle(BMesh *bm, BMEdge *e)
|
static float edge_angle(BMesh *bm, BMEdge *e)
|
||||||
{
|
{
|
||||||
BMIter fiter;
|
BMIter fiter;
|
||||||
BMFace *f, *f_prev = NULL;
|
BMFace *f, *f_prev = NULL;
|
||||||
|
|
||||||
/* first edge faces, don't account for 3+ */
|
/* first edge faces, don't account for 3+ */
|
||||||
|
|
||||||
@@ -719,15 +719,15 @@ static float edge_angle(BMesh *bm, BMEdge *e)
|
|||||||
* extra edge information
|
* extra edge information
|
||||||
*/
|
*/
|
||||||
typedef struct SimSel_EdgeExt {
|
typedef struct SimSel_EdgeExt {
|
||||||
BMEdge *e;
|
BMEdge *e;
|
||||||
union {
|
union {
|
||||||
float dir[3];
|
float dir[3];
|
||||||
float angle; /* angle between the face */
|
float angle; /* angle between the face */
|
||||||
};
|
};
|
||||||
|
|
||||||
union {
|
union {
|
||||||
float length; /* edge length */
|
float length; /* edge length */
|
||||||
int faces; /* faces count */
|
int faces; /* faces count */
|
||||||
};
|
};
|
||||||
} SimSel_EdgeExt;
|
} SimSel_EdgeExt;
|
||||||
|
|
||||||
@@ -738,9 +738,9 @@ typedef struct SimSel_EdgeExt {
|
|||||||
void bmo_similaredges_exec(BMesh *bm, BMOperator *op)
|
void bmo_similaredges_exec(BMesh *bm, BMOperator *op)
|
||||||
{
|
{
|
||||||
BMOIter es_iter; /* selected edges iterator */
|
BMOIter es_iter; /* selected edges iterator */
|
||||||
BMIter e_iter; /* mesh edges iterator */
|
BMIter e_iter; /* mesh edges iterator */
|
||||||
BMEdge *es; /* selected edge */
|
BMEdge *es; /* selected edge */
|
||||||
BMEdge *e; /* mesh edge */
|
BMEdge *e; /* mesh edge */
|
||||||
int idx = 0, i = 0 /* , f = 0 */;
|
int idx = 0, i = 0 /* , f = 0 */;
|
||||||
int *indices = NULL;
|
int *indices = NULL;
|
||||||
SimSel_EdgeExt *e_ext = NULL;
|
SimSel_EdgeExt *e_ext = NULL;
|
||||||
@@ -760,7 +760,7 @@ void bmo_similaredges_exec(BMesh *bm, BMOperator *op)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* allocate memory for the selected edges indices and for all temporary edges */
|
/* allocate memory for the selected edges indices and for all temporary edges */
|
||||||
indices = (int *)MEM_callocN(sizeof(int) * num_sels, "indices util.c");
|
indices = (int *)MEM_callocN(sizeof(int) * num_sels, "indices util.c");
|
||||||
e_ext = (SimSel_EdgeExt *)MEM_callocN(sizeof(SimSel_EdgeExt) * num_total, "e_ext util.c");
|
e_ext = (SimSel_EdgeExt *)MEM_callocN(sizeof(SimSel_EdgeExt) * num_total, "e_ext util.c");
|
||||||
|
|
||||||
/* loop through all the edges and fill the edges/indices structure */
|
/* loop through all the edges and fill the edges/indices structure */
|
||||||
@@ -778,7 +778,7 @@ void bmo_similaredges_exec(BMesh *bm, BMOperator *op)
|
|||||||
for (i = 0; i < num_total; i++) {
|
for (i = 0; i < num_total; i++) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case SIMEDGE_LENGTH: /* compute the length of the edge */
|
case SIMEDGE_LENGTH: /* compute the length of the edge */
|
||||||
e_ext[i].length = len_v3v3(e_ext[i].e->v1->co, e_ext[i].e->v2->co);
|
e_ext[i].length = len_v3v3(e_ext[i].e->v1->co, e_ext[i].e->v2->co);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SIMEDGE_DIR: /* compute the direction */
|
case SIMEDGE_DIR: /* compute the direction */
|
||||||
@@ -786,11 +786,11 @@ void bmo_similaredges_exec(BMesh *bm, BMOperator *op)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case SIMEDGE_FACE: /* count the faces around the edge */
|
case SIMEDGE_FACE: /* count the faces around the edge */
|
||||||
e_ext[i].faces = BM_edge_face_count(e_ext[i].e);
|
e_ext[i].faces = BM_edge_face_count(e_ext[i].e);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SIMEDGE_FACE_ANGLE:
|
case SIMEDGE_FACE_ANGLE:
|
||||||
e_ext[i].faces = BM_edge_face_count(e_ext[i].e);
|
e_ext[i].faces = BM_edge_face_count(e_ext[i].e);
|
||||||
if (e_ext[i].faces == 2)
|
if (e_ext[i].faces == 2)
|
||||||
e_ext[i].angle = edge_angle(bm, e_ext[i].e);
|
e_ext[i].angle = edge_angle(bm, e_ext[i].e);
|
||||||
break;
|
break;
|
||||||
@@ -924,7 +924,7 @@ void bmo_similarverts_exec(BMesh *bm, BMOperator *op)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* allocate memory for the selected vertices indices and for all temporary vertices */
|
/* allocate memory for the selected vertices indices and for all temporary vertices */
|
||||||
indices = (int *)MEM_mallocN(sizeof(int) * num_sels, "vertex indices");
|
indices = (int *)MEM_mallocN(sizeof(int) * num_sels, "vertex indices");
|
||||||
v_ext = (SimSel_VertExt *)MEM_mallocN(sizeof(SimSel_VertExt) * num_total, "vertex extra");
|
v_ext = (SimSel_VertExt *)MEM_mallocN(sizeof(SimSel_VertExt) * num_total, "vertex extra");
|
||||||
|
|
||||||
/* loop through all the vertices and fill the vertices/indices structure */
|
/* loop through all the vertices and fill the vertices/indices structure */
|
||||||
@@ -938,7 +938,7 @@ void bmo_similarverts_exec(BMesh *bm, BMOperator *op)
|
|||||||
switch (type) {
|
switch (type) {
|
||||||
case SIMVERT_FACE:
|
case SIMVERT_FACE:
|
||||||
/* calling BM_vert_face_count every time is time consumming, so call it only once per vertex */
|
/* calling BM_vert_face_count every time is time consumming, so call it only once per vertex */
|
||||||
v_ext[i].num_faces = BM_vert_face_count(v);
|
v_ext[i].num_faces = BM_vert_face_count(v);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SIMVERT_VGROUP:
|
case SIMVERT_VGROUP:
|
||||||
|
|||||||
@@ -1005,7 +1005,7 @@ static BMesh *BME_bevel_mesh(BMesh *bm, float value, int UNUSED(res), int option
|
|||||||
if(l2->f->len > 3)
|
if(l2->f->len > 3)
|
||||||
BM_face_split(bm, l2->f, l2->next->v, l2->prev->v, &l, l2->e, FALSE); /* clip this corner off */
|
BM_face_split(bm, l2->f, l2->next->v, l2->prev->v, &l, l2->e, FALSE); /* clip this corner off */
|
||||||
curedge = bmesh_disk_edge_next(curedge, v);
|
curedge = bmesh_disk_edge_next(curedge, v);
|
||||||
} while(curedge != v->e);
|
} while (curedge != v->e);
|
||||||
BME_Bevel_Dissolve_Disk(bm, v);
|
BME_Bevel_Dissolve_Disk(bm, v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1170,17 +1170,13 @@ static void edgetag_context_set(BMEditMesh *em, Scene *scene, BMEdge *e, int val
|
|||||||
case EDGE_MODE_TAG_CREASE:
|
case EDGE_MODE_TAG_CREASE:
|
||||||
{
|
{
|
||||||
float *crease = CustomData_bmesh_get(&em->bm->edata, e->head.data, CD_CREASE);
|
float *crease = CustomData_bmesh_get(&em->bm->edata, e->head.data, CD_CREASE);
|
||||||
|
*crease = (val) ? 1.0f : 0.0f;
|
||||||
if (val) *crease = 1.0f;
|
|
||||||
else *crease = 0.0f;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case EDGE_MODE_TAG_BEVEL:
|
case EDGE_MODE_TAG_BEVEL:
|
||||||
{
|
{
|
||||||
float *bweight = CustomData_bmesh_get(&em->bm->edata, e->head.data, CD_BWEIGHT);
|
float *bweight = CustomData_bmesh_get(&em->bm->edata, e->head.data, CD_BWEIGHT);
|
||||||
|
*bweight = (val) ? 1.0f : 0.0f;
|
||||||
if (val) *bweight = 1.0f;
|
|
||||||
else *bweight = 0.0f;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2943,7 +2943,7 @@ static float bm_edge_seg_isect(BMEdge *e, CutCurve *c, int len, char mode,
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
//threshold = 0.000001; /* tolerance for vertex intersection */
|
//threshold = 0.000001; /* tolerance for vertex intersection */
|
||||||
// XXX threshold = scene->toolsettings->select_thresh / 100;
|
// XXX threshold = scene->toolsettings->select_thresh / 100;
|
||||||
|
|
||||||
/* Get screen coords of verts */
|
/* Get screen coords of verts */
|
||||||
scr = BLI_ghash_lookup(gh, e->v1);
|
scr = BLI_ghash_lookup(gh, e->v1);
|
||||||
|
|||||||
@@ -560,7 +560,7 @@ static void undoMesh_to_editbtMesh(void *umv, void *emv, void *UNUSED(obdata))
|
|||||||
|
|
||||||
static void free_undo(void *umv)
|
static void free_undo(void *umv)
|
||||||
{
|
{
|
||||||
if (((Mesh *)umv)->key) {
|
if (((Mesh *)umv)->key) {
|
||||||
free_key(((Mesh *)umv)->key);
|
free_key(((Mesh *)umv)->key);
|
||||||
MEM_freeN(((Mesh *)umv)->key);
|
MEM_freeN(((Mesh *)umv)->key);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -183,7 +183,7 @@ static int mathutils_bmloopcol_set(BaseMathObject *bmo, int UNUSED(subtype))
|
|||||||
static int mathutils_bmloopcol_get_index(BaseMathObject *bmo, int subtype, int UNUSED(index))
|
static int mathutils_bmloopcol_get_index(BaseMathObject *bmo, int subtype, int UNUSED(index))
|
||||||
{
|
{
|
||||||
/* lazy, avoid repeteing the case statement */
|
/* lazy, avoid repeteing the case statement */
|
||||||
if(mathutils_bmloopcol_get(bmo, subtype) == -1)
|
if (mathutils_bmloopcol_get(bmo, subtype) == -1)
|
||||||
return -1;
|
return -1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -193,7 +193,7 @@ static int mathutils_bmloopcol_set_index(BaseMathObject *bmo, int subtype, int i
|
|||||||
const float f = bmo->data[index];
|
const float f = bmo->data[index];
|
||||||
|
|
||||||
/* lazy, avoid repeteing the case statement */
|
/* lazy, avoid repeteing the case statement */
|
||||||
if(mathutils_bmloopcol_get(bmo, subtype) == -1)
|
if (mathutils_bmloopcol_get(bmo, subtype) == -1)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
bmo->data[index] = f;
|
bmo->data[index] = f;
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ static PyObject *bpy_bmeditselseq_add(BPy_BMEditSelSeq *self, BPy_BMElem *value)
|
|||||||
|
|
||||||
BPY_BM_CHECK_OBJ(value);
|
BPY_BM_CHECK_OBJ(value);
|
||||||
|
|
||||||
if (self->bm != value->bm) {
|
if (self->bm != value->bm) {
|
||||||
PyErr_SetString(PyExc_ValueError,
|
PyErr_SetString(PyExc_ValueError,
|
||||||
"Element is not from this mesh");
|
"Element is not from this mesh");
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
Reference in New Issue
Block a user