Revision: 44054 http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=44054 Author: campbellbarton Date: 2012-02-12 11:39:40 +0000 (Sun, 12 Feb 2012) Log Message: ----------- prefix bmesh operator files with bmo_ (otherwise adding breakpoints in files like utils.c can be a pain).
also remove bmesh_filters.h which wasnt used. Modified Paths: -------------- branches/bmesh/blender/source/blender/bmesh/CMakeLists.txt branches/bmesh/blender/source/blender/bmesh/bmesh.h Added Paths: ----------- branches/bmesh/blender/source/blender/bmesh/operators/bmo_bevel.c branches/bmesh/blender/source/blender/bmesh/operators/bmo_connect.c branches/bmesh/blender/source/blender/bmesh/operators/bmo_create.c branches/bmesh/blender/source/blender/bmesh/operators/bmo_dissolve.c branches/bmesh/blender/source/blender/bmesh/operators/bmo_dupe.c branches/bmesh/blender/source/blender/bmesh/operators/bmo_edgesplit.c branches/bmesh/blender/source/blender/bmesh/operators/bmo_extrude.c branches/bmesh/blender/source/blender/bmesh/operators/bmo_join_triangles.c branches/bmesh/blender/source/blender/bmesh/operators/bmo_mesh_conv.c branches/bmesh/blender/source/blender/bmesh/operators/bmo_mirror.c branches/bmesh/blender/source/blender/bmesh/operators/bmo_primitive.c branches/bmesh/blender/source/blender/bmesh/operators/bmo_removedoubles.c branches/bmesh/blender/source/blender/bmesh/operators/bmo_subdivide.c branches/bmesh/blender/source/blender/bmesh/operators/bmo_subdivide.h branches/bmesh/blender/source/blender/bmesh/operators/bmo_triangulate.c branches/bmesh/blender/source/blender/bmesh/operators/bmo_utils.c Removed Paths: ------------- branches/bmesh/blender/source/blender/bmesh/bmesh_filters.h branches/bmesh/blender/source/blender/bmesh/operators/bevel.c branches/bmesh/blender/source/blender/bmesh/operators/bmesh_dupeops.c branches/bmesh/blender/source/blender/bmesh/operators/connectops.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/edgesplitop.c branches/bmesh/blender/source/blender/bmesh/operators/extrudeops.c branches/bmesh/blender/source/blender/bmesh/operators/join_triangles.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/primitiveops.c branches/bmesh/blender/source/blender/bmesh/operators/removedoubles.c branches/bmesh/blender/source/blender/bmesh/operators/subdivideop.c branches/bmesh/blender/source/blender/bmesh/operators/subdivideop.h branches/bmesh/blender/source/blender/bmesh/operators/triangulateop.c branches/bmesh/blender/source/blender/bmesh/operators/utils.c Modified: branches/bmesh/blender/source/blender/bmesh/CMakeLists.txt =================================================================== --- branches/bmesh/blender/source/blender/bmesh/CMakeLists.txt 2012-02-12 11:27:51 UTC (rev 44053) +++ branches/bmesh/blender/source/blender/bmesh/CMakeLists.txt 2012-02-12 11:39:40 UTC (rev 44054) @@ -63,24 +63,23 @@ ) set(SRC - operators/bevel.c - operators/bmesh_dupeops.c - operators/utils.c - operators/subdivideop.c - operators/connectops.c - operators/removedoubles.c - operators/mirror.c - operators/primitiveops.c - operators/join_triangles.c - operators/edgesplitop.c - operators/createops.c - operators/dissolveops.c - operators/subdivideop.h - operators/triangulateop.c - operators/mesh_conv.c - operators/extrudeops.c - bmesh_operators.h - bmesh_iterators.h + operators/bmo_bevel.c + operators/bmo_connect.c + operators/bmo_create.c + operators/bmo_dissolve.c + operators/bmo_dupe.c + operators/bmo_edgesplit.c + operators/bmo_extrude.c + operators/bmo_join_triangles.c + operators/bmo_mesh_conv.c + operators/bmo_mirror.c + operators/bmo_primitive.c + operators/bmo_removedoubles.c + operators/bmo_subdivide.c + operators/bmo_subdivide.h + operators/bmo_triangulate.c + operators/bmo_utils.c + intern/bmesh_newcore.c intern/bmesh_interp.c intern/bmesh_iterators.c @@ -102,14 +101,16 @@ intern/bmesh_walkers_impl.c intern/bmesh_walkers_private.h intern/bmesh_inline.c + tools/BME_bevel.c + bmesh.h + bmesh_class.h bmesh_error.h - bmesh_queries.h - bmesh.h + bmesh_iterators.h bmesh_marking.h bmesh_operator_api.h - bmesh_filters.h - bmesh_class.h + bmesh_operators.h + bmesh_queries.h bmesh_walkers.h ) Modified: branches/bmesh/blender/source/blender/bmesh/bmesh.h =================================================================== --- branches/bmesh/blender/source/blender/bmesh/bmesh.h 2012-02-12 11:27:51 UTC (rev 44053) +++ branches/bmesh/blender/source/blender/bmesh/bmesh.h 2012-02-12 11:39:40 UTC (rev 44054) @@ -355,7 +355,6 @@ #define BM_NGON_MAX 100000 /* include the rest of the API */ -#include "bmesh_filters.h" #include "bmesh_marking.h" #include "bmesh_operator_api.h" #include "bmesh_operators.h" Deleted: branches/bmesh/blender/source/blender/bmesh/bmesh_filters.h =================================================================== --- branches/bmesh/blender/source/blender/bmesh/bmesh_filters.h 2012-02-12 11:27:51 UTC (rev 44053) +++ branches/bmesh/blender/source/blender/bmesh/bmesh_filters.h 2012-02-12 11:39:40 UTC (rev 44054) @@ -1,26 +0,0 @@ -/* - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Contributor(s): Joseph Eagar. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef BM_FILTER_H -#define BM_FILTER_H - -#endif Deleted: branches/bmesh/blender/source/blender/bmesh/operators/bevel.c =================================================================== --- branches/bmesh/blender/source/blender/bmesh/operators/bevel.c 2012-02-12 11:27:51 UTC (rev 44053) +++ branches/bmesh/blender/source/blender/bmesh/operators/bevel.c 2012-02-12 11:39:40 UTC (rev 44054) @@ -1,862 +0,0 @@ -/* - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Contributor(s): Joseph Eagar. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "MEM_guardedalloc.h" - -#include "BLI_array.h" -#include "BLI_math.h" -#include "BLI_smallhash.h" - -#include "BKE_customdata.h" - -#include "bmesh.h" - -#define BEVEL_FLAG 1 -#define BEVEL_DEL 2 -#define FACE_NEW 4 -#define EDGE_OLD 8 -#define FACE_OLD 16 -#define VERT_OLD 32 -#define FACE_SPAN 64 -#define FACE_HOLE 128 - -typedef struct LoopTag { - BMVert *newv; -} LoopTag; - -typedef struct EdgeTag { - BMVert *newv1, *newv2; -} EdgeTag; - -static void calc_corner_co(BMesh *bm, BMLoop *l, const float fac, float r_co[3], - const short do_dist, const short do_even) -{ - float no[3], l_vec_prev[3], l_vec_next[3], l_co_prev[3], l_co[3], l_co_next[3], co_ofs[3]; - int is_concave; - - /* first get the prev/next verts */ - if (l->f->len > 2) { - copy_v3_v3(l_co_prev, l->prev->v->co); - copy_v3_v3(l_co, l->v->co); - copy_v3_v3(l_co_next, l->next->v->co); - - /* calculate norma */ - sub_v3_v3v3(l_vec_prev, l_co_prev, l_co); - sub_v3_v3v3(l_vec_next, l_co_next, l_co); - - cross_v3_v3v3(no, l_vec_prev, l_vec_next); - is_concave = dot_v3v3(no, l->f->no) > 0.0f; - } - else { - BMIter iter; - BMLoop *l2; - float up[3] = {0.0f, 0.0f, 1.0f}; - - copy_v3_v3(l_co_prev, l->prev->v->co); - copy_v3_v3(l_co, l->v->co); - - BM_ITER(l2, &iter, bm, BM_LOOPS_OF_VERT, l->v) { - if (l2->f != l->f) { - copy_v3_v3(l_co_next, BM_edge_other_vert(l2->e, l2->next->v)->co); - break; - } - } - - sub_v3_v3v3(l_vec_prev, l_co_prev, l_co); - sub_v3_v3v3(l_vec_next, l_co_next, l_co); - - cross_v3_v3v3(no, l_vec_prev, l_vec_next); - if (dot_v3v3(no, no) == 0.0f) { - no[0] = no[1] = 0.0f; no[2] = -1.0f; - } - - is_concave = dot_v3v3(no, up) < 0.0f; - } - - - /* now calculate the new location */ - if (do_dist) { /* treat 'fac' as distance */ - - normalize_v3(l_vec_prev); - normalize_v3(l_vec_next); - - add_v3_v3v3(co_ofs, l_vec_prev, l_vec_next); - normalize_v3(co_ofs); - - if (do_even) { - negate_v3(l_vec_next); - mul_v3_fl(co_ofs, fac * shell_angle_to_dist(0.5f * angle_normalized_v3v3(l_vec_prev, l_vec_next))); - /* negate_v3(l_vec_next); */ /* no need unless we use again */ - } - else { - mul_v3_fl(co_ofs, fac); - } - } - else { /* treat as 'fac' as a factor (0 - 1) */ - - /* not strictly necessary, balance vectors - * so the longer edge doesn't skew the result, - * gives nicer, move even output. - * - * Use the minimum rather then the middle value so skinny faces don't flip along the short axis */ - float min_fac = minf(normalize_v3(l_vec_prev), normalize_v3(l_vec_next)); - float angle = do_even ? angle_normalized_v3v3(l_vec_prev, l_vec_next) : 0.0f; /* get angle while normalized */ - - mul_v3_fl(l_vec_prev, min_fac); - mul_v3_fl(l_vec_next, min_fac); - - add_v3_v3v3(co_ofs, l_vec_prev, l_vec_next); - - /* done */ - if (do_even) { - negate_v3(l_vec_next); - mul_v3_fl(co_ofs, (fac * 0.5) * shell_angle_to_dist(0.5f * angle)); - /* negate_v3(l_vec_next); */ /* no need unless we use again */ - } - else { - mul_v3_fl(co_ofs, fac * 0.5); - } - } - - /* apply delta vec */ - if (is_concave) - negate_v3(co_ofs); - - add_v3_v3v3(r_co, co_ofs, l->v->co); -} - - -#define ETAG_SET(e, v, nv) ( \ - (v) == (e)->v1 ? \ - (etags[BM_elem_index_get((e))].newv1 = (nv)) : \ - (etags[BM_elem_index_get((e))].newv2 = (nv)) \ - ) - -#define ETAG_GET(e, v) ( \ - (v) == (e)->v1 ? \ - (etags[BM_elem_index_get((e))].newv1) : \ - (etags[BM_elem_index_get((e))].newv2) \ - ) - -void bmesh_bevel_exec(BMesh *bm, BMOperator *op) -{ - BMOIter siter; - BMIter iter; - BMEdge *e; - BMVert *v; - BMFace **faces = NULL, *f; - LoopTag *tags = NULL, *tag; - EdgeTag *etags = NULL; - BMVert **verts = NULL; - BMEdge **edges = NULL; - BLI_array_declare(faces); - BLI_array_declare(tags); - BLI_array_declare(etags); - BLI_array_declare(verts); - BLI_array_declare(edges); - SmallHash hash; - float fac = BMO_slot_float_get(op, "percent"); - const short do_even = BMO_slot_int_get(op, "use_even"); - const short do_dist = BMO_slot_int_get(op, "use_dist"); - int i, li, has_elens, HasMDisps = CustomData_has_layer(&bm->ldata, CD_MDISPS); - - has_elens = CustomData_has_layer(&bm->edata, CD_PROP_FLT) && BMO_slot_int_get(op, "use_lengths"); - if (has_elens) { - li = BMO_slot_int_get(op, "lengthlayer"); - } - - BLI_smallhash_init(&hash); - - BMO_ITER(e, &siter, bm, op, "geom", BM_EDGE) { - BMO_elem_flag_set(bm, e, BEVEL_FLAG|BEVEL_DEL); - BMO_elem_flag_set(bm, e->v1, BEVEL_FLAG|BEVEL_DEL); - BMO_elem_flag_set(bm, e->v2, BEVEL_FLAG|BEVEL_DEL); - - if (BM_edge_face_count(e) < 2) { - BMO_elem_flag_clear(bm, e, BEVEL_DEL); - BMO_elem_flag_clear(bm, e->v1, BEVEL_DEL); - BMO_elem_flag_clear(bm, e->v2, BEVEL_DEL); - } -#if 0 - if (BM_edge_face_count(e) == 0) { - BMVert *verts[2] = {e->v1, e->v2}; - BMEdge *edges[2] = {e, BM_edge_create(bm, e->v1, e->v2, e, 0)}; - - BMO_elem_flag_set(bm, edges[1], BEVEL_FLAG); - BM_face_create(bm, verts, edges, 2, FALSE); - } -#endif - } - - BM_ITER(v, &iter, bm, BM_VERTS_OF_MESH, NULL) { - BMO_elem_flag_set(bm, v, VERT_OLD); - } - -#if 0 - //a bit of cleaner code that, alas, doens't work. - /* build edge tag */ - BM_ITER(e, &iter, bm, BM_EDGES_OF_MESH, NULL) { - if (BMO_elem_flag_test(bm, e->v1, BEVEL_FLAG) || BMO_elem_flag_test(bm, e->v2, BEVEL_FLAG)) { - BMIter liter; - BMLoop *l; - - if (!BMO_elem_flag_test(bm, e, EDGE_OLD)) { - BM_elem_index_set(e, BLI_array_count(etags)); /* set_dirty! */ - BLI_array_growone(etags); - @@ Diff output truncated at 10240 characters. @@ _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs