diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2012-09-23 22:50:56 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2012-09-23 22:50:56 +0400 |
commit | a42ba82f638e481d7fd3c3ed2ba05c331ef6717e (patch) | |
tree | 81a2b9221799707b49b74a5df8bb3ff964ba78bd /source/blender/bmesh | |
parent | 7afbdff1b6c348227e652e1c3071ab7ba7c91c44 (diff) | |
parent | a73dd3476e7d180d3320afc04d218ce22f2f3bfc (diff) |
Merged changes in the trunk up to revision 50829.
Conflicts resolved:
source/blender/blenloader/intern/readfile.c
source/blender/render/intern/source/convertblender.c
source/blender/render/intern/source/pipeline.c
Also addressed code inconsistency due to changes in the trunk revision 50628 (color
management with OCIO) and 50806 (UV project material). OCIO-related changes are marked
OCIO_TODO as in some other files modified in revision 50628.
Diffstat (limited to 'source/blender/bmesh')
-rw-r--r-- | source/blender/bmesh/intern/bmesh_construct.c | 2 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_core.c | 2 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_interp.c | 2 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_marking.c | 2 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_mesh.c | 6 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_mesh_conv.c | 2 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_mods.c | 2 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_operators.c | 2 | ||||
-rw-r--r-- | source/blender/bmesh/operators/bmo_create.c | 2 | ||||
-rw-r--r-- | source/blender/bmesh/operators/bmo_dissolve.c | 2 | ||||
-rw-r--r-- | source/blender/bmesh/operators/bmo_dupe.c | 2 | ||||
-rw-r--r-- | source/blender/bmesh/operators/bmo_hull.c | 4 | ||||
-rw-r--r-- | source/blender/bmesh/operators/bmo_join_triangles.c | 146 | ||||
-rw-r--r-- | source/blender/bmesh/operators/bmo_removedoubles.c | 6 | ||||
-rw-r--r-- | source/blender/bmesh/operators/bmo_wireframe.c | 2 | ||||
-rw-r--r-- | source/blender/bmesh/tools/BME_bevel.c | 10 |
16 files changed, 84 insertions, 110 deletions
diff --git a/source/blender/bmesh/intern/bmesh_construct.c b/source/blender/bmesh/intern/bmesh_construct.c index a74053a4697..691465388e9 100644 --- a/source/blender/bmesh/intern/bmesh_construct.c +++ b/source/blender/bmesh/intern/bmesh_construct.c @@ -380,7 +380,7 @@ BMFace *BM_face_create_ngon_vcloud(BMesh *bm, BMVert **vert_arr, int totv, int n } sub_v3_v3v3(far_vec, far, cent); - far_dist = len_v3(far_vec); /* real dist */ + // far_dist = len_v3(far_vec); /* real dist */ /* UNUSED */ /* --- */ diff --git a/source/blender/bmesh/intern/bmesh_core.c b/source/blender/bmesh/intern/bmesh_core.c index f03ce9b8543..ccbbb6f170b 100644 --- a/source/blender/bmesh/intern/bmesh_core.c +++ b/source/blender/bmesh/intern/bmesh_core.c @@ -836,8 +836,6 @@ static void bm_elements_systag_disable(void *veles, int tot, int flag) } } -#define FACE_MARK (1 << 10) - static int count_flagged_radial(BMesh *bm, BMLoop *l, int flag) { BMLoop *l2 = l; diff --git a/source/blender/bmesh/intern/bmesh_interp.c b/source/blender/bmesh/intern/bmesh_interp.c index 9033436d1b2..12fcd51c069 100644 --- a/source/blender/bmesh/intern/bmesh_interp.c +++ b/source/blender/bmesh/intern/bmesh_interp.c @@ -424,7 +424,7 @@ static void bm_loop_interp_mdisps(BMesh *bm, BMLoop *target, BMFace *source) float axis_x[3], axis_y[3]; /* ignore 2-edged faces */ - if (target->f->len < 3) + if (UNLIKELY(target->f->len < 3)) return; if (!CustomData_has_layer(&bm->ldata, CD_MDISPS)) diff --git a/source/blender/bmesh/intern/bmesh_marking.c b/source/blender/bmesh/intern/bmesh_marking.c index c0439311104..e4a838fe893 100644 --- a/source/blender/bmesh/intern/bmesh_marking.c +++ b/source/blender/bmesh/intern/bmesh_marking.c @@ -672,7 +672,7 @@ void BM_editselection_plane(BMEditSelection *ese, float r_plane[3]) * 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) * that vec isn't the same or in the same direction even. */ - if (efa->len < 3) { + if (UNLIKELY(efa->len < 3)) { /* crappy fallback method */ if (efa->no[0] < 0.5f) vec[0] = 1.0f; else if (efa->no[1] < 0.5f) vec[1] = 1.0f; diff --git a/source/blender/bmesh/intern/bmesh_mesh.c b/source/blender/bmesh/intern/bmesh_mesh.c index cf593627e8d..734f08142b1 100644 --- a/source/blender/bmesh/intern/bmesh_mesh.c +++ b/source/blender/bmesh/intern/bmesh_mesh.c @@ -282,7 +282,7 @@ void BM_mesh_normals_update(BMesh *bm, const short skip_hidden) if (skip_hidden && BM_elem_flag_test(v, BM_ELEM_HIDDEN)) continue; - if (normalize_v3(v->no) == 0.0f) { + if (UNLIKELY(normalize_v3(v->no) == 0.0f)) { normalize_v3_v3(v->no, v->co); } } @@ -356,7 +356,7 @@ void bmesh_edit_begin(BMesh *UNUSED(bm), int UNUSED(type_flag)) * (loop cuts, edge subdivides, etc) are not reflected in the higher levels of * the mesh at all, which doesn't seem right. Turning off completely for now, * until this is shown to be better for certain types of mesh edits. */ -#if BMOP_UNTAN_MULTIRES_ENABLED +#ifdef BMOP_UNTAN_MULTIRES_ENABLED /* switch multires data out of tangent space */ if ((type_flag & BMO_OP_FLAG_UNTAN_MULTIRES) && CustomData_has_layer(&bm->ldata, CD_MDISPS)) { bmesh_mdisps_space_set(bm, MULTIRES_SPACE_TANGENT, MULTIRES_SPACE_ABSOLUTE); @@ -374,7 +374,7 @@ void bmesh_edit_begin(BMesh *UNUSED(bm), int UNUSED(type_flag)) void bmesh_edit_end(BMesh *bm, int UNUSED(flag)) { /* BMO_OP_FLAG_UNTAN_MULTIRES disabled for now, see comment above in bmesh_edit_begin. */ -#if BMOP_UNTAN_MULTIRES_ENABLED +#ifdef BMOP_UNTAN_MULTIRES_ENABLED /* switch multires data into tangent space */ if ((flag & BMO_OP_FLAG_UNTAN_MULTIRES) && CustomData_has_layer(&bm->ldata, CD_MDISPS)) { /* set normals to their previous winding */ diff --git a/source/blender/bmesh/intern/bmesh_mesh_conv.c b/source/blender/bmesh/intern/bmesh_mesh_conv.c index 51c8b5d3bd8..e6827b1f2cd 100644 --- a/source/blender/bmesh/intern/bmesh_mesh_conv.c +++ b/source/blender/bmesh/intern/bmesh_mesh_conv.c @@ -758,7 +758,7 @@ void BM_mesh_bm_to_me(BMesh *bm, Mesh *me, int dotess) } if (!currkey) { - currkey = add_keyblock(me->key, bm->vdata.layers[i].name); + currkey = BKE_keyblock_add(me->key, bm->vdata.layers[i].name); currkey->uid = bm->vdata.layers[i].uid; } diff --git a/source/blender/bmesh/intern/bmesh_mods.c b/source/blender/bmesh/intern/bmesh_mods.c index 73e2d83520c..3195899ef01 100644 --- a/source/blender/bmesh/intern/bmesh_mods.c +++ b/source/blender/bmesh/intern/bmesh_mods.c @@ -558,7 +558,7 @@ BMEdge *BM_vert_collapse_faces(BMesh *bm, BMEdge *ke, BMVert *kv, float fac, /* cant kill data we loop on, build a list and remove those */ BLI_array_empty(bad_faces); BM_ITER_ELEM (f, &fiter, verts[i], BM_FACES_OF_VERT) { - if (f->len < 3) { + if (UNLIKELY(f->len < 3)) { BLI_array_append(bad_faces, f); } } diff --git a/source/blender/bmesh/intern/bmesh_operators.c b/source/blender/bmesh/intern/bmesh_operators.c index 53b95c97c8b..2100cd2bd0b 100644 --- a/source/blender/bmesh/intern/bmesh_operators.c +++ b/source/blender/bmesh/intern/bmesh_operators.c @@ -1253,7 +1253,7 @@ int BMO_error_occurred(BMesh *bm) return bm->errorstack.first != NULL; } -/* returns error code or 0 if no erro */ +/* returns error code or 0 if no error */ int BMO_error_get(BMesh *bm, const char **msg, BMOperator **op) { BMOpError *err = bm->errorstack.first; diff --git a/source/blender/bmesh/operators/bmo_create.c b/source/blender/bmesh/operators/bmo_create.c index 4723b631c5f..1567455e354 100644 --- a/source/blender/bmesh/operators/bmo_create.c +++ b/source/blender/bmesh/operators/bmo_create.c @@ -364,8 +364,6 @@ static void init_rotsys(BMesh *bm, EdgeData *edata, VertData *vdata) /* BLI_array_staticdeclare(verts, BM_NGON_STACK_SIZE); */ /* UNUSE */ int i; -#define SIGN(n) ((n) < 0.0f) - BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) { BMIter eiter; float no[3], cent[3]; diff --git a/source/blender/bmesh/operators/bmo_dissolve.c b/source/blender/bmesh/operators/bmo_dissolve.c index b10556af04e..84f6cb27b3b 100644 --- a/source/blender/bmesh/operators/bmo_dissolve.c +++ b/source/blender/bmesh/operators/bmo_dissolve.c @@ -484,7 +484,7 @@ void dummy_exec(BMesh *bm, BMOperator *op) /* multiply vertex edge angle by face angle * this means we are not left with sharp corners between _almost_ planer faces * convert angles [0-PI/2] -> [0-1], multiply together, then convert back to radians. */ -float bm_vert_edge_face_angle(BMVert *v) +static float bm_vert_edge_face_angle(BMVert *v) { const float angle = BM_vert_calc_edge_angle(v); /* note: could be either edge, it doesn't matter */ diff --git a/source/blender/bmesh/operators/bmo_dupe.c b/source/blender/bmesh/operators/bmo_dupe.c index 4d4d7e30a4e..32270007a0b 100644 --- a/source/blender/bmesh/operators/bmo_dupe.c +++ b/source/blender/bmesh/operators/bmo_dupe.c @@ -37,7 +37,7 @@ #define DUPE_INPUT 1 /* input from operator */ #define DUPE_NEW 2 #define DUPE_DONE 4 -#define DUPE_MAPPED 8 +// #define DUPE_MAPPED 8 // UNUSED /** * COPY VERTEX diff --git a/source/blender/bmesh/operators/bmo_hull.c b/source/blender/bmesh/operators/bmo_hull.c index 87ba216d5cf..d97d901777c 100644 --- a/source/blender/bmesh/operators/bmo_hull.c +++ b/source/blender/bmesh/operators/bmo_hull.c @@ -44,6 +44,8 @@ #include "bmesh.h" +#include "intern/bmesh_operators_private.h" /* own include */ + #define HULL_EPSILON_FLT 0.0001f /* values above 0.0001 cause errors, see below for details, don't increase * without checking against bug [#32027] */ @@ -628,7 +630,7 @@ static void hull_tag_unused(BMesh *bm, BMOperator *op) } } -void hull_tag_holes(BMesh *bm, BMOperator *op) +static void hull_tag_holes(BMesh *bm, BMOperator *op) { BMIter iter; BMOIter oiter; diff --git a/source/blender/bmesh/operators/bmo_join_triangles.c b/source/blender/bmesh/operators/bmo_join_triangles.c index d780e309118..0d8b397110e 100644 --- a/source/blender/bmesh/operators/bmo_join_triangles.c +++ b/source/blender/bmesh/operators/bmo_join_triangles.c @@ -37,11 +37,6 @@ #include "intern/bmesh_operators_private.h" /* own include */ -/* Bitflags for edges */ -#define T2QDELETE 1 -#define T2QCOMPLEX 2 -#define T2QJOIN 4 - /* assumes edges are validated before reaching this poin */ static float measure_facepair(BMVert *v1, BMVert *v2, BMVert *v3, BMVert *v4, float limit) @@ -110,93 +105,73 @@ static float measure_facepair(BMVert *v1, BMVert *v2, #define T2QUV_LIMIT 0.005f #define T2QCOL_LIMIT 3 -static int compareFaceAttribs(BMesh *bm, BMEdge *e, int douvs, int dovcols) +static int bm_edge_faces_cmp(BMesh *bm, BMEdge *e, const int do_uv, const int do_tf, const int do_vcol) { - MTexPoly *tp1, *tp2; - MLoopCol *lcol1, *lcol2, *lcol3, *lcol4; - MLoopUV *luv1, *luv2, *luv3, *luv4; - BMLoop *l1, *l2, *l3, *l4; - int mergeok_uvs = !douvs, mergeok_vcols = !dovcols; - - l1 = e->l; - l3 = e->l->radial_next; + /* first get loops */ + BMLoop *l[4]; + + l[0] = e->l; + l[2] = e->l->radial_next; - /* match up loops on each side of an edge corresponding to each ver */ - if (l1->v == l3->v) { - l2 = l1->next; - l4 = l2->next; + /* match up loops on each side of an edge corresponding to each vert */ + if (l[0]->v == l[2]->v) { + l[1] = l[0]->next; + l[3] = l[1]->next; } else { - l2 = l1->next; + l[1] = l[0]->next; - l4 = l3; - l3 = l4->next; + l[3] = l[2]; + l[2] = l[3]->next; } - lcol1 = CustomData_bmesh_get(&bm->ldata, l1->head.data, CD_MLOOPCOL); - lcol2 = CustomData_bmesh_get(&bm->ldata, l1->head.data, CD_MLOOPCOL); - lcol3 = CustomData_bmesh_get(&bm->ldata, l1->head.data, CD_MLOOPCOL); - lcol4 = CustomData_bmesh_get(&bm->ldata, l1->head.data, CD_MLOOPCOL); - - luv1 = CustomData_bmesh_get(&bm->ldata, l1->head.data, CD_MLOOPUV); - luv2 = CustomData_bmesh_get(&bm->ldata, l1->head.data, CD_MLOOPUV); - luv3 = CustomData_bmesh_get(&bm->ldata, l1->head.data, CD_MLOOPUV); - luv4 = CustomData_bmesh_get(&bm->ldata, l1->head.data, CD_MLOOPUV); - - tp1 = CustomData_bmesh_get(&bm->pdata, l1->f->head.data, CD_MTEXPOLY); - tp2 = CustomData_bmesh_get(&bm->pdata, l2->f->head.data, CD_MTEXPOLY); - - if (!lcol1) - mergeok_vcols = 1; - - if (!luv1) - mergeok_uvs = 1; - - /* compare faceedges for each face attribute. Additional per face attributes can be added late */ - - /* do VCOL */ - if (lcol1 && dovcols) { - char *cols[4] = {(char *)lcol1, (char *)lcol2, (char *)lcol3, (char *)lcol4}; - int i; - - for (i = 0; i < 3; i++) { - if (cols[0][i] + T2QCOL_LIMIT < cols[2][i] - T2QCOL_LIMIT) - break; - if (cols[1][i] + T2QCOL_LIMIT < cols[3][i] - T2QCOL_LIMIT) - break; + /* Test UV's */ + if (do_uv) { + const MLoopUV *luv[4] = { + CustomData_bmesh_get(&bm->ldata, l[0]->head.data, CD_MLOOPUV), + CustomData_bmesh_get(&bm->ldata, l[1]->head.data, CD_MLOOPUV), + CustomData_bmesh_get(&bm->ldata, l[2]->head.data, CD_MLOOPUV), + CustomData_bmesh_get(&bm->ldata, l[3]->head.data, CD_MLOOPUV), + }; + + /* do UV */ + if (luv[0] && (!compare_v2v2(luv[0]->uv, luv[2]->uv, T2QUV_LIMIT) || + !compare_v2v2(luv[1]->uv, luv[3]->uv, T2QUV_LIMIT))) + { + return FALSE; } - - if (i == 3) - mergeok_vcols = 1; } - /* do UV */ - if (luv1 && douvs) { - if (tp1->tpage != tp2->tpage) { - /* do nothing */ - } - else { - int i; + if (do_tf) { + const MTexPoly *tp[2] = { + CustomData_bmesh_get(&bm->pdata, l[0]->f->head.data, CD_MTEXPOLY), + CustomData_bmesh_get(&bm->pdata, l[1]->f->head.data, CD_MTEXPOLY), + }; - for (i = 0; i < 2; i++) { - if (luv1->uv[0] + T2QUV_LIMIT > luv3->uv[0] && luv1->uv[0] - T2QUV_LIMIT < luv3->uv[0] && - luv1->uv[1] + T2QUV_LIMIT > luv3->uv[1] && luv1->uv[1] - T2QUV_LIMIT < luv3->uv[1]) - { - if (luv2->uv[0] + T2QUV_LIMIT > luv4->uv[0] && luv2->uv[0] - T2QUV_LIMIT < luv4->uv[0] && - luv2->uv[1] + T2QUV_LIMIT > luv4->uv[1] && luv2->uv[1] - T2QUV_LIMIT < luv4->uv[1]) - { - mergeok_uvs = 1; - } - } - } + if (tp[0] && (tp[0]->tpage != tp[1]->tpage)) { + return FALSE; } } - if (douvs == mergeok_uvs && dovcols == mergeok_vcols) { - return TRUE; + /* Test Vertex Colors */ + if (do_vcol) { + const MLoopCol *lcol[4] = { + CustomData_bmesh_get(&bm->ldata, l[0]->head.data, CD_MLOOPCOL), + CustomData_bmesh_get(&bm->ldata, l[1]->head.data, CD_MLOOPCOL), + CustomData_bmesh_get(&bm->ldata, l[2]->head.data, CD_MLOOPCOL), + CustomData_bmesh_get(&bm->ldata, l[3]->head.data, CD_MLOOPCOL), + }; + + if (lcol[0]) { + if (!compare_rgb_uchar((unsigned char*)&lcol[0]->r, (unsigned char*)&lcol[2]->r, T2QCOL_LIMIT) || + !compare_rgb_uchar((unsigned char*)&lcol[1]->r, (unsigned char*)&lcol[3]->r, T2QCOL_LIMIT)) + { + return FALSE; + } + } } - return FALSE; + return TRUE; } typedef struct JoinEdge { @@ -229,11 +204,12 @@ void bmo_join_triangles_exec(BMesh *bm, BMOperator *op) BMEdge *e; BLI_array_declare(jedges); JoinEdge *jedges = NULL; - int dosharp = BMO_slot_bool_get(op, "cmp_sharp"); - int douvs = BMO_slot_bool_get(op, "cmp_uvs"); - int dovcols = BMO_slot_bool_get(op, "cmp_vcols"); - int domat = BMO_slot_bool_get(op, "cmp_materials"); - float limit = BMO_slot_float_get(op, "limit"); + int do_sharp = BMO_slot_bool_get(op, "cmp_sharp"); + int do_uv = BMO_slot_bool_get(op, "cmp_uvs"); + int do_tf = do_uv; /* texture face, make make its own option eventually */ + int do_vcol = BMO_slot_bool_get(op, "cmp_vcols"); + int do_mat = BMO_slot_bool_get(op, "cmp_materials"); + float limit = BMO_slot_float_get(op, "limit"); int i, totedge; /* flag all edges of all input face */ @@ -282,13 +258,13 @@ void bmo_join_triangles_exec(BMesh *bm, BMOperator *op) v3 = e->l->next->v; v4 = e->l->radial_next->prev->v; - if (dosharp && !BM_elem_flag_test(e, BM_ELEM_SMOOTH)) + if (do_sharp && !BM_elem_flag_test(e, BM_ELEM_SMOOTH)) continue; - - if ((douvs || dovcols) && compareFaceAttribs(bm, e, douvs, dovcols)) + + if (do_mat && f1->mat_nr != f2->mat_nr) continue; - if (domat && f1->mat_nr != f2->mat_nr) + if ((do_uv || do_tf || do_vcol) && (bm_edge_faces_cmp(bm, e, do_uv, do_tf, do_vcol) == FALSE)) continue; measure = measure_facepair(v1, v2, v3, v4, limit); diff --git a/source/blender/bmesh/operators/bmo_removedoubles.c b/source/blender/bmesh/operators/bmo_removedoubles.c index e1a5ef9f905..d3e98dd96c1 100644 --- a/source/blender/bmesh/operators/bmo_removedoubles.c +++ b/source/blender/bmesh/operators/bmo_removedoubles.c @@ -244,11 +244,11 @@ static int vergaverco(const void *e1, const void *e2) else return 0; } -#define VERT_TESTED 1 +// #define VERT_TESTED 1 // UNUSED #define VERT_DOUBLE 2 #define VERT_TARGET 4 #define VERT_KEEP 8 -#define VERT_MARK 16 +// #define VERT_MARK 16 // UNUSED #define VERT_IN 32 #define EDGE_MARK 1 @@ -487,7 +487,7 @@ void bmo_collapse_uvs_exec(BMesh *bm, BMOperator *op) } } -void bmesh_find_doubles_common(BMesh *bm, BMOperator *op, BMOperator *optarget, const char *targetmapname) +static void bmesh_find_doubles_common(BMesh *bm, BMOperator *op, BMOperator *optarget, const char *targetmapname) { BMOIter oiter; BMVert *v, *v2; diff --git a/source/blender/bmesh/operators/bmo_wireframe.c b/source/blender/bmesh/operators/bmo_wireframe.c index e0dc5cf48c7..d572a1c5863 100644 --- a/source/blender/bmesh/operators/bmo_wireframe.c +++ b/source/blender/bmesh/operators/bmo_wireframe.c @@ -34,7 +34,7 @@ #include "intern/bmesh_operators_private.h" /* own include */ -BMLoop *bm_edge_tag_faceloop(BMEdge *e) +static BMLoop *bm_edge_tag_faceloop(BMEdge *e) { BMLoop *l, *l_first; diff --git a/source/blender/bmesh/tools/BME_bevel.c b/source/blender/bmesh/tools/BME_bevel.c index 91527313972..98f270abd16 100644 --- a/source/blender/bmesh/tools/BME_bevel.c +++ b/source/blender/bmesh/tools/BME_bevel.c @@ -66,7 +66,7 @@ /* ------- Bevel code starts here -------- */ -BME_TransData_Head *BME_init_transdata(int bufsize) +static BME_TransData_Head *BME_init_transdata(int bufsize) { BME_TransData_Head *td; @@ -85,9 +85,9 @@ void BME_free_transdata(BME_TransData_Head *td) MEM_freeN(td); } -BME_TransData *BME_assign_transdata(BME_TransData_Head *td, BMesh *bm, BMVert *v, - float *co, float *org, float *vec, float *loc, - float factor, float weight, float maxfactor, float *max) +static BME_TransData *BME_assign_transdata(BME_TransData_Head *td, BMesh *bm, BMVert *v, + float *co, float *org, float *vec, float *loc, + float factor, float weight, float maxfactor, float *max) { BME_TransData *vtd; int is_new = 0; @@ -140,7 +140,7 @@ BME_TransData *BME_get_transdata(BME_TransData_Head *td, BMVert *v) } /* a hack (?) to use the transdata memarena to allocate floats for use with the max limits */ -float *BME_new_transdata_float(BME_TransData_Head *td) +static float *BME_new_transdata_float(BME_TransData_Head *td) { return BLI_memarena_alloc(td->ma, sizeof(float)); } |