code cleanup: no functional changes

- memset(..., -1) is used incorrectly even though it worked: MOD_solidify.c - thanks Halley from IRC for noticing this. use fill_vn_i() instead.
- quiet warnings in editmesh_slide.c
- cleanup comments in bmesh and some other minor comment additions.
This commit is contained in:
Campbell Barton 2012-04-07 12:37:15 +00:00
parent 6482351ed9
commit 8fa17c5362
18 changed files with 66 additions and 66 deletions

@ -57,7 +57,7 @@ TJunctionTest(
LOD_EdgeInd collapse_edge
){
// we need to copy the egdes in e_v0v1 from the mesh
// we need to copy the edges in e_v0v1 from the mesh
// into a new buffer -> we are going to modify them
int original_size = e_v0v1.size();

@ -272,7 +272,7 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, const char *filepath
CTX_wm_menu_set(C, NULL);
}
/* this can happen when active scene was lib-linked, and doesnt exist anymore */
/* this can happen when active scene was lib-linked, and doesn't exist anymore */
if (CTX_data_scene(C)==NULL) {
CTX_data_scene_set(C, bfd->main->scene.first);
CTX_wm_screen(C)->scene= CTX_data_scene(C);
@ -472,7 +472,7 @@ static int read_undosave(bContext *C, UndoElem *uel)
char mainstr[sizeof(G.main->name)];
int success=0, fileflags;
/* This is needed so undoing/redoing doesnt crash with threaded previews going */
/* This is needed so undoing/redoing doesn't crash with threaded previews going */
WM_jobs_stop_all(CTX_wm_manager(C));
BLI_strncpy(mainstr, G.main->name, sizeof(mainstr)); /* temporal store */

@ -64,7 +64,7 @@
#define BLI_array_staticdeclare(arr, maxstatic) \
int _##arr##_count = 0; \
void *_##arr##_tmp; \
char _##arr##_static[maxstatic*sizeof(arr)]
char _##arr##_static[maxstatic * sizeof(arr)]
/* this returns the entire size of the array, including any buffering. */
@ -117,8 +117,8 @@
/* grow an array by a specified number of items */
#define BLI_array_growitems(arr, num) ( \
((void *)(arr)==NULL && (void *)(_##arr##_static) != NULL) ? \
((arr= (void*)_##arr##_static), (_##arr##_count += num)) : \
((void *)(arr) == NULL && (void *)(_##arr##_static) != NULL) ? \
((arr = (void*)_##arr##_static), (_##arr##_count += num)) : \
_bli_array_grow_items(arr, num) \
)
@ -141,7 +141,7 @@
)
#define BLI_array_reserve(arr, num) \
BLI_array_growitems(arr, num), (void)(_##arr##_count -= num)
BLI_array_growitems(arr, num), (void)(_##arr##_count -= (num))
#define BLI_array_free(arr) \
@ -159,7 +159,7 @@
/* resets the logical size of an array to zero, but doesn't
* free the memory. */
#define BLI_array_empty(arr) \
_##arr##_count=0
_##arr##_count = 0
/* set the count of the array, doesn't actually increase the allocated array
* size. don't use this unless you know what you're doing. */
@ -177,9 +177,9 @@
* same purpose as BLI_array_staticdeclare()
* but use when the max size is known ahead of time */
#define BLI_array_fixedstack_declare(arr, maxstatic, realsize, allocstr) \
char _##arr##_static[maxstatic*sizeof(*(arr))]; \
const int _##arr##_is_static= ((void *)_##arr##_static) != ( \
arr= ((realsize) <= maxstatic) ? \
char _##arr##_static[maxstatic * sizeof(*(arr))]; \
const int _##arr##_is_static = ((void *)_##arr##_static) != ( \
arr = ((realsize) <= maxstatic) ? \
(void *)_##arr##_static : \
MEM_mallocN(sizeof(*(arr)) * (realsize), allocstr) \
) \

@ -150,7 +150,7 @@ void BLI_dynstr_vappendf(DynStr *ds, const char *format, va_list args)
MEM_freeN(message);
message= NULL;
/* retval doesnt include \0 terminator */
/* retval doesn't include \0 terminator */
len= retval + 1;
}
else
@ -206,7 +206,7 @@ void BLI_dynstr_appendf(DynStr *ds, const char *format, ...)
MEM_freeN(message);
message= NULL;
/* retval doesnt include \0 terminator */
/* retval doesn't include \0 terminator */
len= retval + 1;
}
else

@ -45,7 +45,7 @@ struct Object;
* pointers. this is a requirement of mempool's method of
* iteration.
*
* hrm. it doesnt but stull works ok, remove the comment above? - campbell.
* hrm. it doesn't but stull works ok, remove the comment above? - campbell.
*/
/**
@ -55,7 +55,7 @@ struct Object;
* hold several types of data
*
* 1: The type of the element (vert, edge, loop or face)
* 2: Persistent "header" flags/markings (smooth, seam, select, hidden, ect)
* 2: Persistent "header" flags/markings (smooth, seam, select, hidden, etc)
* note that this is different from the "tool" flags.
* 3: Unique ID in the bmesh.
* 4: some elements for internal record keeping.

@ -397,7 +397,7 @@ BMFace *BM_face_create_ngon_vcloud(BMesh *bm, BMVert **vert_arr, int totv, int n
/* --- */
/* now calcualte every points angle around the normal (signed) */
/* now calculate every points angle around the normal (signed) */
vang = MEM_mallocN(sizeof(AngleIndexPair) * totv, __func__);
for (i = 0; i < totv; i++) {
@ -521,7 +521,7 @@ void BMO_remove_tagged_verts(BMesh *bm, const short oflag)
* api functions that take a filter callback.....
* and this new filter type will be for opstack flags.
* This is because the BM_remove_taggedXXX functions bypass iterator API.
* - Ops don't care about 'UI' considerations like selection state, hide state, ect.
* - Ops don't care about 'UI' considerations like selection state, hide state, etc.
* If you want to work on unhidden selections for instance,
* copy output from a 'select context' operator to another operator....
*/

@ -850,7 +850,7 @@ static int disk_is_flagged(BMVert *v, int flag)
return TRUE;
}
/* Midlevel Topology Manipulation Functions */
/* Mid-level Topology Manipulation Functions */
/**
* \brief Join Connected Faces
@ -1015,7 +1015,7 @@ BMFace *BM_faces_join(BMesh *bm, BMFace **faces, int totface, const short do_del
bm_elements_systag_disable(bm, faces, totface, _FLAG_JF);
BM_ELEM_API_FLAG_DISABLE(newf, _FLAG_JF);
/* handle multires data */
/* handle multi-res data */
if (CustomData_has_layer(&bm->ldata, CD_MDISPS)) {
l_iter = l_first = BM_FACE_FIRST_LOOP(newf);
do {
@ -1185,7 +1185,7 @@ BMFace *bmesh_sfme(BMesh *bm, BMFace *f, BMVert *v1, BMVert *v2,
f2len++;
} while ((l_iter = l_iter->next) != l_first);
/* link up the new loops into the new edges radia */
/* link up the new loops into the new edges radial */
bmesh_radial_append(e, f1loop);
bmesh_radial_append(e, f2loop);
@ -1266,13 +1266,13 @@ BMVert *bmesh_semv(BMesh *bm, BMVert *tv, BMEdge *e, BMEdge **r_e)
/* swap out tv for nv in e */
bmesh_edge_swapverts(e, tv, nv);
/* add e to nv's disk cycl */
/* add e to nv's disk cycle */
bmesh_disk_edge_append(e, nv);
/* add ne to nv's disk cycl */
/* add ne to nv's disk cycle */
bmesh_disk_edge_append(ne, nv);
/* add ne to tv's disk cycl */
/* add ne to tv's disk cycle */
bmesh_disk_edge_append(ne, tv);
/* verify disk cycle */
@ -1283,7 +1283,7 @@ BMVert *bmesh_semv(BMesh *bm, BMVert *tv, BMEdge *e, BMEdge **r_e)
edok = bmesh_disk_validate(2, nv->e, nv);
BMESH_ASSERT(edok != FALSE);
/* Split the radial cycle if presen */
/* Split the radial cycle if present */
nextl = e->l;
e->l = NULL;
if (nextl) {
@ -1305,12 +1305,12 @@ BMVert *bmesh_semv(BMesh *bm, BMVert *tv, BMEdge *e, BMEdge **r_e)
nl->next->prev = nl;
nl->v = nv;
/* assign the correct edge to the correct loo */
/* assign the correct edge to the correct loop */
if (bmesh_verts_in_edge(nl->v, nl->next->v, e)) {
nl->e = e;
l->e = ne;
/* append l into ne's rad cycl */
/* append l into ne's rad cycle */
if (!first1) {
first1 = 1;
l->radial_next = l->radial_prev = NULL;
@ -1328,7 +1328,7 @@ BMVert *bmesh_semv(BMesh *bm, BMVert *tv, BMEdge *e, BMEdge **r_e)
nl->e = ne;
l->e = e;
/* append l into ne's rad cycl */
/* append l into ne's rad cycle */
if (!first1) {
first1 = 1;
l->radial_next = l->radial_prev = NULL;
@ -1345,13 +1345,13 @@ BMVert *bmesh_semv(BMesh *bm, BMVert *tv, BMEdge *e, BMEdge **r_e)
}
/* verify length of radial cycl */
/* verify length of radial cycle */
edok = bmesh_radial_validate(radlen, e->l);
BMESH_ASSERT(edok != FALSE);
edok = bmesh_radial_validate(radlen, ne->l);
BMESH_ASSERT(edok != FALSE);
/* verify loop->v and loop->next->v pointers for */
/* verify loop->v and loop->next->v pointers for e */
for (i = 0, l = e->l; i < radlen; i++, l = l->radial_next) {
BMESH_ASSERT(l->e == e);
//BMESH_ASSERT(l->radial_next == l);
@ -1368,7 +1368,7 @@ BMVert *bmesh_semv(BMesh *bm, BMVert *tv, BMEdge *e, BMEdge **r_e)
BM_CHECK_ELEMENT(bm, l->e);
BM_CHECK_ELEMENT(bm, l->f);
}
/* verify loop->v and loop->next->v pointers for n */
/* verify loop->v and loop->next->v pointers for ne */
for (i = 0, l = ne->l; i < radlen; i++, l = l->radial_next) {
BMESH_ASSERT(l->e == ne);
// BMESH_ASSERT(l->radial_next == l);
@ -1457,19 +1457,19 @@ BMEdge *bmesh_jekv(BMesh *bm, BMEdge *ke, BMVert *kv, const short check_edge_dou
e_splice = BM_edge_exists(tv, ov);
}
/* remove oe from kv's disk cycl */
/* remove oe from kv's disk cycle */
bmesh_disk_edge_remove(oe, kv);
/* relink oe->kv to be oe->t */
/* relink oe->kv to be oe->tv */
bmesh_edge_swapverts(oe, kv, tv);
/* append oe to tv's disk cycl */
/* append oe to tv's disk cycle */
bmesh_disk_edge_append(oe, tv);
/* remove ke from tv's disk cycl */
/* remove ke from tv's disk cycle */
bmesh_disk_edge_remove(ke, tv);
/* deal with radial cycle of k */
/* deal with radial cycle of ke */
radlen = bmesh_radial_length(ke->l);
if (ke->l) {
/* first step, fix the neighboring loops of all loops in ke's radial cycl */
/* first step, fix the neighboring loops of all loops in ke's radial cycle */
for (i = 0, killoop = ke->l; i < radlen; i++, killoop = killoop->radial_next) {
/* relink loops and fix vertex pointer */
if (killoop->next->v == kv) {
@ -1484,10 +1484,10 @@ BMEdge *bmesh_jekv(BMesh *bm, BMEdge *ke, BMVert *kv, const short check_edge_dou
killoop->next = NULL;
killoop->prev = NULL;
/* fix len attribute of fac */
/* fix len attribute of face */
killoop->f->len--;
}
/* second step, remove all the hanging loops attached to k */
/* second step, remove all the hanging loops attached to ke */
radlen = bmesh_radial_length(ke->l);
if (LIKELY(radlen)) {
@ -1496,7 +1496,7 @@ BMEdge *bmesh_jekv(BMesh *bm, BMEdge *ke, BMVert *kv, const short check_edge_dou
killoop = ke->l;
/* this should be wrapped into a bme_free_radial function to be used by bmesh_KF as well.. */
/* this should be wrapped into a bme_free_radial function to be used by bmesh_KF as well... */
for (i = 0; i < radlen; i++) {
loops[i] = killoop;
killoop = killoop->radial_next;
@ -1508,7 +1508,7 @@ BMEdge *bmesh_jekv(BMesh *bm, BMEdge *ke, BMVert *kv, const short check_edge_dou
BLI_array_fixedstack_free(loops);
}
/* Validate radial cycle of o */
/* Validate radial cycle of oe */
edok = bmesh_radial_validate(radlen, oe->l);
BMESH_ASSERT(edok != FALSE);
}
@ -1519,13 +1519,13 @@ BMEdge *bmesh_jekv(BMesh *bm, BMEdge *ke, BMVert *kv, const short check_edge_dou
/* deallocate verte */
bm_kill_only_vert(bm, kv);
/* Validate disk cycle lengths of ov, tv are unchange */
/* Validate disk cycle lengths of ov, tv are unchanged */
edok = bmesh_disk_validate(valence1, ov->e, ov);
BMESH_ASSERT(edok != FALSE);
edok = bmesh_disk_validate(valence2, tv->e, tv);
BMESH_ASSERT(edok != FALSE);
/* Validate loop cycle of all faces attached to o */
/* Validate loop cycle of all faces attached to oe */
for (i = 0, l = oe->l; i < radlen; i++, l = l->radial_next) {
BMESH_ASSERT(l->e == oe);
edok = bmesh_verts_in_edge(l->v, l->next->v, oe);
@ -1559,7 +1559,7 @@ BMEdge *bmesh_jekv(BMesh *bm, BMEdge *ke, BMVert *kv, const short check_edge_dou
/**
* \brief Join Face Kill Edge (JFKE)
*
* Takes two faces joined by a single 2-manifold edge and fuses them togather.
* Takes two faces joined by a single 2-manifold edge and fuses them together.
* The edge shared by the faces must not be connected to any other edges which have
* Both faces in its radial cycle
*
@ -1581,7 +1581,7 @@ BMEdge *bmesh_jekv(BMesh *bm, BMEdge *ke, BMVert *kv, const short check_edge_dou
* before attempting to fuse \a f1 and \a f2.
*
* \note The order of arguments decides whether or not certain per-face attributes are present
* in the resultant face. For instance vertex winding, material index, smooth flags, ect are inherited
* in the resultant face. For instance vertex winding, material index, smooth flags, etc are inherited
* from \a f1, not \a f2.
*
* \return A BMFace pointer
@ -1830,7 +1830,7 @@ int bmesh_vert_separate(BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len)
l->v = verts[i];
}
#else
/* note: this is the same as the commented code above *except* that it doesnt break iterator
/* note: this is the same as the commented code above *except* that it doesn't break iterator
* by modifying data it loops over [#30632], this re-uses the 'stack' variable which is a bit
* bad practice but save alloc'ing a new array - note, the comment above is useful, keep it
* if you are tidying up code - campbell */

@ -212,7 +212,7 @@ int BM_disk_dissolve(BMesh *bm, BMVert *v)
/**
* \brief Faces Join Pair
*
* Joins two adjacent faces togather.
* Joins two adjacent faces together.
*
* Because this method calls to #BM_faces_join to do its work, if a pair
* of faces share multiple edges, the pair of faces will be joined at
@ -233,7 +233,7 @@ BMFace *BM_faces_join_pair(BMesh *bm, BMFace *f1, BMFace *f2, BMEdge *e, const s
jed = e;
if (!jed) {
BMLoop *l_first;
/* search for an edge that has both these faces in its radial cycl */
/* search for an edge that has both these faces in its radial cycle */
l1 = l_first = BM_FACE_FIRST_LOOP(f1);
do {
if (l1->radial_next->f == f2) {
@ -269,7 +269,7 @@ BMFace *BM_faces_join_pair(BMesh *bm, BMFace *f1, BMFace *f2, BMEdge *e, const s
* \brief Connect Verts, Split Face
*
* connects two verts together, automatically (if very naively) finding the
* face they both share (if there is one) and splittling it. Use this at your
* face they both share (if there is one) and splitting it. Use this at your
* own risk, as it doesn't handle the many complex cases it should (like zero-area faces,
* multiple faces, etc).
*
@ -626,12 +626,12 @@ BMVert *BM_edge_split(BMesh *bm, BMEdge *e, BMVert *v, BMEdge **r_e, float perce
SmallHash hash;
const int do_mdisp = (e->l && CustomData_has_layer(&bm->ldata, CD_MDISPS));
/* we need this for handling multire */
/* we need this for handling multi-res */
if (!r_e) {
r_e = &e_dummy;
}
/* do we have a multires layer */
/* do we have a multi-res layer */
if (do_mdisp) {
BMLoop *l;
int i;
@ -703,7 +703,7 @@ BMVert *BM_edge_split(BMesh *bm, BMEdge *e, BMVert *v, BMEdge **r_e, float perce
BM_face_verts_kill(bm, oldfaces[i]);
}
/* fix boundaries a bit, doesn't work too well quite ye */
/* fix boundaries a bit, doesn't work too well quite yet */
#if 0
for (j = 0; j < 2; j++) {
BMEdge *e1 = j ? *r_e : e;
@ -820,7 +820,7 @@ void BM_edge_rotate_calc(BMesh *bm, BMEdge *e, int ccw,
BM_edge_face_pair(e, &fa, &fb);
/* so we can use ccw variable correctly,
* otherwise we could use the egdes verts direct */
* otherwise we could use the edges verts direct */
BM_edge_ordered_verts(e, &v1, &v2);
/* we could swap the verts _or_ the faces, swapping faces
@ -853,7 +853,7 @@ int BM_edge_rotate_check(BMesh *UNUSED(bm), BMEdge *e)
lb = BM_face_other_vert_loop(fb, e->v2, e->v1);
/* check that the next vert in both faces isn't the same
* (ie - the next edge doesnt share the same faces).
* (ie - the next edge doesn't share the same faces).
* since we can't rotate usefully in this case. */
if (la->v == lb->v) {
return FALSE;

@ -765,7 +765,7 @@ void BM_loop_face_tangent(BMLoop *l, float r_tangent[3])
if (compare_v3v3(v_prev, v_next, FLT_EPSILON) == FALSE) {
float dir[3];
float nor[3]; /* for this purpose doesnt need to be normalized */
float nor[3]; /* for this purpose doesn't need to be normalized */
add_v3_v3v3(dir, v_prev, v_next);
cross_v3_v3v3(nor, v_prev, v_next);
cross_v3_v3v3(r_tangent, dir, nor);

@ -1029,7 +1029,7 @@ void bmo_edgenet_fill_exec(BMesh *bm, BMOperator *op)
* otherwise we could leave this as-is */
edge = edges[0];
/* if these are even it doesnt really matter what to do,
/* if these are even it doesn't really matter what to do,
* with consistent geometry one will be zero, the choice is clear */
if (winding[0] < winding[1]) {
v1 = verts[0];

@ -487,7 +487,7 @@ void dummy_exec(BMesh *bm, BMOperator *op)
float bm_vert_edge_face_angle(BMVert *v)
{
const float angle = BM_vert_edge_angle(v);
/*note: could be either edge, it doesnt matter */
/* note: could be either edge, it doesn't matter */
if (v->e && BM_edge_is_manifold(v->e)) {
return ((angle * ANGLE_TO_UNIT) * (BM_edge_face_angle(v->e) * ANGLE_TO_UNIT)) * UNIT_TO_ANGLE;
}

@ -243,7 +243,7 @@ void bmo_inset_exec(BMesh *bm, BMOperator *op)
bmesh_vert_separate(bm, v, &vout, &r_vout_len);
v = NULL; /* don't use again */
/* in some cases the edge doesnt split off */
/* in some cases the edge doesn't split off */
if (r_vout_len == 1) {
MEM_freeN(vout);
continue;

@ -224,10 +224,10 @@ static void vtx_slide_confirm(bContext *C, wmOperator *op)
ED_region_tag_redraw(vso->active_region);
}
static void vtx_slide_exit(const bContext *C, wmOperator *op) {
static void vtx_slide_exit(const bContext *C, wmOperator *op)
{
/* Fetch custom data */
VertexSlideOp *vso = op->customdata;
BMEditMesh *em = BMEdit_FromObject(vso->obj);
/* Clean-up the custom data */
ED_region_draw_cb_exit(vso->active_region->type, vso->draw_handle);
@ -258,7 +258,6 @@ static void vtx_slide_exit(const bContext *C, wmOperator *op) {
/* Clear the header */
ED_area_headerprint(CTX_wm_area(C), NULL);
}
static void vtx_slide_draw(const bContext *C, ARegion *UNUSED(ar), void *arg)
@ -637,7 +636,7 @@ static int edbm_vert_slide_exec(bContext *C, wmOperator *op)
}
/* Is there a starting vertex ? */
if (ese == NULL || ese->htype != BM_VERT && ese->htype != BM_EDGE) {
if ((ese == NULL) || (ese->htype != BM_VERT && ese->htype != BM_EDGE)) {
BKE_report(op->reports, RPT_ERROR_INVALID_INPUT, "Vertex Slide Error: Select a (single) vertex");
return OPERATOR_CANCELLED;
}

@ -219,7 +219,8 @@ typedef struct bPoseChannel {
short pad;
float chan_mat[4][4]; /* matrix result of loc/quat/size , and where we put deform in, see next line */
float pose_mat[4][4]; /* constraints accumulate here. in the end, pose_mat = bone->arm_mat * chan_mat */
float pose_mat[4][4]; /* constraints accumulate here. in the end, pose_mat = bone->arm_mat * chan_mat
* this matrix is object space */
float constinv[4][4]; /* inverse result of constraints.
* doesn't include effect of restposition, parent, and local transform*/

@ -70,4 +70,4 @@ int DNA_elem_offset(struct SDNA *sdna, const char *stype, const char *vartype, c
int DNA_elem_type_size(const eSDNA_Type elem_nr);
#endif
#endif /* __DNA_GENFILE_H__ */

@ -293,7 +293,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
edge_users= MEM_mallocN(sizeof(int) * numEdges, "solid_mod edges");
edge_order= MEM_mallocN(sizeof(char) * numEdges, "solid_mod eorder");
memset(edge_users, INVALID_UNUSED, sizeof(int) * numEdges);
fill_vn_i(edge_users, numEdges, INVALID_UNUSED);
for (i=0, mp=orig_mpoly; i<numFaces; i++, mp++) {
MLoop *ml;

@ -422,7 +422,7 @@ void BPy_BM_init_types_select(void)
/* utility function */
/**
* \note doesnt actually check selection.
* \note doesn't actually check selection.
*/
int BPy_BMEditSel_Assign(BPy_BMesh *self, PyObject *value)
{

@ -2433,7 +2433,7 @@ static int pyrna_prop_collection_type_check(BPy_PropertyRNA *self, PyObject *val
if (RNA_property_flag(self->prop) & PROP_NEVER_NULL) {
PyErr_Format(PyExc_TypeError,
"bpy_prop_collection[key] = value: invalid, "
"this collection doesnt support None assignment");
"this collection doesn't support None assignment");
return -1;
}
else {