Cleanup: use 8 space indent for multi-line args

This commit is contained in:
Campbell Barton 2015-04-25 20:15:20 +10:00
parent a7381cca34
commit 89f5a09ab4
44 changed files with 708 additions and 506 deletions

View File

@ -37,8 +37,9 @@
#include "BKE_editmesh.h"
/* Static function for alloc */
static BMFace *bm_face_create_from_mpoly(MPoly *mp, MLoop *ml,
BMesh *bm, BMVert **vtable, BMEdge **etable)
static BMFace *bm_face_create_from_mpoly(
MPoly *mp, MLoop *ml,
BMesh *bm, BMVert **vtable, BMEdge **etable)
{
BMVert **verts = BLI_array_alloca(verts, mp->totloop);
BMEdge **edges = BLI_array_alloca(edges, mp->totloop);

View File

@ -667,8 +667,9 @@ static bool check_mask(EdgeQueueContext *eq_ctx, BMVert *v)
return (BM_ELEM_CD_GET_FLOAT(v, eq_ctx->cd_vert_mask_offset) < 1.0f);
}
static void edge_queue_insert(EdgeQueueContext *eq_ctx, BMEdge *e,
float priority)
static void edge_queue_insert(
EdgeQueueContext *eq_ctx, BMEdge *e,
float priority)
{
BMVert **pair;
@ -694,8 +695,9 @@ static void edge_queue_insert(EdgeQueueContext *eq_ctx, BMEdge *e,
}
}
static void long_edge_queue_edge_add(EdgeQueueContext *eq_ctx,
BMEdge *e)
static void long_edge_queue_edge_add(
EdgeQueueContext *eq_ctx,
BMEdge *e)
{
#ifdef USE_EDGEQUEUE_TAG
if (EDGE_QUEUE_TEST(e) == false)
@ -765,8 +767,9 @@ static void long_edge_queue_edge_add_recursive(
}
#endif /* USE_EDGEQUEUE_EVEN_SUBDIV */
static void short_edge_queue_edge_add(EdgeQueueContext *eq_ctx,
BMEdge *e)
static void short_edge_queue_edge_add(
EdgeQueueContext *eq_ctx,
BMEdge *e)
{
#ifdef USE_EDGEQUEUE_TAG
if (EDGE_QUEUE_TEST(e) == false)
@ -779,8 +782,9 @@ static void short_edge_queue_edge_add(EdgeQueueContext *eq_ctx,
}
}
static void long_edge_queue_face_add(EdgeQueueContext *eq_ctx,
BMFace *f)
static void long_edge_queue_face_add(
EdgeQueueContext *eq_ctx,
BMFace *f)
{
if (edge_queue_tri_in_sphere(eq_ctx->q, f)) {
BMLoop *l_iter;
@ -805,8 +809,9 @@ static void long_edge_queue_face_add(EdgeQueueContext *eq_ctx,
}
}
static void short_edge_queue_face_add(EdgeQueueContext *eq_ctx,
BMFace *f)
static void short_edge_queue_face_add(
EdgeQueueContext *eq_ctx,
BMFace *f)
{
if (edge_queue_tri_in_sphere(eq_ctx->q, f)) {
BMLoop *l_iter;
@ -829,9 +834,10 @@ static void short_edge_queue_face_add(EdgeQueueContext *eq_ctx,
*
* The highest priority (lowest number) is given to the longest edge.
*/
static void long_edge_queue_create(EdgeQueueContext *eq_ctx,
PBVH *bvh, const float center[3],
float radius)
static void long_edge_queue_create(
EdgeQueueContext *eq_ctx,
PBVH *bvh, const float center[3],
float radius)
{
int n;
@ -877,9 +883,10 @@ static void long_edge_queue_create(EdgeQueueContext *eq_ctx,
*
* The highest priority (lowest number) is given to the shortest edge.
*/
static void short_edge_queue_create(EdgeQueueContext *eq_ctx,
PBVH *bvh, const float center[3],
float radius)
static void short_edge_queue_create(
EdgeQueueContext *eq_ctx,
PBVH *bvh, const float center[3],
float radius)
{
int n;
@ -920,8 +927,9 @@ static void bm_edges_from_tri(BMesh *bm, BMVert *v_tri[3], BMEdge *e_tri[3])
e_tri[2] = BM_edge_create(bm, v_tri[2], v_tri[0], NULL, BM_CREATE_NO_DOUBLE);
}
static void pbvh_bmesh_split_edge(EdgeQueueContext *eq_ctx, PBVH *bvh,
BMEdge *e, BLI_Buffer *edge_loops)
static void pbvh_bmesh_split_edge(
EdgeQueueContext *eq_ctx, PBVH *bvh,
BMEdge *e, BLI_Buffer *edge_loops)
{
BMVert *v_new;
float co_mid[3], no_mid[3];
@ -1037,8 +1045,9 @@ static void pbvh_bmesh_split_edge(EdgeQueueContext *eq_ctx, PBVH *bvh,
BM_edge_kill(bvh->bm, e);
}
static bool pbvh_bmesh_subdivide_long_edges(EdgeQueueContext *eq_ctx, PBVH *bvh,
BLI_Buffer *edge_loops)
static bool pbvh_bmesh_subdivide_long_edges(
EdgeQueueContext *eq_ctx, PBVH *bvh,
BLI_Buffer *edge_loops)
{
bool any_subdivided = false;
@ -1295,9 +1304,10 @@ static bool pbvh_bmesh_collapse_short_edges(
/************************* Called from pbvh.c *************************/
bool pbvh_bmesh_node_raycast(PBVHNode *node, const float ray_start[3],
const float ray_normal[3], float *dist,
bool use_original)
bool pbvh_bmesh_node_raycast(
PBVHNode *node, const float ray_start[3],
const float ray_normal[3], float *dist,
bool use_original)
{
bool hit = false;
@ -1433,8 +1443,9 @@ static void pbvh_bmesh_node_layers_reset(PBVH *bvh)
/* Build a PBVH from a BMesh */
void BKE_pbvh_build_bmesh(PBVH *bvh, BMesh *bm, bool smooth_shading, BMLog *log,
const int cd_vert_node_offset, const int cd_face_node_offset)
void BKE_pbvh_build_bmesh(
PBVH *bvh, BMesh *bm, bool smooth_shading, BMLog *log,
const int cd_vert_node_offset, const int cd_face_node_offset)
{
BMIter iter;
BMFace *f;
@ -1474,8 +1485,9 @@ void BKE_pbvh_build_bmesh(PBVH *bvh, BMesh *bm, bool smooth_shading, BMLog *log,
}
/* Collapse short edges, subdivide long edges */
bool BKE_pbvh_bmesh_update_topology(PBVH *bvh, PBVHTopologyUpdateMode mode,
const float center[3], float radius)
bool BKE_pbvh_bmesh_update_topology(
PBVH *bvh, PBVHTopologyUpdateMode mode,
const float center[3], float radius)
{
/* 2 is enough for edge faces - manifold edge */
BLI_buffer_declare_static(BMLoop *, edge_loops, BLI_BUFFER_NOP, 2);

View File

@ -175,9 +175,10 @@ void BB_expand_with_bb(BB *bb, BB *bb2);
void BBC_update_centroid(BBC *bbc);
int BB_widest_axis(const BB *bb);
void pbvh_grow_nodes(PBVH *bvh, int totnode);
bool ray_face_intersection(const float ray_start[3], const float ray_normal[3],
const float *t0, const float *t1, const float *t2,
const float *t3, float *fdist);
bool ray_face_intersection(
const float ray_start[3], const float ray_normal[3],
const float *t0, const float *t1, const float *t2,
const float *t3, float *fdist);
void pbvh_update_BB_redraw(PBVH *bvh, PBVHNode **nodes, int totnode, int flag);
/* pbvh_bmesh.c */

View File

@ -47,8 +47,9 @@
#define SELECT 1
/* prototypes */
static void bm_loop_attrs_copy(BMesh *source_mesh, BMesh *target_mesh,
const BMLoop *source_loop, BMLoop *target_loop);
static void bm_loop_attrs_copy(
BMesh *source_mesh, BMesh *target_mesh,
const BMLoop *source_loop, BMLoop *target_loop);
/**
* \brief Make Quad/Triangle
@ -64,9 +65,10 @@ static void bm_loop_attrs_copy(BMesh *source_mesh, BMesh *target_mesh,
* of the vertices in the vertex array.
*/
BMFace *BM_face_create_quad_tri(BMesh *bm,
BMVert *v1, BMVert *v2, BMVert *v3, BMVert *v4,
const BMFace *f_example, const eBMCreateFlag create_flag)
BMFace *BM_face_create_quad_tri(
BMesh *bm,
BMVert *v1, BMVert *v2, BMVert *v3, BMVert *v4,
const BMFace *f_example, const eBMCreateFlag create_flag)
{
BMVert *vtar[4] = {v1, v2, v3, v4};
return BM_face_create_verts(bm, vtar, v4 ? 4 : 3, f_example, create_flag, true);
@ -81,8 +83,9 @@ BMFace *BM_face_create_quad_tri(BMesh *bm,
* this is done since the face may not be completely surrounded by faces,
* this way: a quad with 2 connected quads on either side will still get all 4 loops updated
*/
void BM_face_copy_shared(BMesh *bm, BMFace *f,
BMElemFilterFunc filter_fn, void *user_data)
void BM_face_copy_shared(
BMesh *bm, BMFace *f,
BMElemFilterFunc filter_fn, void *user_data)
{
BMLoop *l_first;
BMLoop *l_iter;
@ -250,9 +253,10 @@ BMFace *BM_face_create_ngon(
* - Optionally create edges between vertices.
* - Uses verts so no need to find edges (handy when you only have verts)
*/
BMFace *BM_face_create_ngon_verts(BMesh *bm, BMVert **vert_arr, const int len,
const BMFace *f_example, const eBMCreateFlag create_flag,
const bool calc_winding, const bool create_edges)
BMFace *BM_face_create_ngon_verts(
BMesh *bm, BMVert **vert_arr, const int len,
const BMFace *f_example, const eBMCreateFlag create_flag,
const bool calc_winding, const bool create_edges)
{
BMEdge **edge_arr = BLI_array_alloca(edge_arr, len);
unsigned int winding[2] = {0, 0};
@ -331,8 +335,9 @@ BMFace *BM_face_create_ngon_verts(BMesh *bm, BMVert **vert_arr, const int len,
*
* \note Since this is a vcloud there is no direction.
*/
BMFace *BM_face_create_ngon_vcloud(BMesh *bm, BMVert **vert_arr, int len,
const BMFace *f_example, const eBMCreateFlag create_flag)
BMFace *BM_face_create_ngon_vcloud(
BMesh *bm, BMVert **vert_arr, int len,
const BMFace *f_example, const eBMCreateFlag create_flag)
{
struct SortIntByFloat *vang = BLI_array_alloca(vang, len);
BMVert **vert_arr_map = BLI_array_alloca(vert_arr_map, len);
@ -453,8 +458,9 @@ BMFace *BM_face_create_ngon_vcloud(BMesh *bm, BMVert **vert_arr, int len,
/*************************************************************/
static void bm_vert_attrs_copy(BMesh *source_mesh, BMesh *target_mesh,
const BMVert *source_vertex, BMVert *target_vertex)
static void bm_vert_attrs_copy(
BMesh *source_mesh, BMesh *target_mesh,
const BMVert *source_vertex, BMVert *target_vertex)
{
if ((source_mesh == target_mesh) && (source_vertex == target_vertex)) {
BLI_assert(!"BMVert: source and targer match");
@ -466,8 +472,9 @@ static void bm_vert_attrs_copy(BMesh *source_mesh, BMesh *target_mesh,
source_vertex->head.data, &target_vertex->head.data);
}
static void bm_edge_attrs_copy(BMesh *source_mesh, BMesh *target_mesh,
const BMEdge *source_edge, BMEdge *target_edge)
static void bm_edge_attrs_copy(
BMesh *source_mesh, BMesh *target_mesh,
const BMEdge *source_edge, BMEdge *target_edge)
{
if ((source_mesh == target_mesh) && (source_edge == target_edge)) {
BLI_assert(!"BMEdge: source and targer match");
@ -478,8 +485,9 @@ static void bm_edge_attrs_copy(BMesh *source_mesh, BMesh *target_mesh,
source_edge->head.data, &target_edge->head.data);
}
static void bm_loop_attrs_copy(BMesh *source_mesh, BMesh *target_mesh,
const BMLoop *source_loop, BMLoop *target_loop)
static void bm_loop_attrs_copy(
BMesh *source_mesh, BMesh *target_mesh,
const BMLoop *source_loop, BMLoop *target_loop)
{
if ((source_mesh == target_mesh) && (source_loop == target_loop)) {
BLI_assert(!"BMLoop: source and targer match");
@ -490,8 +498,9 @@ static void bm_loop_attrs_copy(BMesh *source_mesh, BMesh *target_mesh,
source_loop->head.data, &target_loop->head.data);
}
static void bm_face_attrs_copy(BMesh *source_mesh, BMesh *target_mesh,
const BMFace *source_face, BMFace *target_face)
static void bm_face_attrs_copy(
BMesh *source_mesh, BMesh *target_mesh,
const BMFace *source_face, BMFace *target_face)
{
if ((source_mesh == target_mesh) && (source_face == target_face)) {
BLI_assert(!"BMFace: source and targer match");
@ -511,8 +520,9 @@ static void bm_face_attrs_copy(BMesh *source_mesh, BMesh *target_mesh,
* Copies attributes, e.g. customdata, header flags, etc, from one element
* to another of the same type.
*/
void BM_elem_attrs_copy_ex(BMesh *bm_src, BMesh *bm_dst, const void *ele_src_v, void *ele_dst_v,
const char hflag_mask)
void BM_elem_attrs_copy_ex(
BMesh *bm_src, BMesh *bm_dst, const void *ele_src_v, void *ele_dst_v,
const char hflag_mask)
{
const BMHeader *ele_src = ele_src_v;
BMHeader *ele_dst = ele_dst_v;
@ -577,9 +587,10 @@ void BM_elem_select_copy(BMesh *bm_dst, BMesh *UNUSED(bm_src), void *ele_dst_v,
}
/* helper function for 'BM_mesh_copy' */
static BMFace *bm_mesh_copy_new_face(BMesh *bm_new, BMesh *bm_old,
BMVert **vtable, BMEdge **etable,
BMFace *f)
static BMFace *bm_mesh_copy_new_face(
BMesh *bm_new, BMesh *bm_old,
BMVert **vtable, BMEdge **etable,
BMFace *f)
{
BMLoop **loops = BLI_array_alloca(loops, f->len);
BMVert **verts = BLI_array_alloca(verts, f->len);

View File

@ -29,23 +29,29 @@
struct BMAllocTemplate;
BMFace *BM_face_create_quad_tri(BMesh *bm, BMVert *v1, BMVert *v2, BMVert *v3, BMVert *v4,
const BMFace *f_example, const eBMCreateFlag create_flag);
BMFace *BM_face_create_quad_tri(
BMesh *bm, BMVert *v1, BMVert *v2, BMVert *v3, BMVert *v4,
const BMFace *f_example, const eBMCreateFlag create_flag);
void BM_face_copy_shared(BMesh *bm, BMFace *f,
BMElemFilterFunc filter_fn, void *user_data);
void BM_face_copy_shared(
BMesh *bm, BMFace *f,
BMElemFilterFunc filter_fn, void *user_data);
BMFace *BM_face_create_ngon(BMesh *bm, BMVert *v1, BMVert *v2, BMEdge **edges, const int len,
const BMFace *f_example, const eBMCreateFlag create_flag);
BMFace *BM_face_create_ngon_verts(BMesh *bm, BMVert **vert_arr, const int len,
const BMFace *f_example, const eBMCreateFlag create_flag,
const bool calc_winding, const bool create_edges);
BMFace *BM_face_create_ngon(
BMesh *bm, BMVert *v1, BMVert *v2, BMEdge **edges, const int len,
const BMFace *f_example, const eBMCreateFlag create_flag);
BMFace *BM_face_create_ngon_verts(
BMesh *bm, BMVert **vert_arr, const int len,
const BMFace *f_example, const eBMCreateFlag create_flag,
const bool calc_winding, const bool create_edges);
BMFace *BM_face_create_ngon_vcloud(BMesh *bm, BMVert **vert_arr, int len,
const BMFace *f_example, const eBMCreateFlag create_flag);
BMFace *BM_face_create_ngon_vcloud(
BMesh *bm, BMVert **vert_arr, int len,
const BMFace *f_example, const eBMCreateFlag create_flag);
void BM_elem_attrs_copy_ex(BMesh *bm_src, BMesh *bm_dst, const void *ele_src_v, void *ele_dst_v,
const char hflag_mask);
void BM_elem_attrs_copy_ex(
BMesh *bm_src, BMesh *bm_dst, const void *ele_src_v, void *ele_dst_v,
const char hflag_mask);
void BM_elem_attrs_copy(BMesh *bm_src, BMesh *bm_dst, const void *ele_src_v, void *ele_dst_v);
void BM_elem_select_copy(BMesh *bm_dst, BMesh *bm_src, void *ele_dst_v, const void *ele_src_v);

View File

@ -57,8 +57,9 @@
/**
* \brief Main function for creating a new vertex.
*/
BMVert *BM_vert_create(BMesh *bm, const float co[3],
const BMVert *v_example, const eBMCreateFlag create_flag)
BMVert *BM_vert_create(
BMesh *bm, const float co[3],
const BMVert *v_example, const eBMCreateFlag create_flag)
{
BMVert *v = BLI_mempool_alloc(bm->vpool);
@ -141,8 +142,9 @@ BMVert *BM_vert_create(BMesh *bm, const float co[3],
* \note Duplicate edges are supported by the API however users should _never_ see them.
* so unless you need a unique edge or know the edge won't exist, you should call with \a no_double = true
*/
BMEdge *BM_edge_create(BMesh *bm, BMVert *v1, BMVert *v2,
const BMEdge *e_example, const eBMCreateFlag create_flag)
BMEdge *BM_edge_create(
BMesh *bm, BMVert *v1, BMVert *v2,
const BMEdge *e_example, const eBMCreateFlag create_flag)
{
BMEdge *e;
@ -204,8 +206,9 @@ BMEdge *BM_edge_create(BMesh *bm, BMVert *v1, BMVert *v2,
return e;
}
static BMLoop *bm_loop_create(BMesh *bm, BMVert *v, BMEdge *e, BMFace *f,
const BMLoop *l_example, const eBMCreateFlag create_flag)
static BMLoop *bm_loop_create(
BMesh *bm, BMVert *v, BMEdge *e, BMFace *f,
const BMLoop *l_example, const eBMCreateFlag create_flag)
{
BMLoop *l = NULL;
@ -254,8 +257,9 @@ static BMLoop *bm_loop_create(BMesh *bm, BMVert *v, BMEdge *e, BMFace *f,
return l;
}
static BMLoop *bm_face_boundary_add(BMesh *bm, BMFace *f, BMVert *startv, BMEdge *starte,
const eBMCreateFlag create_flag)
static BMLoop *bm_face_boundary_add(
BMesh *bm, BMFace *f, BMVert *startv, BMEdge *starte,
const eBMCreateFlag create_flag)
{
#ifdef USE_BMESH_HOLES
BMLoopList *lst = BLI_mempool_calloc(bm->looplistpool);
@ -276,8 +280,9 @@ static BMLoop *bm_face_boundary_add(BMesh *bm, BMFace *f, BMVert *startv, BMEdge
return l;
}
BMFace *BM_face_copy(BMesh *bm_dst, BMesh *bm_src, BMFace *f,
const bool copy_verts, const bool copy_edges)
BMFace *BM_face_copy(
BMesh *bm_dst, BMesh *bm_src, BMFace *f,
const bool copy_verts, const bool copy_edges)
{
BMVert **verts = BLI_array_alloca(verts, f->len);
BMEdge **edges = BLI_array_alloca(edges, f->len);
@ -400,8 +405,9 @@ BLI_INLINE BMFace *bm_face_create__internal(BMesh *bm)
* \param len Length of the face
* \param create_flag Options for creating the face
*/
BMFace *BM_face_create(BMesh *bm, BMVert **verts, BMEdge **edges, const int len,
const BMFace *f_example, const eBMCreateFlag create_flag)
BMFace *BM_face_create(
BMesh *bm, BMVert **verts, BMEdge **edges, const int len,
const BMFace *f_example, const eBMCreateFlag create_flag)
{
BMFace *f = NULL;
BMLoop *l, *startl, *lastl;
@ -474,8 +480,9 @@ BMFace *BM_face_create(BMesh *bm, BMVert **verts, BMEdge **edges, const int len,
/**
* Wrapper for #BM_face_create when you don't have an edge array
*/
BMFace *BM_face_create_verts(BMesh *bm, BMVert **vert_arr, const int len,
const BMFace *f_example, const eBMCreateFlag create_flag, const bool create_edges)
BMFace *BM_face_create_verts(
BMesh *bm, BMVert **vert_arr, const int len,
const BMFace *f_example, const eBMCreateFlag create_flag, const bool create_edges)
{
BMEdge **edge_arr = BLI_array_alloca(edge_arr, len);
int i, i_prev = len - 1;
@ -1327,14 +1334,14 @@ static BMFace *bm_face_create__sfme(BMesh *bm, BMFace *f_example)
*
* \return A BMFace pointer
*/
BMFace *bmesh_sfme(BMesh *bm, BMFace *f, BMLoop *l_v1, BMLoop *l_v2,
BMLoop **r_l,
BMFace *bmesh_sfme(
BMesh *bm, BMFace *f, BMLoop *l_v1, BMLoop *l_v2,
BMLoop **r_l,
#ifdef USE_BMESH_HOLES
ListBase *holes,
ListBase *holes,
#endif
BMEdge *e_example,
const bool no_double
)
BMEdge *e_example,
const bool no_double)
{
#ifdef USE_BMESH_HOLES
BMLoopList *lst, *lst2;
@ -1673,8 +1680,9 @@ BMVert *bmesh_semv(BMesh *bm, BMVert *tv, BMEdge *e, BMEdge **r_e)
* faces with just 2 edges. It is up to the caller to decide what to do with
* these faces.
*/
BMEdge *bmesh_jekv(BMesh *bm, BMEdge *e_kill, BMVert *v_kill,
const bool do_del, const bool check_edge_double)
BMEdge *bmesh_jekv(
BMesh *bm, BMEdge *e_kill, BMVert *v_kill,
const bool do_del, const bool check_edge_double)
{
BMEdge *e_old;
BMVert *v_old, *tv;
@ -2074,8 +2082,9 @@ bool BM_vert_splice(BMesh *bm, BMVert *v, BMVert *v_target)
*
* \return Success
*/
void bmesh_vert_separate(BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len,
const bool copy_select)
void bmesh_vert_separate(
BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len,
const bool copy_select)
{
const int v_edgetot = BM_vert_face_count(v);
BMEdge **stack = BLI_array_alloca(stack, v_edgetot);
@ -2206,8 +2215,9 @@ void bmesh_vert_separate(BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len
/**
* High level function which wraps both #bmesh_vert_separate and #bmesh_edge_separate
*/
void BM_vert_separate(BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len,
BMEdge **e_in, int e_in_len)
void BM_vert_separate(
BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len,
BMEdge **e_in, int e_in_len)
{
int i;
@ -2274,8 +2284,9 @@ bool BM_edge_splice(BMesh *bm, BMEdge *e, BMEdge *e_target)
* \note Does nothing if \a l_sep is already the only loop in the
* edge radial.
*/
void bmesh_edge_separate(BMesh *bm, BMEdge *e, BMLoop *l_sep,
const bool copy_select)
void bmesh_edge_separate(
BMesh *bm, BMEdge *e, BMLoop *l_sep,
const bool copy_select)
{
BMEdge *e_new;
#ifndef NDEBUG

View File

@ -27,8 +27,9 @@
* \ingroup bmesh
*/
BMFace *BM_face_copy(BMesh *bm_dst, BMesh *bm_src, BMFace *f,
const bool copy_verts, const bool copy_edges);
BMFace *BM_face_copy(
BMesh *bm_dst, BMesh *bm_src, BMFace *f,
const bool copy_verts, const bool copy_edges);
typedef enum eBMCreateFlag {
BM_CREATE_NOP = 0,
@ -40,15 +41,19 @@ typedef enum eBMCreateFlag {
BM_CREATE_SKIP_CD = (1 << 2),
} eBMCreateFlag;
BMVert *BM_vert_create(BMesh *bm, const float co[3],
const BMVert *v_example, const eBMCreateFlag create_flag);
BMEdge *BM_edge_create(BMesh *bm, BMVert *v1, BMVert *v2,
const BMEdge *e_example, const eBMCreateFlag create_flag);
BMFace *BM_face_create(BMesh *bm, BMVert **verts, BMEdge **edges, const int len,
const BMFace *f_example, const eBMCreateFlag create_flag);
BMFace *BM_face_create_verts(BMesh *bm, BMVert **verts, const int len,
const BMFace *f_example, const eBMCreateFlag create_flag,
const bool create_edges);
BMVert *BM_vert_create(
BMesh *bm, const float co[3],
const BMVert *v_example, const eBMCreateFlag create_flag);
BMEdge *BM_edge_create(
BMesh *bm, BMVert *v1, BMVert *v2,
const BMEdge *e_example, const eBMCreateFlag create_flag);
BMFace *BM_face_create(
BMesh *bm, BMVert **verts, BMEdge **edges, const int len,
const BMFace *f_example, const eBMCreateFlag create_flag);
BMFace *BM_face_create_verts(
BMesh *bm, BMVert **verts, const int len,
const BMFace *f_example, const eBMCreateFlag create_flag,
const bool create_edges);
void BM_face_edges_kill(BMesh *bm, BMFace *f);
void BM_face_verts_kill(BMesh *bm, BMFace *f);
@ -57,25 +62,29 @@ void BM_face_kill(BMesh *bm, BMFace *f);
void BM_edge_kill(BMesh *bm, BMEdge *e);
void BM_vert_kill(BMesh *bm, BMVert *v);
void bmesh_edge_separate(BMesh *bm, BMEdge *e, BMLoop *l_sep,
const bool copy_select);
void bmesh_edge_separate(
BMesh *bm, BMEdge *e, BMLoop *l_sep,
const bool copy_select);
bool BM_edge_splice(BMesh *bm, BMEdge *e, BMEdge *e_target);
bool BM_vert_splice(BMesh *bm, BMVert *v, BMVert *v_target);
bool BM_vert_splice_check_double(BMVert *v_a, BMVert *v_b);
void bmesh_vert_separate(BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len,
const bool copy_select);
void bmesh_vert_separate(
BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len,
const bool copy_select);
bool bmesh_loop_reverse(BMesh *bm, BMFace *f);
BMFace *BM_faces_join(BMesh *bm, BMFace **faces, int totface, const bool do_del);
void BM_vert_separate(BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len,
BMEdge **e_in, int e_in_len);
void BM_vert_separate(
BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len,
BMEdge **e_in, int e_in_len);
/* EULER API - For modifying structure */
BMFace *bmesh_sfme(BMesh *bm, BMFace *f,
BMLoop *l1, BMLoop *l2,
BMLoop **r_l,
BMFace *bmesh_sfme(
BMesh *bm, BMFace *f,
BMLoop *l1, BMLoop *l2,
BMLoop **r_l,
#ifdef USE_BMESH_HOLES
ListBase *holes,
#endif
@ -84,8 +93,9 @@ BMFace *bmesh_sfme(BMesh *bm, BMFace *f,
);
BMVert *bmesh_semv(BMesh *bm, BMVert *tv, BMEdge *e, BMEdge **r_e);
BMEdge *bmesh_jekv(BMesh *bm, BMEdge *e_kill, BMVert *v_kill,
const bool do_del, const bool check_edge_splice);
BMEdge *bmesh_jekv(
BMesh *bm, BMEdge *e_kill, BMVert *v_kill,
const bool do_del, const bool check_edge_splice);
BMFace *bmesh_jfke(BMesh *bm, BMFace *f1, BMFace *f2, BMEdge *e);
BMVert *bmesh_urmv(BMesh *bm, BMFace *f_sep, BMVert *v_sep);
BMVert *bmesh_urmv_loop(BMesh *bm, BMLoop *l_sep);

View File

@ -52,8 +52,9 @@ typedef struct BMEdgeLoopStore {
/* -------------------------------------------------------------------- */
/* BM_mesh_edgeloops_find & Util Functions */
static int bm_vert_other_tag(BMVert *v, BMVert *v_prev,
BMEdge **r_e)
static int bm_vert_other_tag(
BMVert *v, BMVert *v_prev,
BMEdge **r_e)
{
BMIter iter;
BMEdge *e, *e_next = NULL;
@ -125,8 +126,9 @@ static bool bm_loop_build(BMEdgeLoopStore *el_store, BMVert *v_prev, BMVert *v,
/**
* \return listbase of listbases, each linking to a vertex.
*/
int BM_mesh_edgeloops_find(BMesh *bm, ListBase *r_eloops,
bool (*test_fn)(BMEdge *, void *user_data), void *user_data)
int BM_mesh_edgeloops_find(
BMesh *bm, ListBase *r_eloops,
bool (*test_fn)(BMEdge *, void *user_data), void *user_data)
{
BMIter iter;
BMEdge *e;
@ -183,8 +185,9 @@ struct VertStep {
BMVert *v;
};
static void vs_add(BLI_mempool *vs_pool, ListBase *lb,
BMVert *v, BMEdge *e_prev, const int iter_tot)
static void vs_add(
BLI_mempool *vs_pool, ListBase *lb,
BMVert *v, BMEdge *e_prev, const int iter_tot)
{
struct VertStep *vs_new = BLI_mempool_alloc(vs_pool);
vs_new->v = v;
@ -256,9 +259,10 @@ static bool bm_loop_path_build_step(BLI_mempool *vs_pool, ListBase *lb, const in
return (BLI_listbase_is_empty(lb) == false);
}
bool BM_mesh_edgeloops_find_path(BMesh *bm, ListBase *r_eloops,
bool (*test_fn)(BMEdge *, void *user_data), void *user_data,
BMVert *v_src, BMVert *v_dst)
bool BM_mesh_edgeloops_find_path(
BMesh *bm, ListBase *r_eloops,
bool (*test_fn)(BMEdge *, void *user_data), void *user_data,
BMVert *v_src, BMVert *v_dst)
{
BMIter iter;
BMEdge *e;

View File

@ -32,17 +32,20 @@ struct ListBase;
struct BMEdgeLoopStore;
/* multiple edgeloops (ListBase) */
int BM_mesh_edgeloops_find(BMesh *bm, struct ListBase *r_lb,
bool (*test_fn)(BMEdge *, void *user_data), void *user_data);
bool BM_mesh_edgeloops_find_path(BMesh *bm, ListBase *r_eloops,
bool (*test_fn)(BMEdge *, void *user_data), void *user_data,
BMVert *v_src, BMVert *v_dst);
int BM_mesh_edgeloops_find(
BMesh *bm, struct ListBase *r_lb,
bool (*test_fn)(BMEdge *, void *user_data), void *user_data);
bool BM_mesh_edgeloops_find_path(
BMesh *bm, ListBase *r_eloops,
bool (*test_fn)(BMEdge *, void *user_data), void *user_data,
BMVert *v_src, BMVert *v_dst);
void BM_mesh_edgeloops_free(struct ListBase *eloops);
void BM_mesh_edgeloops_calc_center(BMesh *bm, struct ListBase *eloops);
void BM_mesh_edgeloops_calc_normal(BMesh *bm, struct ListBase *eloops);
void BM_mesh_edgeloops_calc_normal_aligned(BMesh *bm, struct ListBase *eloops,
const float no_align[3]);
void BM_mesh_edgeloops_calc_normal_aligned(
BMesh *bm, struct ListBase *eloops,
const float no_align[3]);
void BM_mesh_edgeloops_calc_order(BMesh *UNUSED(bm), ListBase *eloops, const bool use_normals);
@ -59,8 +62,9 @@ const float *BM_edgeloop_center_get(struct BMEdgeLoopStore *el_store);
void BM_edgeloop_edges_get(struct BMEdgeLoopStore *el_store, BMEdge **e_arr);
void BM_edgeloop_calc_center(BMesh *bm, struct BMEdgeLoopStore *el_store);
bool BM_edgeloop_calc_normal(BMesh *bm, struct BMEdgeLoopStore *el_store);
bool BM_edgeloop_calc_normal_aligned(BMesh *bm, struct BMEdgeLoopStore *el_store,
const float no_align[3]);
bool BM_edgeloop_calc_normal_aligned(
BMesh *bm, struct BMEdgeLoopStore *el_store,
const float no_align[3]);
void BM_edgeloop_flip(BMesh *bm, struct BMEdgeLoopStore *el_store);
void BM_edgeloop_expand(BMesh *bm, struct BMEdgeLoopStore *el_store, int el_store_len);

View File

@ -241,8 +241,9 @@ void BM_face_interp_from_face(BMesh *bm, BMFace *f_dst, const BMFace *f_src, con
* y
* </pre>
*/
static int compute_mdisp_quad(BMLoop *l, float v1[3], float v2[3], float v3[3], float v4[3],
float e1[3], float e2[3])
static int compute_mdisp_quad(
BMLoop *l, float v1[3], float v2[3], float v3[3], float v4[3],
float e1[3], float e2[3])
{
float cent[3], n[3], p[3];
@ -302,9 +303,10 @@ static float quad_coord(const float aa[3], const float bb[3], const float cc[3],
return f1;
}
static int quad_co(float *x, float *y,
const float v1[3], const float v2[3], const float v3[3], const float v4[3],
const float p[3], const float n[3])
static int quad_co(
float *r_x, float *r_y,
const float v1[3], const float v2[3], const float v3[3], const float v4[3],
const float p[3], const float n[3])
{
float projverts[5][3], n2[3];
float dprojverts[4][3], origin[3] = {0.0f, 0.0f, 0.0f};
@ -340,14 +342,15 @@ static int quad_co(float *x, float *y,
return 0;
}
*y = quad_coord(dprojverts[1], dprojverts[0], dprojverts[2], dprojverts[3], 0, 1);
*x = quad_coord(dprojverts[2], dprojverts[1], dprojverts[3], dprojverts[0], 0, 1);
*r_y = quad_coord(dprojverts[1], dprojverts[0], dprojverts[2], dprojverts[3], 0, 1);
*r_x = quad_coord(dprojverts[2], dprojverts[1], dprojverts[3], dprojverts[0], 0, 1);
return 1;
}
static void mdisp_axis_from_quad(float v1[3], float v2[3], float UNUSED(v3[3]), float v4[3],
float axis_x[3], float axis_y[3])
static void mdisp_axis_from_quad(
float v1[3], float v2[3], float UNUSED(v3[3]), float v4[3],
float axis_x[3], float axis_y[3])
{
sub_v3_v3v3(axis_x, v4, v1);
sub_v3_v3v3(axis_y, v2, v1);
@ -358,8 +361,9 @@ static void mdisp_axis_from_quad(float v1[3], float v2[3], float UNUSED(v3[3]),
/* tl is loop to project onto, l is loop whose internal displacement, co, is being
* projected. x and y are location in loop's mdisps grid of point co. */
static bool mdisp_in_mdispquad(BMLoop *l, BMLoop *tl, float p[3], float *x, float *y,
int res, float axis_x[3], float axis_y[3])
static bool mdisp_in_mdispquad(
BMLoop *l, BMLoop *tl, float p[3], float *x, float *y,
int res, float axis_x[3], float axis_y[3])
{
float v1[3], v2[3], c[3], v3[3], v4[3], e1[3], e2[3];
float eps = FLT_EPSILON * 4000;
@ -392,8 +396,9 @@ static bool mdisp_in_mdispquad(BMLoop *l, BMLoop *tl, float p[3], float *x, floa
return 1;
}
static float bm_loop_flip_equotion(float mat[2][2], float b[2], const float target_axis_x[3], const float target_axis_y[3],
const float coord[3], int i, int j)
static float bm_loop_flip_equotion(
float mat[2][2], float b[2], const float target_axis_x[3], const float target_axis_y[3],
const float coord[3], int i, int j)
{
mat[0][0] = target_axis_x[i];
mat[0][1] = target_axis_y[i];
@ -405,8 +410,9 @@ static float bm_loop_flip_equotion(float mat[2][2], float b[2], const float targ
return mat[0][0] * mat[1][1] - mat[0][1] * mat[1][0];
}
static void bm_loop_flip_disp(const float source_axis_x[3], const float source_axis_y[3],
const float target_axis_x[3], const float target_axis_y[3], float disp[3])
static void bm_loop_flip_disp(
const float source_axis_x[3], const float source_axis_y[3],
const float target_axis_x[3], const float target_axis_y[3], float disp[3])
{
float vx[3], vy[3], coord[3];
float n[3], vec[3];

View File

@ -136,8 +136,9 @@ int BM_iter_as_array(BMesh *bm, const char itype, void *data, void **array, cons
*
* Sometimes its convenient to get the iterator as an array.
*/
int BMO_iter_as_array(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, const char restrictmask,
void **array, const int len)
int BMO_iter_as_array(
BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, const char restrictmask,
void **array, const int len)
{
int i = 0;
@ -169,9 +170,10 @@ int BMO_iter_as_array(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_nam
*
* Caller needs to free the array.
*/
void *BM_iter_as_arrayN(BMesh *bm, const char itype, void *data, int *r_len,
/* optional args to avoid an alloc (normally stack array) */
void **stack_array, int stack_array_size)
void *BM_iter_as_arrayN(
BMesh *bm, const char itype, void *data, int *r_len,
/* optional args to avoid an alloc (normally stack array) */
void **stack_array, int stack_array_size)
{
BMIter iter;
@ -212,10 +214,11 @@ void *BM_iter_as_arrayN(BMesh *bm, const char itype, void *data, int *r_len,
}
}
void *BMO_iter_as_arrayN(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, const char restrictmask,
int *r_len,
/* optional args to avoid an alloc (normally stack array) */
void **stack_array, int stack_array_size)
void *BMO_iter_as_arrayN(
BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, const char restrictmask,
int *r_len,
/* optional args to avoid an alloc (normally stack array) */
void **stack_array, int stack_array_size)
{
BMOIter iter;
BMElem *ele;
@ -273,8 +276,9 @@ int BM_iter_elem_count_flag(const char itype, void *data, const char hflag, cons
*
* Counts how many flagged / unflagged items are found in this element.
*/
int BMO_iter_elem_count_flag(BMesh *bm, const char itype, void *data,
const short oflag, const bool value)
int BMO_iter_elem_count_flag(
BMesh *bm, const char itype, void *data,
const short oflag, const bool value)
{
BMIter iter;
BMElemF *ele;

View File

@ -197,14 +197,17 @@ typedef struct BMIter {
void *BM_iter_at_index(BMesh *bm, const char itype, void *data, int index) ATTR_WARN_UNUSED_RESULT;
int BM_iter_as_array(BMesh *bm, const char itype, void *data, void **array, const int len);
void *BM_iter_as_arrayN(BMesh *bm, const char itype, void *data, int *r_len,
void **stack_array, int stack_array_size) ATTR_WARN_UNUSED_RESULT;
int BMO_iter_as_array(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, const char restrictmask,
void **array, const int len);
void *BMO_iter_as_arrayN(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, const char restrictmask,
int *r_len,
/* optional args to avoid an alloc (normally stack array) */
void **stack_array, int stack_array_size);
void *BM_iter_as_arrayN(
BMesh *bm, const char itype, void *data, int *r_len,
void **stack_array, int stack_array_size) ATTR_WARN_UNUSED_RESULT;
int BMO_iter_as_array(
BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, const char restrictmask,
void **array, const int len);
void *BMO_iter_as_arrayN(
BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, const char restrictmask,
int *r_len,
/* optional args to avoid an alloc (normally stack array) */
void **stack_array, int stack_array_size);
int BM_iter_elem_count_flag(const char itype, void *data, const char hflag, const bool value);
int BMO_iter_elem_count_flag(BMesh *bm, const char itype, void *data, const short oflag, const bool value);
int BM_iter_mesh_count(const char itype, BMesh *bm);

View File

@ -626,8 +626,9 @@ void BM_mesh_select_mode_set(BMesh *bm, int selectmode)
/**
* counts number of elements with flag enabled/disabled
*/
static int bm_mesh_flag_count(BMesh *bm, const char htype, const char hflag,
const bool respecthide, const bool test_for_enabled)
static int bm_mesh_flag_count(
BMesh *bm, const char htype, const char hflag,
const bool respecthide, const bool test_for_enabled)
{
BMElem *ele;
BMIter iter;
@ -1013,8 +1014,9 @@ GHash *BM_select_history_map_create(BMesh *bm)
return map;
}
void BM_mesh_elem_hflag_disable_test(BMesh *bm, const char htype, const char hflag,
const bool respecthide, const bool overwrite, const char hflag_test)
void BM_mesh_elem_hflag_disable_test(
BMesh *bm, const char htype, const char hflag,
const bool respecthide, const bool overwrite, const char hflag_test)
{
const char iter_types[3] = {BM_VERTS_OF_MESH,
BM_EDGES_OF_MESH,
@ -1084,8 +1086,9 @@ void BM_mesh_elem_hflag_disable_test(BMesh *bm, const char htype, const char hfl
}
}
void BM_mesh_elem_hflag_enable_test(BMesh *bm, const char htype, const char hflag,
const bool respecthide, const bool overwrite, const char hflag_test)
void BM_mesh_elem_hflag_enable_test(
BMesh *bm, const char htype, const char hflag,
const bool respecthide, const bool overwrite, const char hflag_test)
{
const char iter_types[3] = {BM_VERTS_OF_MESH,
BM_EDGES_OF_MESH,
@ -1139,15 +1142,17 @@ void BM_mesh_elem_hflag_enable_test(BMesh *bm, const char htype, const char hfla
}
}
void BM_mesh_elem_hflag_disable_all(BMesh *bm, const char htype, const char hflag,
const bool respecthide)
void BM_mesh_elem_hflag_disable_all(
BMesh *bm, const char htype, const char hflag,
const bool respecthide)
{
/* call with 0 hflag_test */
BM_mesh_elem_hflag_disable_test(bm, htype, hflag, respecthide, false, 0);
}
void BM_mesh_elem_hflag_enable_all(BMesh *bm, const char htype, const char hflag,
const bool respecthide)
void BM_mesh_elem_hflag_enable_all(
BMesh *bm, const char htype, const char hflag,
const bool respecthide)
{
/* call with 0 hflag_test */
BM_mesh_elem_hflag_enable_test(bm, htype, hflag, respecthide, false, 0);

View File

@ -43,15 +43,19 @@ void BM_face_hide_set(BMFace *f, const bool hide);
/* Selection code */
void BM_elem_select_set(BMesh *bm, BMElem *ele, const bool select);
void BM_mesh_elem_hflag_enable_test(BMesh *bm, const char htype, const char hflag,
const bool respecthide, const bool overwrite, const char hflag_test);
void BM_mesh_elem_hflag_disable_test(BMesh *bm, const char htype, const char hflag,
const bool respecthide, const bool overwrite, const char hflag_test);
void BM_mesh_elem_hflag_enable_test(
BMesh *bm, const char htype, const char hflag,
const bool respecthide, const bool overwrite, const char hflag_test);
void BM_mesh_elem_hflag_disable_test(
BMesh *bm, const char htype, const char hflag,
const bool respecthide, const bool overwrite, const char hflag_test);
void BM_mesh_elem_hflag_enable_all(BMesh *bm, const char htype, const char hflag,
const bool respecthide);
void BM_mesh_elem_hflag_disable_all(BMesh *bm, const char htype, const char hflag,
const bool respecthide);
void BM_mesh_elem_hflag_enable_all(
BMesh *bm, const char htype, const char hflag,
const bool respecthide);
void BM_mesh_elem_hflag_disable_all(
BMesh *bm, const char htype, const char hflag,
const bool respecthide);
/* individual element select functions, BM_elem_select_set is a shortcut for these
* that automatically detects which one to use*/

View File

@ -303,8 +303,9 @@ static void bm_mesh_edges_calc_vectors(BMesh *bm, float (*edgevec)[3], const flo
bm->elem_index_dirty &= ~BM_EDGE;
}
static void bm_mesh_verts_calc_normals(BMesh *bm, const float (*edgevec)[3], const float (*fnos)[3],
const float (*vcos)[3], float (*vnos)[3])
static void bm_mesh_verts_calc_normals(
BMesh *bm, const float (*edgevec)[3], const float (*fnos)[3],
const float (*vcos)[3], float (*vnos)[3])
{
BM_mesh_elem_index_ensure(bm, (vnos) ? (BM_EDGE | BM_VERT) : BM_EDGE);
@ -437,8 +438,9 @@ void BM_verts_calc_normal_vcos(BMesh *bm, const float (*fnos)[3], const float (*
/**
* Helpers for #BM_mesh_loop_normals_update and #BM_loops_calc_normals_vnos
*/
static void bm_mesh_edges_sharp_tag(BMesh *bm, const float (*vnos)[3], const float (*fnos)[3], float split_angle,
float (*r_lnos)[3])
static void bm_mesh_edges_sharp_tag(
BMesh *bm, const float (*vnos)[3], const float (*fnos)[3], float split_angle,
float (*r_lnos)[3])
{
BMIter eiter, viter;
BMVert *v;
@ -1131,8 +1133,9 @@ finally:
* These functions ensure its correct and are called more often in debug mode.
*/
void BM_mesh_elem_index_validate(BMesh *bm, const char *location, const char *func,
const char *msg_a, const char *msg_b)
void BM_mesh_elem_index_validate(
BMesh *bm, const char *location, const char *func,
const char *msg_a, const char *msg_b)
{
const char iter_types[3] = {BM_VERTS_OF_MESH,
BM_EDGES_OF_MESH,

View File

@ -49,8 +49,9 @@ void bmesh_edit_begin(BMesh *bm, const BMOpTypeFlag type_flag);
void bmesh_edit_end(BMesh *bm, const BMOpTypeFlag type_flag);
void BM_mesh_elem_index_ensure(BMesh *bm, const char hflag);
void BM_mesh_elem_index_validate(BMesh *bm, const char *location, const char *func,
const char *msg_a, const char *msg_b);
void BM_mesh_elem_index_validate(
BMesh *bm, const char *location, const char *func,
const char *msg_a, const char *msg_b);
#ifndef NDEBUG
bool BM_mesh_elem_table_check(BMesh *bm);

View File

@ -200,8 +200,9 @@ char BM_mesh_cd_flag_from_bmesh(BMesh *bm)
}
/* Static function for alloc (duplicate in modifiers_bmesh.c) */
static BMFace *bm_face_create_from_mpoly(MPoly *mp, MLoop *ml,
BMesh *bm, BMVert **vtable, BMEdge **etable)
static BMFace *bm_face_create_from_mpoly(
MPoly *mp, MLoop *ml,
BMesh *bm, BMVert **vtable, BMEdge **etable)
{
BMVert **verts = BLI_array_alloca(verts, mp->totloop);
BMEdge **edges = BLI_array_alloca(edges, mp->totloop);
@ -221,8 +222,9 @@ static BMFace *bm_face_create_from_mpoly(MPoly *mp, MLoop *ml,
*
* \warning This function doesn't calculate face normals.
*/
void BM_mesh_bm_from_me(BMesh *bm, Mesh *me,
const bool calc_face_normal, const bool set_key, int act_key_nr)
void BM_mesh_bm_from_me(
BMesh *bm, Mesh *me,
const bool calc_face_normal, const bool set_key, int act_key_nr)
{
MVert *mvert;
MEdge *medge;

View File

@ -39,8 +39,9 @@ void BM_mesh_cd_flag_ensure(BMesh *bm, struct Mesh *mesh, const char cd_flag);
void BM_mesh_cd_flag_apply(BMesh *bm, const char cd_flag);
char BM_mesh_cd_flag_from_bmesh(BMesh *bm);
void BM_mesh_bm_from_me(BMesh *bm, struct Mesh *me,
const bool calc_face_normal, const bool set_key, int act_key_nr);
void BM_mesh_bm_from_me(
BMesh *bm, struct Mesh *me,
const bool calc_face_normal, const bool set_key, int act_key_nr);
void BM_mesh_bm_to_me(BMesh *bm, struct Mesh *me, bool do_tessface);
#endif /* __BMESH_MESH_CONV_H__ */

View File

@ -276,10 +276,11 @@ BMFace *BM_faces_join_pair(BMesh *bm, BMFace *f_a, BMFace *f_b, BMEdge *e, const
* if the split is successful (and the original original face will be the
* other side). NULL if the split fails.
*/
BMFace *BM_face_split(BMesh *bm, BMFace *f,
BMLoop *l_a, BMLoop *l_b,
BMLoop **r_l, BMEdge *example,
const bool no_double)
BMFace *BM_face_split(
BMesh *bm, BMFace *f,
BMLoop *l_a, BMLoop *l_b,
BMLoop **r_l, BMEdge *example,
const bool no_double)
{
const bool has_mdisp = CustomData_has_layer(&bm->ldata, CD_MDISPS);
BMFace *f_new, *f_tmp;
@ -357,10 +358,11 @@ BMFace *BM_face_split(BMesh *bm, BMFace *f,
* if the split is successful (and the original original face will be the
* other side). NULL if the split fails.
*/
BMFace *BM_face_split_n(BMesh *bm, BMFace *f,
BMLoop *l_a, BMLoop *l_b,
float cos[][3], int n,
BMLoop **r_l, BMEdge *example)
BMFace *BM_face_split_n(
BMesh *bm, BMFace *f,
BMLoop *l_a, BMLoop *l_b,
float cos[][3], int n,
BMLoop **r_l, BMEdge *example)
{
BMFace *f_new, *f_tmp;
BMLoop *l_dummy;
@ -991,8 +993,9 @@ bool BM_face_split_edgenet(
*
* \returns The New Edge
*/
BMEdge *BM_vert_collapse_faces(BMesh *bm, BMEdge *e_kill, BMVert *v_kill, float fac,
const bool do_del, const bool join_faces, const bool kill_degenerate_faces)
BMEdge *BM_vert_collapse_faces(
BMesh *bm, BMEdge *e_kill, BMVert *v_kill, float fac,
const bool do_del, const bool join_faces, const bool kill_degenerate_faces)
{
BMEdge *e_new = NULL;
BMVert *tv = BM_edge_other_vert(e_kill, v_kill);
@ -1104,8 +1107,9 @@ BMEdge *BM_vert_collapse_faces(BMesh *bm, BMEdge *e_kill, BMVert *v_kill, float
*
* \return The New Edge
*/
BMEdge *BM_vert_collapse_edge(BMesh *bm, BMEdge *e_kill, BMVert *v_kill,
const bool do_del, const bool kill_degenerate_faces)
BMEdge *BM_vert_collapse_edge(
BMesh *bm, BMEdge *e_kill, BMVert *v_kill,
const bool do_del, const bool kill_degenerate_faces)
{
/* nice example implementation but we want loops to have their customdata
* accounted for */
@ -1354,8 +1358,9 @@ bool BM_face_validate(BMFace *face, FILE *err)
*
* \note #BM_edge_rotate_check must have already run.
*/
void BM_edge_calc_rotate(BMEdge *e, const bool ccw,
BMLoop **r_l1, BMLoop **r_l2)
void BM_edge_calc_rotate(
BMEdge *e, const bool ccw,
BMLoop **r_l1, BMLoop **r_l2)
{
BMVert *v1, *v2;
BMFace *fa, *fb;
@ -1517,8 +1522,9 @@ bool BM_edge_rotate_check_degenerate(BMEdge *e, BMLoop *l1, BMLoop *l2)
return true;
}
bool BM_edge_rotate_check_beauty(BMEdge *e,
BMLoop *l1, BMLoop *l2)
bool BM_edge_rotate_check_beauty(
BMEdge *e,
BMLoop *l1, BMLoop *l2)
{
/* Stupid check for now:
* Could compare angles of surrounding edges

View File

@ -35,24 +35,29 @@ bool BM_disk_dissolve(BMesh *bm, BMVert *v);
BMFace *BM_faces_join_pair(BMesh *bm, BMFace *f1, BMFace *f2, BMEdge *e, const bool do_del);
BMFace *BM_face_split(BMesh *bm, BMFace *f,
BMLoop *l_a, BMLoop *l_b,
BMLoop **r_l,
BMEdge *example, const bool no_double);
BMFace *BM_face_split(
BMesh *bm, BMFace *f,
BMLoop *l_a, BMLoop *l_b,
BMLoop **r_l,
BMEdge *example, const bool no_double);
BMFace *BM_face_split_n(BMesh *bm, BMFace *f,
BMLoop *l_a, BMLoop *l_b,
float cos[][3], int n,
BMLoop **r_l, BMEdge *example);
BMFace *BM_face_split_n(
BMesh *bm, BMFace *f,
BMLoop *l_a, BMLoop *l_b,
float cos[][3], int n,
BMLoop **r_l, BMEdge *example);
bool BM_face_split_edgenet(BMesh *bm, BMFace *f,
BMEdge **edge_net, const int edge_net_len,
BMFace ***r_face_arr, int *r_face_arr_len);
bool BM_face_split_edgenet(
BMesh *bm, BMFace *f,
BMEdge **edge_net, const int edge_net_len,
BMFace ***r_face_arr, int *r_face_arr_len);
BMEdge *BM_vert_collapse_faces(BMesh *bm, BMEdge *e_kill, BMVert *v_kill, float fac,
const bool do_del, const bool join_faces, const bool kill_degenerate_faces);
BMEdge *BM_vert_collapse_edge(BMesh *bm, BMEdge *e_kill, BMVert *v_kill,
const bool do_del, const bool kill_degenerate_faces);
BMEdge *BM_vert_collapse_faces(
BMesh *bm, BMEdge *e_kill, BMVert *v_kill, float fac,
const bool do_del, const bool join_faces, const bool kill_degenerate_faces);
BMEdge *BM_vert_collapse_edge(
BMesh *bm, BMEdge *e_kill, BMVert *v_kill,
const bool do_del, const bool kill_degenerate_faces);
BMVert *BM_edge_split(BMesh *bm, BMEdge *e, BMVert *v, BMEdge **r_e, float percent);
@ -61,13 +66,16 @@ BMVert *BM_edge_split_n(BMesh *bm, BMEdge *e, int numcuts, BMVert **r_varr);
bool BM_face_validate(BMFace *face, FILE *err);
void BM_edge_calc_rotate(BMEdge *e, const bool ccw,
BMLoop **r_l1, BMLoop **r_l2);
void BM_edge_calc_rotate(
BMEdge *e, const bool ccw,
BMLoop **r_l1, BMLoop **r_l2);
bool BM_edge_rotate_check(BMEdge *e);
bool BM_edge_rotate_check_degenerate(BMEdge *e,
BMLoop *l1, BMLoop *l2);
bool BM_edge_rotate_check_beauty(BMEdge *e,
BMLoop *l1, BMLoop *l2);
bool BM_edge_rotate_check_degenerate(
BMEdge *e,
BMLoop *l1, BMLoop *l2);
bool BM_edge_rotate_check_beauty(
BMEdge *e,
BMLoop *l1, BMLoop *l2);
BMEdge *BM_edge_rotate(BMesh *bm, BMEdge *e, const bool ccw, const short check_flag);
/* flags for BM_edge_rotate */

View File

@ -273,9 +273,10 @@ BMOpSlot *BMO_slot_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *identif
(op_dst)->slots_dst, slot_name_dst, \
(op_dst)->arena)
void _bmo_slot_copy(BMOpSlot slot_args_src[BMO_OP_MAX_SLOTS], const char *slot_name_src,
BMOpSlot slot_args_dst[BMO_OP_MAX_SLOTS], const char *slot_name_dst,
struct MemArena *arena_dst);
void _bmo_slot_copy(
BMOpSlot slot_args_src[BMO_OP_MAX_SLOTS], const char *slot_name_src,
BMOpSlot slot_args_dst[BMO_OP_MAX_SLOTS], const char *slot_name_dst,
struct MemArena *arena_dst);
/* del "context" slot values, used for operator too */
enum {
@ -335,11 +336,12 @@ void BMO_slot_mat3_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_na
void BMO_mesh_flag_disable_all(BMesh *bm, BMOperator *op, const char htype, const short oflag);
void BMO_mesh_selected_remap(BMesh *bm,
BMOpSlot *slot_vert_map,
BMOpSlot *slot_edge_map,
BMOpSlot *slot_face_map,
const bool check_select);
void BMO_mesh_selected_remap(
BMesh *bm,
BMOpSlot *slot_vert_map,
BMOpSlot *slot_edge_map,
BMOpSlot *slot_face_map,
const bool check_select);
/* copies the values from another slot to the end of the output slot */
#define BMO_slot_buffer_append(op_src, slots_src, slot_name_src, \
@ -347,53 +349,62 @@ void BMO_mesh_selected_remap(BMesh *bm,
_bmo_slot_buffer_append((op_src)->slots_src, slot_name_src, \
(op_dst)->slots_dst, slot_name_dst, \
(op_dst)->arena)
void _bmo_slot_buffer_append(BMOpSlot slot_args_dst[BMO_OP_MAX_SLOTS], const char *slot_name_dst,
BMOpSlot slot_args_src[BMO_OP_MAX_SLOTS], const char *slot_name_src,
struct MemArena *arena_dst);
void _bmo_slot_buffer_append(
BMOpSlot slot_args_dst[BMO_OP_MAX_SLOTS], const char *slot_name_dst,
BMOpSlot slot_args_src[BMO_OP_MAX_SLOTS], const char *slot_name_src,
struct MemArena *arena_dst);
/* puts every element of type 'type' (which is a bitmask) with tool
* flag 'flag', into a slot. */
void BMO_slot_buffer_from_enabled_flag(BMesh *bm, BMOperator *op,
BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
const char htype, const short oflag);
void BMO_slot_buffer_from_enabled_flag(
BMesh *bm, BMOperator *op,
BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
const char htype, const short oflag);
/* puts every element of type 'type' (which is a bitmask) without tool
* flag 'flag', into a slot. */
void BMO_slot_buffer_from_disabled_flag(BMesh *bm, BMOperator *op,
BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
const char htype, const short oflag);
void BMO_slot_buffer_from_disabled_flag(
BMesh *bm, BMOperator *op,
BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
const char htype, const short oflag);
/* tool-flags all elements inside an element slot array with flag flag. */
void BMO_slot_buffer_flag_enable(BMesh *bm,
BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
const char htype, const short oflag);
void BMO_slot_buffer_flag_enable(
BMesh *bm,
BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
const char htype, const short oflag);
/* clears tool-flag flag from all elements inside a slot array. */
void BMO_slot_buffer_flag_disable(BMesh *bm,
BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
const char htype, const short oflag);
void BMO_slot_buffer_flag_disable(
BMesh *bm,
BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
const char htype, const short oflag);
/* tool-flags all elements inside an element slot array with flag flag. */
void BMO_slot_buffer_hflag_enable(BMesh *bm,
BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
const char htype, const char hflag, const bool do_flush);
void BMO_slot_buffer_hflag_enable(
BMesh *bm,
BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
const char htype, const char hflag, const bool do_flush);
/* clears tool-flag flag from all elements inside a slot array. */
void BMO_slot_buffer_hflag_disable(BMesh *bm,
BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
const char htype, const char hflag, const bool do_flush);
void BMO_slot_buffer_hflag_disable(
BMesh *bm,
BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
const char htype, const char hflag, const bool do_flush);
/* puts every element of type 'type' (which is a bitmask) with header
* flag 'flag', into a slot. note: ignores hidden elements
* (e.g. elements with header flag BM_ELEM_HIDDEN set).*/
void BMO_slot_buffer_from_enabled_hflag(BMesh *bm, BMOperator *op,
BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
const char htype, const char hflag);
void BMO_slot_buffer_from_enabled_hflag(
BMesh *bm, BMOperator *op,
BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
const char htype, const char hflag);
/* puts every element of type 'type' (which is a bitmask) without
* header flag 'flag', into a slot. note: ignores hidden elements
* (e.g. elements with header flag BM_ELEM_HIDDEN set).*/
void BMO_slot_buffer_from_disabled_hflag(BMesh *bm, BMOperator *op,
BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
const char htype, const char hflag);
void BMO_slot_buffer_from_disabled_hflag(
BMesh *bm, BMOperator *op,
BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
const char htype, const char hflag);
void BMO_slot_buffer_from_array(BMOperator *op, BMOpSlot *slot, BMHeader **ele_buffer, int ele_buffer_len);
@ -405,19 +416,23 @@ void *BMO_slot_buffer_get_single(BMOpSlot *slot);
int BMO_slot_buffer_count(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name);
int BMO_slot_map_count(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name);
void BMO_slot_map_insert(BMOperator *op, BMOpSlot *slot,
const void *element, const void *data);
void BMO_slot_map_insert(
BMOperator *op, BMOpSlot *slot,
const void *element, const void *data);
/* flags all elements in a mapping. note that the mapping must only have
* bmesh elements in it.*/
void BMO_slot_map_to_flag(BMesh *bm, BMOpSlot slot_args[BMO_OP_MAX_SLOTS],
const char *slot_name, const char hflag, const short oflag);
void BMO_slot_map_to_flag(
BMesh *bm, BMOpSlot slot_args[BMO_OP_MAX_SLOTS],
const char *slot_name, const char hflag, const short oflag);
void *BMO_slot_buffer_alloc(BMOperator *op, BMOpSlot slot_args[BMO_OP_MAX_SLOTS],
const char *slot_name, const int len);
void *BMO_slot_buffer_alloc(
BMOperator *op, BMOpSlot slot_args[BMO_OP_MAX_SLOTS],
const char *slot_name, const int len);
void BMO_slot_buffer_from_all(BMesh *bm, BMOperator *op, BMOpSlot slot_args[BMO_OP_MAX_SLOTS],
const char *slot_name, const char htype);
void BMO_slot_buffer_from_all(
BMesh *bm, BMOperator *op, BMOpSlot slot_args[BMO_OP_MAX_SLOTS],
const char *slot_name, const char htype);
/**
* This part of the API is used to iterate over element buffer or
@ -466,9 +481,10 @@ typedef struct BMOIter {
void *BMO_slot_buffer_get_first(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name);
void *BMO_iter_new(BMOIter *iter,
BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
const char restrictmask);
void *BMO_iter_new(
BMOIter *iter,
BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
const char restrictmask);
void *BMO_iter_step(BMOIter *iter);
void **BMO_iter_map_value_p(BMOIter *iter);

View File

@ -69,24 +69,27 @@ BLI_INLINE void _bmo_elem_flag_toggle(BMesh *bm, BMFlagLayer *oflags, const shor
oflags[bm->stackdepth - 1].f ^= oflag;
}
BLI_INLINE void BMO_slot_map_int_insert(BMOperator *op, BMOpSlot *slot,
void *element, const int val)
BLI_INLINE void BMO_slot_map_int_insert(
BMOperator *op, BMOpSlot *slot,
void *element, const int val)
{
union { void *ptr; int val; } t = {NULL};
BLI_assert(slot->slot_subtype.map == BMO_OP_SLOT_SUBTYPE_MAP_INT);
BMO_slot_map_insert(op, slot, element, ((t.val = val), t.ptr));
}
BLI_INLINE void BMO_slot_map_bool_insert(BMOperator *op, BMOpSlot *slot,
void *element, const bool val)
BLI_INLINE void BMO_slot_map_bool_insert(
BMOperator *op, BMOpSlot *slot,
void *element, const bool val)
{
union { void *ptr; bool val; } t = {NULL};
BLI_assert(slot->slot_subtype.map == BMO_OP_SLOT_SUBTYPE_MAP_BOOL);
BMO_slot_map_insert(op, slot, element, ((t.val = val), t.ptr));
}
BLI_INLINE void BMO_slot_map_float_insert(BMOperator *op, BMOpSlot *slot,
void *element, const float val)
BLI_INLINE void BMO_slot_map_float_insert(
BMOperator *op, BMOpSlot *slot,
void *element, const float val)
{
union { void *ptr; float val; } t = {NULL};
BLI_assert(slot->slot_subtype.map == BMO_OP_SLOT_SUBTYPE_MAP_FLT);
@ -99,15 +102,17 @@ BLI_INLINE void BMO_slot_map_float_insert(BMOperator *op, BMOpSlot *slot,
* do NOT use these for non-operator-api-allocated memory! instead
* use BMO_slot_map_data_get and BMO_slot_map_insert, which copies the data. */
BLI_INLINE void BMO_slot_map_ptr_insert(BMOperator *op, BMOpSlot *slot,
const void *element, void *val)
BLI_INLINE void BMO_slot_map_ptr_insert(
BMOperator *op, BMOpSlot *slot,
const void *element, void *val)
{
BLI_assert(slot->slot_subtype.map == BMO_OP_SLOT_SUBTYPE_MAP_INTERNAL);
BMO_slot_map_insert(op, slot, element, val);
}
BLI_INLINE void BMO_slot_map_elem_insert(BMOperator *op, BMOpSlot *slot,
const void *element, void *val)
BLI_INLINE void BMO_slot_map_elem_insert(
BMOperator *op, BMOpSlot *slot,
const void *element, void *val)
{
BLI_assert(slot->slot_subtype.map == BMO_OP_SLOT_SUBTYPE_MAP_ELEM);
BMO_slot_map_insert(op, slot, element, val);
@ -115,8 +120,9 @@ BLI_INLINE void BMO_slot_map_elem_insert(BMOperator *op, BMOpSlot *slot,
/* no values */
BLI_INLINE void BMO_slot_map_empty_insert(BMOperator *op, BMOpSlot *slot,
const void *element)
BLI_INLINE void BMO_slot_map_empty_insert(
BMOperator *op, BMOpSlot *slot,
const void *element)
{
BLI_assert(slot->slot_subtype.map == BMO_OP_SLOT_SUBTYPE_MAP_EMPTY);
BMO_slot_map_insert(op, slot, element, NULL);

View File

@ -281,9 +281,10 @@ BMOpSlot *BMO_slot_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *identif
* define used.
* Copies data from one slot to another.
*/
void _bmo_slot_copy(BMOpSlot slot_args_src[BMO_OP_MAX_SLOTS], const char *slot_name_src,
BMOpSlot slot_args_dst[BMO_OP_MAX_SLOTS], const char *slot_name_dst,
struct MemArena *arena_dst)
void _bmo_slot_copy(
BMOpSlot slot_args_src[BMO_OP_MAX_SLOTS], const char *slot_name_src,
BMOpSlot slot_args_dst[BMO_OP_MAX_SLOTS], const char *slot_name_dst,
struct MemArena *arena_dst)
{
BMOpSlot *slot_src = BMO_slot_get(slot_args_src, slot_name_src);
BMOpSlot *slot_dst = BMO_slot_get(slot_args_dst, slot_name_dst);
@ -543,8 +544,9 @@ void BMO_slot_vec_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_nam
*
*/
static int bmo_mesh_flag_count(BMesh *bm, const char htype, const short oflag,
const bool test_for_enabled)
static int bmo_mesh_flag_count(
BMesh *bm, const char htype, const short oflag,
const bool test_for_enabled)
{
const char iter_types[3] = {BM_VERTS_OF_MESH,
BM_EDGES_OF_MESH,
@ -602,11 +604,12 @@ void BMO_mesh_flag_disable_all(BMesh *bm, BMOperator *UNUSED(op), const char hty
}
}
void BMO_mesh_selected_remap(BMesh *bm,
BMOpSlot *slot_vert_map,
BMOpSlot *slot_edge_map,
BMOpSlot *slot_face_map,
const bool check_select)
void BMO_mesh_selected_remap(
BMesh *bm,
BMOpSlot *slot_vert_map,
BMOpSlot *slot_edge_map,
BMOpSlot *slot_face_map,
const bool check_select)
{
if (bm->selected.first) {
BMEditSelection *ese, *ese_next;
@ -663,8 +666,9 @@ int BMO_slot_map_count(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_na
/* inserts a key/value mapping into a mapping slot. note that it copies the
* value, it doesn't store a reference to it. */
void BMO_slot_map_insert(BMOperator *op, BMOpSlot *slot,
const void *element, const void *data)
void BMO_slot_map_insert(
BMOperator *op, BMOpSlot *slot,
const void *element, const void *data)
{
(void) op; /* Ignored in release builds. */
@ -717,8 +721,9 @@ void *bmo_slot_buffer_grow(BMesh *bm, BMOperator *op, int slot_code, int totadd)
}
#endif
void BMO_slot_map_to_flag(BMesh *bm, BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
const char htype, const short oflag)
void BMO_slot_map_to_flag(
BMesh *bm, BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
const char htype, const short oflag)
{
GHashIterator gh_iter;
BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
@ -759,8 +764,9 @@ void *BMO_slot_buffer_alloc(BMOperator *op, BMOpSlot slot_args[BMO_OP_MAX_SLOTS]
*
* Copies all elements of a certain type into an operator slot.
*/
void BMO_slot_buffer_from_all(BMesh *bm, BMOperator *op, BMOpSlot slot_args[BMO_OP_MAX_SLOTS],
const char *slot_name, const char htype)
void BMO_slot_buffer_from_all(
BMesh *bm, BMOperator *op, BMOpSlot slot_args[BMO_OP_MAX_SLOTS],
const char *slot_name, const char htype)
{
BMOpSlot *output = BMO_slot_get(slot_args, slot_name);
int totelement = 0, i = 0;
@ -809,9 +815,10 @@ void BMO_slot_buffer_from_all(BMesh *bm, BMOperator *op, BMOpSlot slot_args[BMO_
* Copies elements of a certain type, which have a certain header flag
* enabled/disabled into a slot for an operator.
*/
static void bmo_slot_buffer_from_hflag(BMesh *bm, BMOperator *op, BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
const char htype, const char hflag,
const bool test_for_enabled)
static void bmo_slot_buffer_from_hflag(
BMesh *bm, BMOperator *op, BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
const char htype, const char hflag,
const bool test_for_enabled)
{
BMOpSlot *output = BMO_slot_get(slot_args, slot_name);
int totelement = 0, i = 0;
@ -872,16 +879,18 @@ static void bmo_slot_buffer_from_hflag(BMesh *bm, BMOperator *op, BMOpSlot slot_
}
}
void BMO_slot_buffer_from_enabled_hflag(BMesh *bm, BMOperator *op,
BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
const char htype, const char hflag)
void BMO_slot_buffer_from_enabled_hflag(
BMesh *bm, BMOperator *op,
BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
const char htype, const char hflag)
{
bmo_slot_buffer_from_hflag(bm, op, slot_args, slot_name, htype, hflag, true);
}
void BMO_slot_buffer_from_disabled_hflag(BMesh *bm, BMOperator *op,
BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
const char htype, const char hflag)
void BMO_slot_buffer_from_disabled_hflag(
BMesh *bm, BMOperator *op,
BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
const char htype, const char hflag)
{
bmo_slot_buffer_from_hflag(bm, op, slot_args, slot_name, htype, hflag, false);
}
@ -927,9 +936,10 @@ void *BMO_slot_buffer_get_single(BMOpSlot *slot)
/**
* Copies the values from another slot to the end of the output slot.
*/
void _bmo_slot_buffer_append(BMOpSlot slot_args_dst[BMO_OP_MAX_SLOTS], const char *slot_name_dst,
BMOpSlot slot_args_src[BMO_OP_MAX_SLOTS], const char *slot_name_src,
struct MemArena *arena_dst)
void _bmo_slot_buffer_append(
BMOpSlot slot_args_dst[BMO_OP_MAX_SLOTS], const char *slot_name_dst,
BMOpSlot slot_args_src[BMO_OP_MAX_SLOTS], const char *slot_name_src,
struct MemArena *arena_dst)
{
BMOpSlot *slot_dst = BMO_slot_get(slot_args_dst, slot_name_dst);
BMOpSlot *slot_src = BMO_slot_get(slot_args_src, slot_name_src);
@ -964,10 +974,11 @@ void _bmo_slot_buffer_append(BMOpSlot slot_args_dst[BMO_OP_MAX_SLOTS], const cha
* Copies elements of a certain type, which have a certain flag set
* into an output slot for an operator.
*/
static void bmo_slot_buffer_from_flag(BMesh *bm, BMOperator *op,
BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
const char htype, const short oflag,
const bool test_for_enabled)
static void bmo_slot_buffer_from_flag(
BMesh *bm, BMOperator *op,
BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
const char htype, const short oflag,
const bool test_for_enabled)
{
BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
int totelement, i = 0;
@ -1026,16 +1037,18 @@ static void bmo_slot_buffer_from_flag(BMesh *bm, BMOperator *op,
}
}
void BMO_slot_buffer_from_enabled_flag(BMesh *bm, BMOperator *op,
BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
const char htype, const short oflag)
void BMO_slot_buffer_from_enabled_flag(
BMesh *bm, BMOperator *op,
BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
const char htype, const short oflag)
{
bmo_slot_buffer_from_flag(bm, op, slot_args, slot_name, htype, oflag, true);
}
void BMO_slot_buffer_from_disabled_flag(BMesh *bm, BMOperator *op,
BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
const char htype, const short oflag)
void BMO_slot_buffer_from_disabled_flag(
BMesh *bm, BMOperator *op,
BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
const char htype, const short oflag)
{
bmo_slot_buffer_from_flag(bm, op, slot_args, slot_name, htype, oflag, false);
}
@ -1046,9 +1059,10 @@ void BMO_slot_buffer_from_disabled_flag(BMesh *bm, BMOperator *op,
* Header Flags elements in a slots buffer, automatically
* using the selection API where appropriate.
*/
void BMO_slot_buffer_hflag_enable(BMesh *bm,
BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
const char htype, const char hflag, const bool do_flush)
void BMO_slot_buffer_hflag_enable(
BMesh *bm,
BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
const char htype, const char hflag, const bool do_flush)
{
BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
BMElem **data = (BMElem **)slot->data.buf;
@ -1082,9 +1096,10 @@ void BMO_slot_buffer_hflag_enable(BMesh *bm,
* Removes flags from elements in a slots buffer, automatically
* using the selection API where appropriate.
*/
void BMO_slot_buffer_hflag_disable(BMesh *bm,
BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
const char htype, const char hflag, const bool do_flush)
void BMO_slot_buffer_hflag_disable(
BMesh *bm,
BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
const char htype, const char hflag, const bool do_flush)
{
BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
BMElem **data = (BMElem **)slot->data.buf;
@ -1116,9 +1131,10 @@ void BMO_slot_buffer_hflag_disable(BMesh *bm,
*
* Flags elements in a slots buffer
*/
void BMO_slot_buffer_flag_enable(BMesh *bm,
BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
const char htype, const short oflag)
void BMO_slot_buffer_flag_enable(
BMesh *bm,
BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
const char htype, const short oflag)
{
BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
BMHeader **data = slot->data.p;
@ -1140,9 +1156,10 @@ void BMO_slot_buffer_flag_enable(BMesh *bm,
*
* Removes flags from elements in a slots buffer
*/
void BMO_slot_buffer_flag_disable(BMesh *bm,
BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
const char htype, const short oflag)
void BMO_slot_buffer_flag_disable(
BMesh *bm,
BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
const char htype, const short oflag)
{
BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
BMHeader **data = (BMHeader **)slot->data.buf;
@ -1394,9 +1411,10 @@ void *BMO_slot_buffer_get_first(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char
* \param restrictmask restricts the iteration to certain element types
* (e.g. combination of BM_VERT, BM_EDGE, BM_FACE), if iterating
* over an element buffer (not a mapping). */
void *BMO_iter_new(BMOIter *iter,
BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
const char restrictmask)
void *BMO_iter_new(
BMOIter *iter,
BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
const char restrictmask)
{
BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);

View File

@ -130,14 +130,15 @@ extern const BMOpDefine *bmo_opdefines[];
extern const int bmo_opdefines_total;
/*------specific operator helper functions-------*/
void BM_mesh_esubdivide(BMesh *bm, const char edge_hflag,
const float smooth, const short smooth_falloff, const bool use_smooth_even,
const float fractal, const float along_normal,
const int numcuts,
const int seltype, const int cornertype,
const short use_single_edge, const short use_grid_fill,
const short use_only_quads,
const int seed);
void BM_mesh_esubdivide(
BMesh *bm, const char edge_hflag,
const float smooth, const short smooth_falloff, const bool use_smooth_even,
const float fractal, const float along_normal,
const int numcuts,
const int seltype, const int cornertype,
const short use_single_edge, const short use_grid_fill,
const short use_only_quads,
const int seed);
#include "intern/bmesh_operator_api_inline.h"

View File

@ -102,8 +102,9 @@ static float bm_face_calc_poly_normal(const BMFace *f, float n[3])
* Same as #calc_poly_normal and #bm_face_calc_poly_normal
* but takes an array of vertex locations.
*/
static float bm_face_calc_poly_normal_vertex_cos(BMFace *f, float r_no[3],
float const (*vertexCos)[3])
static float bm_face_calc_poly_normal_vertex_cos(
BMFace *f, float r_no[3],
float const (*vertexCos)[3])
{
BMLoop *l_first = BM_FACE_FIRST_LOOP(f);
BMLoop *l_iter = l_first;
@ -127,8 +128,9 @@ static float bm_face_calc_poly_normal_vertex_cos(BMFace *f, float r_no[3],
/**
* \brief COMPUTE POLY CENTER (BMFace)
*/
static void bm_face_calc_poly_center_mean_vertex_cos(BMFace *f, float r_cent[3],
float const (*vertexCos)[3])
static void bm_face_calc_poly_center_mean_vertex_cos(
BMFace *f, float r_cent[3],
float const (*vertexCos)[3])
{
BMLoop *l_first = BM_FACE_FIRST_LOOP(f);
BMLoop *l_iter = l_first;
@ -548,8 +550,9 @@ void BM_face_normal_update(BMFace *f)
}
/* exact same as 'BM_face_calc_normal' but accepts vertex coords */
float BM_face_calc_normal_vcos(BMesh *bm, BMFace *f, float r_no[3],
float const (*vertexCos)[3])
float BM_face_calc_normal_vcos(
BMesh *bm, BMFace *f, float r_no[3],
float const (*vertexCos)[3])
{
BMLoop *l;
@ -607,8 +610,9 @@ float BM_face_calc_normal_subset(BMLoop *l_first, BMLoop *l_last, float r_no[3])
}
/* exact same as 'BM_face_calc_normal' but accepts vertex coords */
void BM_face_calc_center_mean_vcos(BMesh *bm, BMFace *f, float r_cent[3],
float const (*vertexCos)[3])
void BM_face_calc_center_mean_vcos(
BMesh *bm, BMFace *f, float r_cent[3],
float const (*vertexCos)[3])
{
/* must have valid index data */
BLI_assert((bm->elem_index_dirty & BM_VERT) == 0);

View File

@ -36,16 +36,18 @@ void BM_bmesh_calc_tessellation(BMesh *bm, BMLoop *(*looptris)[3], int *r_loopt
void BM_face_calc_tessellation(const BMFace *f, BMLoop **r_loops, unsigned int (*r_index)[3]);
float BM_face_calc_normal(const BMFace *f, float r_no[3]) ATTR_NONNULL();
float BM_face_calc_normal_vcos(BMesh *bm, BMFace *f, float r_no[3],
float const (*vertexCos)[3]) ATTR_NONNULL();
float BM_face_calc_normal_vcos(
BMesh *bm, BMFace *f, float r_no[3],
float const (*vertexCos)[3]) ATTR_NONNULL();
float BM_face_calc_normal_subset(BMLoop *l_first, BMLoop *l_last, float r_no[3]) ATTR_NONNULL();
float BM_face_calc_area(BMFace *f) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
float BM_face_calc_perimeter(BMFace *f) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
void BM_face_calc_plane(BMFace *f, float r_plane[3]) ATTR_NONNULL();
void BM_face_calc_center_bounds(BMFace *f, float center[3]) ATTR_NONNULL();
void BM_face_calc_center_mean(BMFace *f, float center[3]) ATTR_NONNULL();
void BM_face_calc_center_mean_vcos(BMesh *bm, BMFace *f, float r_cent[3],
float const (*vertexCos)[3]) ATTR_NONNULL();
void BM_face_calc_center_mean_vcos(
BMesh *bm, BMFace *f, float r_cent[3],
float const (*vertexCos)[3]) ATTR_NONNULL();
void BM_face_calc_center_mean_weighted(BMFace *f, float center[3]) ATTR_NONNULL();
void BM_face_normal_update(BMFace *f) ATTR_NONNULL();

View File

@ -1184,8 +1184,9 @@ BMLoop *BM_face_edge_share_loop(BMFace *f, BMEdge *e)
* \note This is in fact quite a simple check, mainly include this function so the intent is more obvious.
* We know these 2 verts will _always_ make up the loops edge
*/
void BM_edge_ordered_verts_ex(const BMEdge *edge, BMVert **r_v1, BMVert **r_v2,
const BMLoop *edge_loop)
void BM_edge_ordered_verts_ex(
const BMEdge *edge, BMVert **r_v1, BMVert **r_v2,
const BMLoop *edge_loop)
{
BLI_assert(edge_loop->e == edge);
(void)edge; /* quiet warning in release build */
@ -2128,9 +2129,10 @@ float BM_mesh_calc_volume(BMesh *bm, bool is_signed)
* (having both set is supported too).
* \return The number of groups found.
*/
int BM_mesh_calc_face_groups(BMesh *bm, int *r_groups_array, int (**r_group_index)[2],
BMElemFilterFunc filter_fn, void *user_data,
const char hflag_test, const char htype_step)
int BM_mesh_calc_face_groups(
BMesh *bm, int *r_groups_array, int (**r_group_index)[2],
BMElemFilterFunc filter_fn, void *user_data,
const char hflag_test, const char htype_step)
{
#ifdef DEBUG
int group_index_len = 1;
@ -2285,9 +2287,10 @@ int BM_mesh_calc_face_groups(BMesh *bm, int *r_groups_array, int (**r_group_inde
* \note Unlike #BM_mesh_calc_face_groups there is no 'htype_step' argument,
* since we always walk over verts.
*/
int BM_mesh_calc_edge_groups(BMesh *bm, int *r_groups_array, int (**r_group_index)[2],
BMElemFilterFunc filter_fn, void *user_data,
const char hflag_test)
int BM_mesh_calc_edge_groups(
BMesh *bm, int *r_groups_array, int (**r_group_index)[2],
BMElemFilterFunc filter_fn, void *user_data,
const char hflag_test)
{
#ifdef DEBUG
int group_index_len = 1;

View File

@ -142,8 +142,9 @@ BMLoop *BM_face_vert_share_loop(BMFace *f, BMVert *v) ATTR_WARN_UNUSED_RESULT AT
BMLoop *BM_face_edge_share_loop(BMFace *f, BMEdge *e) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
void BM_edge_ordered_verts(const BMEdge *edge, BMVert **r_v1, BMVert **r_v2) ATTR_NONNULL();
void BM_edge_ordered_verts_ex(const BMEdge *edge, BMVert **r_v1, BMVert **r_v2,
const BMLoop *edge_loop) ATTR_NONNULL();
void BM_edge_ordered_verts_ex(
const BMEdge *edge, BMVert **r_v1, BMVert **r_v2,
const BMLoop *edge_loop) ATTR_NONNULL();
bool BM_vert_is_all_edge_flag_test(const BMVert *v, const char hflag, const bool respect_hide) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
bool BM_vert_is_all_face_flag_test(const BMVert *v, const char hflag, const bool respect_hide) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
@ -157,12 +158,16 @@ bool BM_face_is_normal_valid(const BMFace *f) ATTR_WARN_UNUSED_RESULT ATTR_NONNU
float BM_mesh_calc_volume(BMesh *bm, bool is_signed) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
int BM_mesh_calc_face_groups(BMesh *bm, int *r_groups_array, int (**r_group_index)[2],
BMElemFilterFunc filter_fn, void *user_data,
const char hflag_test, const char htype_step) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1, 2, 3);
int BM_mesh_calc_edge_groups(BMesh *bm, int *r_groups_array, int (**r_group_index)[2],
BMElemFilterFunc filter_fn, void *user_data,
const char hflag_test) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1, 2, 3);
int BM_mesh_calc_face_groups(
BMesh *bm, int *r_groups_array, int (**r_group_index)[2],
BMElemFilterFunc filter_fn, void *user_data,
const char hflag_test, const char htype_step)
ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1, 2, 3);
int BM_mesh_calc_edge_groups(
BMesh *bm, int *r_groups_array, int (**r_group_index)[2],
BMElemFilterFunc filter_fn, void *user_data,
const char hflag_test)
ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1, 2, 3);
/* not really any good place to put this */
float bmesh_subd_falloff_calc(const int falloff, float val) ATTR_WARN_UNUSED_RESULT;

View File

@ -74,10 +74,11 @@ void *BMW_begin(BMWalker *walker, void *start)
* a given type. The elements visited are filtered
* by the bitmask 'searchmask'.
*/
void BMW_init(BMWalker *walker, BMesh *bm, int type,
short mask_vert, short mask_edge, short mask_face,
BMWFlag flag,
int layer)
void BMW_init(
BMWalker *walker, BMesh *bm, int type,
short mask_vert, short mask_edge, short mask_face,
BMWFlag flag,
int layer)
{
memset(walker, 0, sizeof(BMWalker));

View File

@ -76,10 +76,11 @@ typedef struct BMWalker {
/* initialize a walker. searchmask restricts some (not all) walkers to
* elements with a specific tool flag set. flags is specific to each walker.*/
void BMW_init(struct BMWalker *walker, BMesh *bm, int type,
short mask_vert, short mask_edge, short mask_face,
BMWFlag flag,
int layer);
void BMW_init(
struct BMWalker *walker, BMesh *bm, int type,
short mask_vert, short mask_edge, short mask_face,
BMWFlag flag,
int layer);
void *BMW_begin(BMWalker *walker, void *start);
void *BMW_step(struct BMWalker *walker);
void BMW_end(struct BMWalker *walker);

View File

@ -274,11 +274,12 @@ BLI_INLINE bool edge_in_array(const BMEdge *e, const BMEdge **edge_array, const
}
/* recalc an edge in the heap (surrounding geometry has changed) */
static void bm_edge_update_beauty_cost_single(BMEdge *e, Heap *eheap, HeapNode **eheap_table, GSet **edge_state_arr,
/* only for testing the edge is in the array */
const BMEdge **edge_array, const int edge_array_len,
static void bm_edge_update_beauty_cost_single(
BMEdge *e, Heap *eheap, HeapNode **eheap_table, GSet **edge_state_arr,
/* only for testing the edge is in the array */
const BMEdge **edge_array, const int edge_array_len,
const short flag, const short method)
const short flag, const short method)
{
if (edge_in_array(e, edge_array, edge_array_len)) {
const int i = BM_elem_index_get(e);
@ -316,10 +317,11 @@ static void bm_edge_update_beauty_cost_single(BMEdge *e, Heap *eheap, HeapNode *
}
/* we have rotated an edge, tag other edges and clear this one */
static void bm_edge_update_beauty_cost(BMEdge *e, Heap *eheap, HeapNode **eheap_table, GSet **edge_state_arr,
const BMEdge **edge_array, const int edge_array_len,
/* only for testing the edge is in the array */
const short flag, const short method)
static void bm_edge_update_beauty_cost(
BMEdge *e, Heap *eheap, HeapNode **eheap_table, GSet **edge_state_arr,
const BMEdge **edge_array, const int edge_array_len,
/* only for testing the edge is in the array */
const short flag, const short method)
{
int i;

View File

@ -244,8 +244,9 @@ static void create_mesh_bmvert(BMesh *bm, VMesh *vm, int i, int j, int k, BMVert
BM_elem_flag_disable(nv->v, BM_ELEM_TAG);
}
static void copy_mesh_vert(VMesh *vm, int ito, int jto, int kto,
int ifrom, int jfrom, int kfrom)
static void copy_mesh_vert(
VMesh *vm, int ito, int jto, int kto,
int ifrom, int jfrom, int kfrom)
{
NewVert *nvto, *nvfrom;
@ -361,8 +362,9 @@ static BMFace *boundvert_rep_face(BoundVert *v)
*
* \note ALL face creation goes through this function, this is important to keep!
*/
static BMFace *bev_create_ngon(BMesh *bm, BMVert **vert_arr, const int totv,
BMFace **face_arr, BMFace *facerep, int mat_nr, bool do_interp)
static BMFace *bev_create_ngon(
BMesh *bm, BMVert **vert_arr, const int totv,
BMFace **face_arr, BMFace *facerep, int mat_nr, bool do_interp)
{
BMIter iter;
BMLoop *l;
@ -402,15 +404,17 @@ static BMFace *bev_create_ngon(BMesh *bm, BMVert **vert_arr, const int totv,
return f;
}
static BMFace *bev_create_quad_tri(BMesh *bm, BMVert *v1, BMVert *v2, BMVert *v3, BMVert *v4,
BMFace *facerep, int mat_nr, bool do_interp)
static BMFace *bev_create_quad_tri(
BMesh *bm, BMVert *v1, BMVert *v2, BMVert *v3, BMVert *v4,
BMFace *facerep, int mat_nr, bool do_interp)
{
BMVert *varr[4] = {v1, v2, v3, v4};
return bev_create_ngon(bm, varr, v4 ? 4 : 3, NULL, facerep, mat_nr, do_interp);
}
static BMFace *bev_create_quad_tri_ex(BMesh *bm, BMVert *v1, BMVert *v2, BMVert *v3, BMVert *v4,
BMFace *f1, BMFace *f2, BMFace *f3, BMFace *f4, int mat_nr)
static BMFace *bev_create_quad_tri_ex(
BMesh *bm, BMVert *v1, BMVert *v2, BMVert *v3, BMVert *v4,
BMFace *f1, BMFace *f2, BMFace *f3, BMFace *f4, int mat_nr)
{
BMVert *varr[4] = {v1, v2, v3, v4};
BMFace *farr[4] = {f1, f2, f3, f4};
@ -419,8 +423,9 @@ static BMFace *bev_create_quad_tri_ex(BMesh *bm, BMVert *v1, BMVert *v2, BMVert
/* Is Loop layer layer_index contiguous across shared vertex of l1 and l2? */
static bool contig_ldata_across_loops(BMesh *bm, BMLoop *l1, BMLoop *l2,
int layer_index)
static bool contig_ldata_across_loops(
BMesh *bm, BMLoop *l1, BMLoop *l2,
int layer_index)
{
const int offset = bm->ldata.layers[layer_index].offset;
const int type = bm->ldata.layers[layer_index].type;
@ -478,7 +483,10 @@ static bool contig_ldata_across_edge(BMesh *bm, BMEdge *e, BMFace *f1, BMFace *f
return true;
}
/* Like bev_create_quad_tri, but when verts straddle an old edge.
/**
* Like #bev_create_quad_tri, but when verts straddle an old edge.
*
* <pre>
* e
* |
* v1+---|---+v4
@ -487,13 +495,16 @@ static bool contig_ldata_across_edge(BMesh *bm, BMEdge *e, BMFace *f1, BMFace *f
* v2+---|---+v3
* |
* f1 | f2
* </pre>
*
* Most CustomData for loops can be interpolated in their respective
* faces' loops, but for UVs and other 'has_math_cd' layers, only
* do this if the UVs are continuous across the edge e, otherwise pick
* one side (f1, arbitrarily), and interpolate them all on that side.
* For face data, use f1 (arbitrarily) as face representative. */
static BMFace *bev_create_quad_straddle(BMesh *bm, BMVert *v1, BMVert *v2, BMVert *v3, BMVert *v4,
* For face data, use f1 (arbitrarily) as face representative.
*/
static BMFace *bev_create_quad_straddle(
BMesh *bm, BMVert *v1, BMVert *v2, BMVert *v3, BMVert *v4,
BMFace *f1, BMFace *f2, int mat_nr, bool is_seam)
{
BMFace *f, *facerep;
@ -737,8 +748,9 @@ static bool offset_meet_edge(EdgeHalf *e1, EdgeHalf *e2, BMVert *v, float meetc
* already, prefer to keep the offset the same on this end.
* Otherwise, pick a point between the two intersection points on emid that minimizes
* the sum of squares of errors from desired offset. */
static void offset_on_edge_between(BevelParams *bp, EdgeHalf *e1, EdgeHalf *e2, EdgeHalf *emid,
BMVert *v, float meetco[3])
static void offset_on_edge_between(
BevelParams *bp, EdgeHalf *e1, EdgeHalf *e2, EdgeHalf *emid,
BMVert *v, float meetco[3])
{
float d, ang1, ang2, sina1, sina2, lambda;
float meet1[3], meet2[3];
@ -793,8 +805,9 @@ static void offset_on_edge_between(BevelParams *bp, EdgeHalf *e1, EdgeHalf *e2,
* Viewed from the vertex normal side, the CCW order of the edges is e1, emid, e2.
* The offset lines may not meet exactly: the lines may be angled so that they can't meet.
* In that case, pick the offset_on_edge_between. */
static void offset_in_two_planes(BevelParams *bp, EdgeHalf *e1, EdgeHalf *e2, EdgeHalf *emid,
BMVert *v, float meetco[3])
static void offset_in_two_planes(
BevelParams *bp, EdgeHalf *e1, EdgeHalf *e2, EdgeHalf *emid,
BMVert *v, float meetco[3])
{
float dir1[3], dir2[3], dirmid[3], norm_perp1[3], norm_perp2[3],
off1a[3], off1b[3], off2a[3], off2b[3], isect2[3],
@ -1079,8 +1092,9 @@ static int bev_ccw_test(BMEdge *a, BMEdge *b, BMFace *f)
* and B has the right side as columns - both extended into homogeneous coords.
* So M = B*(Ainverse). Doing Ainverse by hand gives the code below.
*/
static bool make_unit_square_map(const float va[3], const float vmid[3], const float vb[3],
float r_mat[4][4])
static bool make_unit_square_map(
const float va[3], const float vmid[3], const float vb[3],
float r_mat[4][4])
{
float vo[3], vd[3], vb_vmid[3], va_vmid[3], vddir[3];
@ -1128,8 +1142,9 @@ static bool make_unit_square_map(const float va[3], const float vmid[3], const f
* and 1/2{va+vb+vc-vd}
* and Blender matrices have cols at m[i][*].
*/
static void make_unit_cube_map(const float va[3], const float vb[3], const float vc[3],
const float vd[3], float r_mat[4][4])
static void make_unit_cube_map(
const float va[3], const float vb[3], const float vc[3],
const float vd[3], float r_mat[4][4])
{
copy_v3_v3(r_mat[0], va);
sub_v3_v3(r_mat[0], vb);
@ -1861,9 +1876,10 @@ static void vmesh_center(VMesh *vm, float r_cent[3])
}
}
static void avg4(float co[3],
const NewVert *v0, const NewVert *v1,
const NewVert *v2, const NewVert *v3)
static void avg4(
float co[3],
const NewVert *v0, const NewVert *v1,
const NewVert *v2, const NewVert *v3)
{
add_v3_v3v3(co, v0->co, v1->co);
add_v3_v3(co, v2->co);
@ -3755,10 +3771,11 @@ static float bevel_limit_offset(BMesh *bm, BevelParams *bp)
*
* \warning all tagged edges _must_ be manifold.
*/
void BM_mesh_bevel(BMesh *bm, const float offset, const int offset_type,
const float segments, const float profile,
const bool vertex_only, const bool use_weights, const bool limit_offset,
const struct MDeformVert *dvert, const int vertex_group, const int mat)
void BM_mesh_bevel(
BMesh *bm, const float offset, const int offset_type,
const float segments, const float profile,
const bool vertex_only, const bool use_weights, const bool limit_offset,
const struct MDeformVert *dvert, const int vertex_group, const int mat)
{
BMIter iter;
BMVert *v, *v_next;

View File

@ -29,9 +29,10 @@
struct MDeformVert;
void BM_mesh_bevel(BMesh *bm, const float offset, const int offset_type, const float segments,
const float profile, const bool vertex_only, const bool use_weights,
const bool limit_offset, const struct MDeformVert *dvert, const int vertex_group,
const int mat);
void BM_mesh_bevel(
BMesh *bm, const float offset, const int offset_type, const float segments,
const float profile, const bool vertex_only, const bool use_weights,
const bool limit_offset, const struct MDeformVert *dvert, const int vertex_group,
const int mat);
#endif /* __BMESH_BEVEL_H__ */

View File

@ -32,13 +32,15 @@ void BM_mesh_decimate_collapse(BMesh *bm, const float factor, float *vweights, c
void BM_mesh_decimate_unsubdivide_ex(BMesh *bm, const int iterations, const bool tag_only);
void BM_mesh_decimate_unsubdivide(BMesh *bm, const int iterations);
void BM_mesh_decimate_dissolve_ex(BMesh *bm, const float angle_limit, const bool do_dissolve_boundaries,
const BMO_Delimit delimit,
BMVert **vinput_arr, const int vinput_len,
BMEdge **einput_arr, const int einput_len,
const short oflag_out);
void BM_mesh_decimate_dissolve(BMesh *bm, const float angle_limit, const bool do_dissolve_boundaries,
const BMO_Delimit delimit);
void BM_mesh_decimate_dissolve_ex(
BMesh *bm, const float angle_limit, const bool do_dissolve_boundaries,
const BMO_Delimit delimit,
BMVert **vinput_arr, const int vinput_len,
BMEdge **einput_arr, const int einput_len,
const short oflag_out);
void BM_mesh_decimate_dissolve(
BMesh *bm, const float angle_limit, const bool do_dissolve_boundaries,
const BMO_Delimit delimit);
/* these weights are accumulated so too high values may reach 'inf' too quickly */
#define BM_MESH_DECIM_WEIGHT_MAX 100000.0f

View File

@ -112,18 +112,19 @@ static void bm_decim_build_quadrics(BMesh *bm, Quadric *vquadrics)
}
static void bm_decim_calc_target_co(BMEdge *e, float optimize_co[3],
const Quadric *vquadrics)
static void bm_decim_calc_target_co(
BMEdge *e, float optimize_co[3],
const Quadric *vquadrics)
{
/* compute an edge contraction target for edge 'e'
* this is computed by summing it's vertices quadrics and
* optimizing the result. */
Quadric q;
BLI_quadric_add_qu_ququ(&q,
&vquadrics[BM_elem_index_get(e->v1)],
&vquadrics[BM_elem_index_get(e->v2)]);
BLI_quadric_add_qu_ququ(
&q,
&vquadrics[BM_elem_index_get(e->v1)],
&vquadrics[BM_elem_index_get(e->v2)]);
if (BLI_quadric_optimize(&q, optimize_co, OPTIMIZE_EPS)) {
return; /* all is good */
@ -183,9 +184,10 @@ static bool bm_edge_collapse_is_degenerate_flip(BMEdge *e, const float optimize_
return false;
}
static void bm_decim_build_edge_cost_single(BMEdge *e,
const Quadric *vquadrics, const float *vweights,
Heap *eheap, HeapNode **eheap_table)
static void bm_decim_build_edge_cost_single(
BMEdge *e,
const Quadric *vquadrics, const float *vweights,
Heap *eheap, HeapNode **eheap_table)
{
const Quadric *q1, *q2;
float optimize_co[3];
@ -258,16 +260,18 @@ static void bm_decim_build_edge_cost_single(BMEdge *e,
/* use this for degenerate cases - add back to the heap with an invalid cost,
* this way it may be calculated again if surrounding geometry changes */
static void bm_decim_invalid_edge_cost_single(BMEdge *e,
Heap *eheap, HeapNode **eheap_table)
static void bm_decim_invalid_edge_cost_single(
BMEdge *e,
Heap *eheap, HeapNode **eheap_table)
{
BLI_assert(eheap_table[BM_elem_index_get(e)] == NULL);
eheap_table[BM_elem_index_get(e)] = BLI_heap_insert(eheap, COST_INVALID, e);
}
static void bm_decim_build_edge_cost(BMesh *bm,
const Quadric *vquadrics, const float *vweights,
Heap *eheap, HeapNode **eheap_table)
static void bm_decim_build_edge_cost(
BMesh *bm,
const Quadric *vquadrics, const float *vweights,
Heap *eheap, HeapNode **eheap_table)
{
BMIter iter;
BMEdge *e;
@ -442,8 +446,9 @@ static void bm_decim_triangulate_end(BMesh *bm)
/**
* \param v is the target to merge into.
*/
static void bm_edge_collapse_loop_customdata(BMesh *bm, BMLoop *l, BMVert *v_clear, BMVert *v_other,
const float customdata_fac)
static void bm_edge_collapse_loop_customdata(
BMesh *bm, BMLoop *l, BMVert *v_clear, BMVert *v_other,
const float customdata_fac)
{
/* disable seam check - the seam check would have to be done per layer, its not really that important */
//#define USE_SEAM
@ -698,15 +703,16 @@ static bool bm_edge_collapse_is_degenerate_topology(BMEdge *e_first)
* \param e_clear_other let caller know what edges we remove besides \a e_clear
* \param customdata_flag merge factor, scales from 0 - 1 ('v_clear' -> 'v_other')
*/
static bool bm_edge_collapse(BMesh *bm, BMEdge *e_clear, BMVert *v_clear, int r_e_clear_other[2],
static bool bm_edge_collapse(
BMesh *bm, BMEdge *e_clear, BMVert *v_clear, int r_e_clear_other[2],
#ifdef USE_CUSTOMDATA
const CD_UseFlag customdata_flag,
const float customdata_fac
const CD_UseFlag customdata_flag,
const float customdata_fac
#else
const CD_UseFlag UNUSED(customdata_flag),
const float UNUSED(customdata_fac)
const CD_UseFlag UNUSED(customdata_flag),
const float UNUSED(customdata_fac)
#endif
)
)
{
BMVert *v_other;
@ -847,10 +853,11 @@ static bool bm_edge_collapse(BMesh *bm, BMEdge *e_clear, BMVert *v_clear, int r_
/* collapse e the edge, removing e->v2 */
static void bm_decim_edge_collapse(BMesh *bm, BMEdge *e,
Quadric *vquadrics, float *vweights,
Heap *eheap, HeapNode **eheap_table,
const CD_UseFlag customdata_flag)
static void bm_decim_edge_collapse(
BMesh *bm, BMEdge *e,
Quadric *vquadrics, float *vweights,
Heap *eheap, HeapNode **eheap_table,
const CD_UseFlag customdata_flag)
{
int e_clear_other[2];
BMVert *v_other = e->v1;

View File

@ -98,11 +98,12 @@ fail:
}
void BM_mesh_decimate_dissolve_ex(BMesh *bm, const float angle_limit, const bool do_dissolve_boundaries,
const BMO_Delimit delimit,
BMVert **vinput_arr, const int vinput_len,
BMEdge **einput_arr, const int einput_len,
const short oflag_out)
void BM_mesh_decimate_dissolve_ex(
BMesh *bm, const float angle_limit, const bool do_dissolve_boundaries,
const BMO_Delimit delimit,
BMVert **vinput_arr, const int vinput_len,
BMEdge **einput_arr, const int einput_len,
const short oflag_out)
{
const int eheap_table_len = do_dissolve_boundaries ? einput_len : max_ii(einput_len, vinput_len);
void *_heap_table = MEM_mallocN(sizeof(HeapNode *) * eheap_table_len, __func__);
@ -316,8 +317,9 @@ void BM_mesh_decimate_dissolve_ex(BMesh *bm, const float angle_limit, const bool
MEM_freeN(_heap_table);
}
void BM_mesh_decimate_dissolve(BMesh *bm, const float angle_limit, const bool do_dissolve_boundaries,
const BMO_Delimit delimit)
void BM_mesh_decimate_dissolve(
BMesh *bm, const float angle_limit, const bool do_dissolve_boundaries,
const BMO_Delimit delimit)
{
int vinput_len;
int einput_len;

View File

@ -450,8 +450,9 @@ static LinkNode *bm_edgenet_path_calc_best(
* \param use_edge_tag Only fill tagged edges.
* \param face_oflag if nonzero, apply all new faces with this bmo flag.
*/
void BM_mesh_edgenet(BMesh *bm,
const bool use_edge_tag, const bool use_new_face_tag)
void BM_mesh_edgenet(
BMesh *bm,
const bool use_edge_tag, const bool use_new_face_tag)
{
VertNetInfo *vnet_info = MEM_callocN(sizeof(*vnet_info) * (size_t)bm->totvert, __func__);
BLI_mempool *edge_queue_pool = BLI_mempool_create(sizeof(LinkNode), 0, 512, BLI_MEMPOOL_NOP);

View File

@ -27,7 +27,8 @@
* \ingroup bmesh
*/
void BM_mesh_edgenet(BMesh *bm,
const bool use_edge_tag, const bool use_new_face_tag);
void BM_mesh_edgenet(
BMesh *bm,
const bool use_edge_tag, const bool use_new_face_tag);
#endif /* __BMESH_EDGENET_H__ */

View File

@ -190,14 +190,16 @@ static bool ghashutil_bmelem_indexcmp(const void *a, const void *b)
return (a != b);
}
static GHash *ghash_bmelem_new_ex(const char *info,
const unsigned int nentries_reserve)
static GHash *ghash_bmelem_new_ex(
const char *info,
const unsigned int nentries_reserve)
{
return BLI_ghash_new_ex(ghashutil_bmelem_indexhash, ghashutil_bmelem_indexcmp, info, nentries_reserve);
}
static GSet *gset_bmelem_new_ex(const char *info,
const unsigned int nentries_reserve)
static GSet *gset_bmelem_new_ex(
const char *info,
const unsigned int nentries_reserve)
{
return BLI_gset_new_ex(ghashutil_bmelem_indexhash, ghashutil_bmelem_indexcmp, info, nentries_reserve);
}

View File

@ -30,7 +30,8 @@
#ifndef __BMESH_TRIANGULATE_H__
#define __BMESH_TRIANGULATE_H__
void BM_mesh_triangulate(BMesh *bm, const int quad_method, const int ngon_method, const bool tag_only,
BMOperator *op, BMOpSlot *slot_facemap_out);
void BM_mesh_triangulate(
BMesh *bm, const int quad_method, const int ngon_method, const bool tag_only,
BMOperator *op, BMOpSlot *slot_facemap_out);
#endif /* __BMESH_TRIANGULATE_H__ */

View File

@ -55,8 +55,9 @@ static BMLoop *bm_edge_tag_faceloop(BMEdge *e)
return NULL;
}
static void bm_vert_boundary_tangent(BMVert *v, float r_no[3], float r_no_face[3],
BMVert **r_va_other, BMVert **r_vb_other)
static void bm_vert_boundary_tangent(
BMVert *v, float r_no[3], float r_no_face[3],
BMVert **r_va_other, BMVert **r_vb_other)
{
BMIter iter;
BMEdge *e_iter;

View File

@ -69,9 +69,10 @@ static int bpy_bm_op_as_py_error(BMesh *bm)
* \param htype Test \a value matches this type.
* \param descr Description text.
*/
static int bpy_slot_from_py_elem_check(BPy_BMElem *value, BMesh *bm, const char htype,
/* for error messages */
const char *opname, const char *slot_name, const char *descr)
static int bpy_slot_from_py_elem_check(
BPy_BMElem *value, BMesh *bm, const char htype,
/* for error messages */
const char *opname, const char *slot_name, const char *descr)
{
if (!BPy_BMElem_Check(value) ||
!(value->ele->head.htype & htype))
@ -107,10 +108,11 @@ static int bpy_slot_from_py_elem_check(BPy_BMElem *value, BMesh *bm, const char
* \param htype_bmo The type(s) supported by the target slot.
* \param descr Description text.
*/
static int bpy_slot_from_py_elemseq_check(BPy_BMGeneric *value, BMesh *bm,
const char htype_py, const char htype_bmo,
/* for error messages */
const char *opname, const char *slot_name, const char *descr)
static int bpy_slot_from_py_elemseq_check(
BPy_BMGeneric *value, BMesh *bm,
const char htype_py, const char htype_bmo,
/* for error messages */
const char *opname, const char *slot_name, const char *descr)
{
if (value->bm == NULL) {
PyErr_Format(PyExc_TypeError,
@ -142,9 +144,10 @@ static int bpy_slot_from_py_elemseq_check(BPy_BMGeneric *value, BMesh *bm,
/**
* Use for giving py args to an operator.
*/
static int bpy_slot_from_py(BMesh *bm, BMOperator *bmop, BMOpSlot *slot, PyObject *value,
/* the are just for exception messages */
const char *opname, const char *slot_name)
static int bpy_slot_from_py(
BMesh *bm, BMOperator *bmop, BMOpSlot *slot, PyObject *value,
/* the are just for exception messages */
const char *opname, const char *slot_name)
{
switch (slot->slot_type) {
case BMO_OP_SLOT_BOOL:

View File

@ -3757,10 +3757,11 @@ void bpy_bm_generic_invalidate(BPy_BMGeneric *self)
*
* The 'bm_r' value is assigned when empty, and used when set.
*/
void *BPy_BMElem_PySeq_As_Array(BMesh **r_bm, PyObject *seq, Py_ssize_t min, Py_ssize_t max, Py_ssize_t *r_size,
const char htype,
const bool do_unique_check, const bool do_bm_check,
const char *error_prefix)
void *BPy_BMElem_PySeq_As_Array(
BMesh **r_bm, PyObject *seq, Py_ssize_t min, Py_ssize_t max, Py_ssize_t *r_size,
const char htype,
const bool do_unique_check, const bool do_bm_check,
const char *error_prefix)
{
BMesh *bm = (r_bm && *r_bm) ? *r_bm : NULL;
PyObject *seq_fast;

View File

@ -158,10 +158,11 @@ PyObject *BPy_BMIter_CreatePyObject(BMesh *bm);
PyObject *BPy_BMElem_CreatePyObject(BMesh *bm, BMHeader *ele); /* just checks type and creates v/e/f/l */
void *BPy_BMElem_PySeq_As_Array(BMesh **r_bm, PyObject *seq, Py_ssize_t min, Py_ssize_t max, Py_ssize_t *r_size,
const char htype,
const bool do_unique_check, const bool do_bm_check,
const char *error_prefix);
void *BPy_BMElem_PySeq_As_Array(
BMesh **r_bm, PyObject *seq, Py_ssize_t min, Py_ssize_t max, Py_ssize_t *r_size,
const char htype,
const bool do_unique_check, const bool do_bm_check,
const char *error_prefix);
PyObject *BPy_BMElem_Array_As_Tuple(BMesh *bm, BMHeader **elem, Py_ssize_t elem_len);
PyObject *BPy_BMVert_Array_As_Tuple(BMesh *bm, BMVert **elem, Py_ssize_t elem_len);