diff options
Diffstat (limited to 'source/blender/editors/mesh')
-rw-r--r-- | source/blender/editors/mesh/editface.c | 8 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_bvh.c | 18 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_bvh.h | 5 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_knife.c | 9 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_loopcut.c | 4 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_rip.c | 13 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_select.c | 6 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_slide.c | 16 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_tools.c | 22 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_utils.c | 2 | ||||
-rw-r--r-- | source/blender/editors/mesh/mesh_intern.h | 2 | ||||
-rw-r--r-- | source/blender/editors/mesh/mesh_navmesh.c | 2 | ||||
-rw-r--r-- | source/blender/editors/mesh/meshtools.c | 30 |
13 files changed, 60 insertions, 77 deletions
diff --git a/source/blender/editors/mesh/editface.c b/source/blender/editors/mesh/editface.c index 294a39eddf8..cfc9e11879e 100644 --- a/source/blender/editors/mesh/editface.c +++ b/source/blender/editors/mesh/editface.c @@ -400,14 +400,14 @@ void paintface_deselect_all_visible(Object *ob, int action, short flush_flags) } } -int paintface_minmax(Object *ob, float *min, float *max) +int paintface_minmax(Object *ob, float r_min[3], float r_max[3]) { Mesh *me; MPoly *mp; MTexPoly *tf; MLoop *ml; MVert *mvert; - int a, b, ok = 0; + int a, b, ok = FALSE; float vec[3], bmat[3][3]; me = get_mesh(ob); @@ -427,10 +427,10 @@ int paintface_minmax(Object *ob, float *min, float *max) copy_v3_v3(vec, (mvert[ml->v].co)); mul_m3_v3(bmat, vec); add_v3_v3v3(vec, vec, ob->obmat[3]); - DO_MINMAX(vec, min, max); + DO_MINMAX(vec, r_min, r_max); } - ok = 1; + ok = TRUE; } return ok; diff --git a/source/blender/editors/mesh/editmesh_bvh.c b/source/blender/editors/mesh/editmesh_bvh.c index 6155ad1be1c..6d740812f27 100644 --- a/source/blender/editors/mesh/editmesh_bvh.c +++ b/source/blender/editors/mesh/editmesh_bvh.c @@ -239,7 +239,8 @@ static void raycallback(void *userdata, int index, const BVHTreeRay *ray, BVHTre } } -BMFace *BMBVH_RayCast(BMBVHTree *tree, float *co, float *dir, float *hitout, float *cagehit) +BMFace *BMBVH_RayCast(BMBVHTree *tree, const float co[3], const float dir[3], + float r_hitout[3], float r_cagehit[3]) { BVHTreeRayHit hit; @@ -250,10 +251,9 @@ BMFace *BMBVH_RayCast(BMBVHTree *tree, float *co, float *dir, float *hitout, flo BLI_bvhtree_ray_cast(tree->tree, co, dir, 0.0f, &hit, raycallback, tree); if (hit.dist != FLT_MAX && hit.index != -1) { - if (hitout) { + if (r_hitout) { if (tree->flag & BMBVH_RETURN_ORIG) { BMVert *v1, *v2, *v3; - float co[3]; int i; v1 = tree->em->looptris[hit.index][0]->v; @@ -261,17 +261,17 @@ BMFace *BMBVH_RayCast(BMBVHTree *tree, float *co, float *dir, float *hitout, flo v3 = tree->em->looptris[hit.index][2]->v; for (i = 0; i < 3; i++) { - co[i] = v1->co[i] + ((v2->co[i] - v1->co[i]) * tree->uv[0]) + - ((v3->co[i] - v1->co[i]) * tree->uv[1]); + r_hitout[i] = v1->co[i] + ((v2->co[i] - v1->co[i]) * tree->uv[0]) + + ((v3->co[i] - v1->co[i]) * tree->uv[1]); } - copy_v3_v3(hitout, co); } else { - copy_v3_v3(hitout, hit.co); + copy_v3_v3(r_hitout, hit.co); } - if (cagehit) - copy_v3_v3(cagehit, hit.co); + if (r_cagehit) { + copy_v3_v3(r_cagehit, hit.co); + } } return tree->em->looptris[hit.index][0]->f; diff --git a/source/blender/editors/mesh/editmesh_bvh.h b/source/blender/editors/mesh/editmesh_bvh.h index e2b45062e41..6512f054c1b 100644 --- a/source/blender/editors/mesh/editmesh_bvh.h +++ b/source/blender/editors/mesh/editmesh_bvh.h @@ -50,13 +50,12 @@ struct BMBVHTree *BMBVH_NewBVH(struct BMEditMesh *em, int flag, struct Scene *sc void BMBVH_FreeBVH(struct BMBVHTree *tree); struct BVHTree *BMBVH_BVHTree(struct BMBVHTree *tree); -struct BMFace *BMBVH_RayCast(struct BMBVHTree *tree, float *co, float *dir, float *hitout, float *cagehit); +struct BMFace *BMBVH_RayCast(struct BMBVHTree *tree, const float co[3], const float dir[3], + float r_hitout[3], float r_cagehit[3]); int BMBVH_EdgeVisible(struct BMBVHTree *tree, struct BMEdge *e, struct ARegion *ar, struct View3D *v3d, struct Object *obedit); -#define BM_SEARCH_MAXDIST 0.4f - /*find a vert closest to co in a sphere of radius maxdist*/ struct BMVert *BMBVH_FindClosestVert(struct BMBVHTree *tree, float *co, float maxdist); diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c index 0ace06b1a1a..6f33fcd05b7 100644 --- a/source/blender/editors/mesh/editmesh_knife.c +++ b/source/blender/editors/mesh/editmesh_knife.c @@ -277,7 +277,7 @@ static void knife_add_to_vert_edges(KnifeTool_OpData *kcd, KnifeEdge *kfe) knife_append_list(kcd, &kfe->v2->edges, kfe); } -static KnifeVert *new_knife_vert(KnifeTool_OpData *kcd, float *co, float *cageco) +static KnifeVert *new_knife_vert(KnifeTool_OpData *kcd, const float co[3], float *cageco) { KnifeVert *kfv = BLI_mempool_calloc(kcd->kverts); @@ -2721,10 +2721,6 @@ static void knifetool_exit(bContext *C, wmOperator *op) WM_cursor_restore(CTX_wm_window(C)); - /* remember setting for later */ - RNA_boolean_set(op->ptr, "use_occlude_geometry", !kcd->cut_through); - WM_operator_last_properties_store(op); /* XXX - this is clunky but modal ops wont do this automatic */ - /* deactivate the extra drawing stuff in 3D-View */ ED_region_draw_cb_exit(kcd->ar->type, kcd->draw_handle); @@ -2746,6 +2742,9 @@ static void knifetool_exit(bContext *C, wmOperator *op) if (kcd->cagecos) MEM_freeN(kcd->cagecos); + if (kcd->linehits) + MEM_freeN(kcd->linehits); + /* destroy kcd itself */ MEM_freeN(kcd); op->customdata = NULL; diff --git a/source/blender/editors/mesh/editmesh_loopcut.c b/source/blender/editors/mesh/editmesh_loopcut.c index 12174d5b9fa..beb5345ca9b 100644 --- a/source/blender/editors/mesh/editmesh_loopcut.c +++ b/source/blender/editors/mesh/editmesh_loopcut.c @@ -240,7 +240,7 @@ static void edgering_sel(tringselOpData *lcd, int previewlines, int select) edgering_find_order(lasteed, eed, lastv1, v); lastv1 = v[0][0]; - BLI_array_growitems(edges, previewlines); + BLI_array_grow_items(edges, previewlines); for (i = 1; i <= previewlines; i++) { co[0][0] = (v[0][1]->co[0] - v[0][0]->co[0]) * (i / ((float)previewlines + 1)) + v[0][0]->co[0]; @@ -265,7 +265,7 @@ static void edgering_sel(tringselOpData *lcd, int previewlines, int select) edgering_find_order(lasteed, startedge, lastv1, v); - BLI_array_growitems(edges, previewlines); + BLI_array_grow_items(edges, previewlines); for (i = 1; i <= previewlines; i++) { if (!v[0][0] || !v[0][1] || !v[1][0] || !v[1][1]) diff --git a/source/blender/editors/mesh/editmesh_rip.c b/source/blender/editors/mesh/editmesh_rip.c index e755df1f076..b74e8797d72 100644 --- a/source/blender/editors/mesh/editmesh_rip.c +++ b/source/blender/editors/mesh/editmesh_rip.c @@ -56,7 +56,8 @@ #include "mesh_intern.h" /* helper to find edge for edge_rip */ -static float edbm_rip_rip_edgedist(ARegion *ar, float mat[][4], float *co1, float *co2, const float mvalf[2]) +static float edbm_rip_rip_edgedist(ARegion *ar, float mat[][4], + const float co1[3], const float co2[2], const float mvalf[2]) { float vec1[3], vec2[3]; @@ -111,9 +112,9 @@ static float edbm_rip_edge_side_measure(BMEdge *e, BMLoop *e_l, score = len_v2v2(e_v1_co, e_v2_co); if (dist_to_line_segment_v2(fmval_tweak, e_v1_co, e_v2_co) > - dist_to_line_segment_v2(fmval, e_v1_co, e_v2_co)) + dist_to_line_segment_v2(fmval, e_v1_co, e_v2_co)) { - return score; + return score; } else { return -score; @@ -262,7 +263,7 @@ static EdgeLoopPair *edbm_ripsel_looptag_helper(BMesh *bm) uid_start = uid; uid = uid_end + bm->totedge; - BLI_array_growone(eloop_pairs); + BLI_array_grow_one(eloop_pairs); lp = &eloop_pairs[BLI_array_count(eloop_pairs) - 1]; BM_edge_loop_pair(e_last, &lp->l_a, &lp->l_b); /* no need to check, we know this will be true */ @@ -276,7 +277,7 @@ static EdgeLoopPair *edbm_ripsel_looptag_helper(BMesh *bm) } /* null terminate */ - BLI_array_growone(eloop_pairs); + BLI_array_grow_one(eloop_pairs); lp = &eloop_pairs[BLI_array_count(eloop_pairs) - 1]; lp->l_a = lp->l_b = NULL; @@ -347,7 +348,7 @@ static int edbm_rip_call_edgesplit(BMEditMesh *em, wmOperator *op) BMOperator bmop; if (!EDBM_op_init(em, &bmop, op, "edgesplit edges=%he verts=%hv use_verts=%b", - BM_ELEM_TAG, BM_ELEM_SELECT, TRUE)) { + BM_ELEM_TAG, BM_ELEM_SELECT, TRUE)) { return FALSE; } BMO_op_exec(em->bm, &bmop); diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c index 05352938aba..32e70e798fe 100644 --- a/source/blender/editors/mesh/editmesh_select.c +++ b/source/blender/editors/mesh/editmesh_select.c @@ -1512,7 +1512,7 @@ int mouse_mesh(bContext *C, const int mval[2], short extend) vc.obedit->actcol = efa->mat_nr + 1; vc.em->mat_nr = efa->mat_nr; - WM_event_add_notifier(C, NC_MATERIAL|ND_SHADING, NULL); + WM_event_add_notifier(C, NC_MATERIAL | ND_SHADING, NULL); } @@ -2307,7 +2307,7 @@ static int edbm_select_linked_flat_faces_exec(bContext *C, wmOperator *op) BLI_array_empty(stack); i = 1; - BLI_array_growone(stack); + BLI_array_grow_one(stack); stack[i - 1] = f; while (i) { @@ -2330,7 +2330,7 @@ static int edbm_select_linked_flat_faces_exec(bContext *C, wmOperator *op) /* invalidate: edge too sharp */ if (angle < sharp) { - BLI_array_growone(stack); + BLI_array_grow_one(stack); stack[i] = l2->f; i++; } diff --git a/source/blender/editors/mesh/editmesh_slide.c b/source/blender/editors/mesh/editmesh_slide.c index 3cbb099a0a9..a82f34a4649 100644 --- a/source/blender/editors/mesh/editmesh_slide.c +++ b/source/blender/editors/mesh/editmesh_slide.c @@ -88,7 +88,7 @@ typedef struct VertexSlideOp { int disk_edges; /* Edges */ - BMEdge** edge_frame; + BMEdge **edge_frame; /* Slide Frame Endpoints */ float (*vtx_frame)[3]; @@ -194,7 +194,7 @@ static void vtx_slide_confirm(bContext *C, wmOperator *op) { VertexSlideOp *vso = op->customdata; BMEditMesh *em = BMEdit_FromObject(vso->obj); - BMesh* bm = em->bm; + BMesh *bm = em->bm; /* Select new edge */ BM_edge_select_set(bm, vso->sel_edge, TRUE); @@ -204,7 +204,7 @@ static void vtx_slide_confirm(bContext *C, wmOperator *op) if (vso->snap_n_merge) { float other_d; - BMVert* other = BM_edge_other_vert(vso->sel_edge, vso->start_vtx); + BMVert *other = BM_edge_other_vert(vso->sel_edge, vso->start_vtx); other_d = len_v3v3(vso->interp, other->co); /* Only snap if within threshold */ @@ -339,12 +339,12 @@ static void vtx_slide_draw(const bContext *C, ARegion *UNUSED(ar), void *arg) } } -static BMEdge* vtx_slide_nrst_in_frame(VertexSlideOp *vso, const float mval[2]) +static BMEdge *vtx_slide_nrst_in_frame(VertexSlideOp *vso, const float mval[2]) { - BMEdge* cl_edge = NULL; + BMEdge *cl_edge = NULL; if (vso->disk_edges > 0) { int i = 0; - BMEdge* edge = NULL; + BMEdge *edge = NULL; float v1_proj[3], v2_proj[3]; float dist = 0; @@ -481,7 +481,7 @@ static int vtx_slide_set_frame(VertexSlideOp *vso) { BMEdge *edge; float (*vtx_frame)[3] = NULL; - BMEdge** edge_frame = NULL; + BMEdge **edge_frame = NULL; BMVert *curr_vert = NULL; BLI_array_declare(vtx_frame); BLI_array_declare(edge_frame); @@ -505,7 +505,7 @@ static int vtx_slide_set_frame(VertexSlideOp *vso) BM_ITER_ELEM_INDEX (edge, &iter, sel_vtx, BM_EDGES_OF_VERT, idx) { curr_vert = BM_edge_other_vert(edge, sel_vtx); if (curr_vert) { - BLI_array_growone(vtx_frame); + BLI_array_grow_one(vtx_frame); copy_v3_v3(vtx_frame[idx], curr_vert->co); diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index f3737925850..7eae8b4d67e 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -927,7 +927,9 @@ static int edbm_delete_exec(bContext *C, wmOperator *op) //"Erase Only Faces"; if (!EDBM_op_callf(em, op, "del geom=%hf context=%i", BM_ELEM_SELECT, DEL_ONLYFACES)) + { return OPERATOR_CANCELLED; + } } EDBM_flag_disable_all(em, BM_ELEM_SELECT); @@ -1021,8 +1023,7 @@ static int edbm_add_edge_face__smooth_get(BMesh *bm) unsigned int vote_on_smooth[2] = {0, 0}; BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) { - if (BM_elem_flag_test(e, BM_ELEM_SELECT) && e->l) - { + if (BM_elem_flag_test(e, BM_ELEM_SELECT) && e->l) { vote_on_smooth[BM_elem_flag_test_bool(e->l->f, BM_ELEM_SMOOTH)]++; } } @@ -3639,22 +3640,6 @@ static int vergxco(const void *v1, const void *v2) return (x2->org_idx < 0) - (x1->org_idx < 0); } -#if 0 /* Unused */ -struct facesort { - uintptr_t x; - struct EditFace *efa; -}; - -static int vergface(const void *v1, const void *v2) -{ - const struct facesort *x1 = v1, *x2 = v2; - - if (x1->x > x2->x) return 1; - else if (x1->x < x2->x) return -1; - return 0; -} -#endif - static void xsortvert_flag__doSetX(void *userData, BMVert *UNUSED(eve), int x, int UNUSED(y), int index) { xvertsort *sortblock = userData; @@ -4280,3 +4265,4 @@ void MESH_OT_inset(wmOperatorType *ot) RNA_def_boolean(ot->srna, "use_outset", FALSE, "Outset", "Outset rather than inset"); RNA_def_boolean(ot->srna, "use_select_inset", TRUE, "Select Outer", "Select the new inset faces"); } + diff --git a/source/blender/editors/mesh/editmesh_utils.c b/source/blender/editors/mesh/editmesh_utils.c index 4ec3c22d1df..2ebeb9ca224 100644 --- a/source/blender/editors/mesh/editmesh_utils.c +++ b/source/blender/editors/mesh/editmesh_utils.c @@ -567,7 +567,7 @@ void undo_push_mesh(bContext *C, const char *name) } /* write comment here */ -UvVertMap *EDBM_uv_vert_map_create(BMEditMesh *em, int selected, int do_face_idx_array, float *limit) +UvVertMap *EDBM_uv_vert_map_create(BMEditMesh *em, int selected, int do_face_idx_array, const float limit[2]) { BMVert *ev; BMFace *efa; diff --git a/source/blender/editors/mesh/mesh_intern.h b/source/blender/editors/mesh/mesh_intern.h index 70ae9704d3e..b6403f33bc9 100644 --- a/source/blender/editors/mesh/mesh_intern.h +++ b/source/blender/editors/mesh/mesh_intern.h @@ -106,7 +106,7 @@ void MESH_OT_duplicate(struct wmOperatorType *ot); extern int EM_view3d_poll(struct bContext *C); -struct wmKeyMap* knifetool_modal_keymap(struct wmKeyConfig *keyconf); +struct wmKeyMap *knifetool_modal_keymap(struct wmKeyConfig *keyconf); /* ******************* knifetool.c */ diff --git a/source/blender/editors/mesh/mesh_navmesh.c b/source/blender/editors/mesh/mesh_navmesh.c index 71aaacb7e49..43cd89af3ac 100644 --- a/source/blender/editors/mesh/mesh_navmesh.c +++ b/source/blender/editors/mesh/mesh_navmesh.c @@ -430,7 +430,7 @@ static int navmesh_create_exec(bContext *C, wmOperator *op) LinkNode *obs = NULL; Base *navmeshBase = NULL; - CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) { + CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases) { if (base->object->type == OB_MESH) { if (base->object->body_type == OB_BODY_TYPE_NAVMESH) { if (!navmeshBase || base == scene->basact) { diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c index 7c02f26dbdc..d8e9dea598c 100644 --- a/source/blender/editors/mesh/meshtools.c +++ b/source/blender/editors/mesh/meshtools.c @@ -122,7 +122,7 @@ int join_mesh_exec(bContext *C, wmOperator *op) } /* count & check */ - CTX_DATA_BEGIN(C, Base *, base, selected_editable_bases) { + CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases) { if (base->object->type == OB_MESH) { me = base->object->data; @@ -198,8 +198,7 @@ int join_mesh_exec(bContext *C, wmOperator *op) } /* first pass over objects - copying materials and vertexgroups across */ - CTX_DATA_BEGIN(C, Base *, base, selected_editable_bases) - { + CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases) { /* only act if a mesh, and not the one we're joining to */ if ((ob != base->object) && (base->object->type == OB_MESH)) { me = base->object->data; @@ -299,8 +298,7 @@ int join_mesh_exec(bContext *C, wmOperator *op) /* inverse transform for all selected meshes in this object */ invert_m4_m4(imat, ob->obmat); - CTX_DATA_BEGIN(C, Base *, base, selected_editable_bases) - { + CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases) { /* only join if this is a mesh */ if (base->object->type == OB_MESH) { me = base->object->data; @@ -569,7 +567,7 @@ int join_mesh_shapes_exec(bContext *C, wmOperator *op) KeyBlock *kb; int ok = 0, nonequal_verts = 0; - CTX_DATA_BEGIN(C, Base *, base, selected_editable_bases) { + CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases) { if (base->object == ob) continue; if (base->object->type == OB_MESH) { @@ -601,8 +599,7 @@ int join_mesh_shapes_exec(bContext *C, wmOperator *op) } /* now ready to add new keys from selected meshes */ - CTX_DATA_BEGIN(C, Base *, base, selected_editable_bases) - { + CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases) { if (base->object == ob) continue; if (base->object->type == OB_MESH) { @@ -641,7 +638,7 @@ typedef struct MocNode { intptr_t index[MOC_NODE_RES]; } MocNode; -static int mesh_octree_get_base_offs(float *co, float *offs, float *div) +static int mesh_octree_get_base_offs(const float co[3], const float offs[3], const float div[3]) { int vx, vy, vz; @@ -736,7 +733,7 @@ static void mesh_octree_add_nodes(MocNode **basetable, float *co, float *offs, f } -static intptr_t mesh_octree_find_index(MocNode **bt, MVert *mvert, float *co) +static intptr_t mesh_octree_find_index(MocNode **bt, MVert *mvert, const float co[3]) { float *vec; int a; @@ -773,7 +770,7 @@ static struct { /* mode is 's' start, or 'e' end, or 'u' use */ /* if end, ob can be NULL */ -intptr_t mesh_octree_table(Object *ob, BMEditMesh *em, float *co, char mode) +intptr_t mesh_octree_table(Object *ob, BMEditMesh *em, const float co[3], char mode) { MocNode **bt; @@ -920,7 +917,7 @@ int mesh_get_x_mirror_vert(Object *ob, int index) return 0; } -static BMVert *editbmesh_get_x_mirror_vert_spacial(Object *ob, BMEditMesh *em, float *co) +static BMVert *editbmesh_get_x_mirror_vert_spacial(Object *ob, BMEditMesh *em, const float co[3]) { float vec[3]; intptr_t poinval; @@ -928,9 +925,10 @@ static BMVert *editbmesh_get_x_mirror_vert_spacial(Object *ob, BMEditMesh *em, f /* ignore nan verts */ if (!finite(co[0]) || !finite(co[1]) || - !finite(co[2]) - ) + !finite(co[2])) + { return NULL; + } vec[0] = -co[0]; vec[1] = co[1]; @@ -971,7 +969,7 @@ static BMVert *editbmesh_get_x_mirror_vert_topo(Object *ob, struct BMEditMesh *e return NULL; } -BMVert *editbmesh_get_x_mirror_vert(Object *ob, struct BMEditMesh *em, BMVert *eve, float *co, int index) +BMVert *editbmesh_get_x_mirror_vert(Object *ob, struct BMEditMesh *em, BMVert *eve, const float co[3], int index) { if (((Mesh *)ob->data)->editflag & ME_EDIT_MIRROR_TOPO) { return editbmesh_get_x_mirror_vert_topo(ob, em, eve, index); @@ -1016,7 +1014,7 @@ static float *editmesh_get_mirror_uv(BMEditMesh *em, int axis, float *uv, float BMFace *efa; BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) { - poly_uv_center(em, efa, cent); + uv_poly_center(em, efa, cent); if ( (fabs(cent[0] - cent_vec[0]) < 0.001) && (fabs(cent[1] - cent_vec[1]) < 0.001) ) { BMIter liter; |