edge slide works in ortho now
This commit is contained in:
parent
023482722f
commit
e5d3923a61
|
@ -1811,7 +1811,8 @@ void MESH_OT_vertices_smooth(wmOperatorType *ot)
|
|||
static int bm_test_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
Object *obedit= CTX_data_edit_object(C);
|
||||
RegionView3D *r3d = CTX_wm_region_view3d(C);
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
View3D *v3d = CTX_wm_view3d(C);
|
||||
BMEditMesh *em= ((Mesh *)obedit->data)->edit_btmesh;
|
||||
BMBVHTree *tree = BMBVH_NewBVH(em);
|
||||
BMIter iter;
|
||||
|
@ -1822,7 +1823,7 @@ static int bm_test_exec(bContext *C, wmOperator *UNUSED(op))
|
|||
if (!BM_TestHFlag(e, BM_SELECT))
|
||||
continue;
|
||||
|
||||
if (!BMBVH_EdgeVisible(tree, e, r3d, obedit))
|
||||
if (!BMBVH_EdgeVisible(tree, e, ar, v3d, obedit))
|
||||
BM_Select(em->bm, e, 0);
|
||||
}
|
||||
|
||||
|
@ -2716,6 +2717,7 @@ static int mesh_rip_invoke(bContext *C, wmOperator *op, wmEvent *event)
|
|||
{
|
||||
Object *obedit= CTX_data_edit_object(C);
|
||||
ARegion *ar= CTX_wm_region(C);
|
||||
View3D *v3d = CTX_wm_view3d(C);
|
||||
RegionView3D *rv3d= CTX_wm_region_view3d(C);
|
||||
BMEditMesh *em= ((Mesh *)obedit->data)->edit_btmesh;
|
||||
BMOperator bmop;
|
||||
|
@ -2822,7 +2824,7 @@ static int mesh_rip_invoke(bContext *C, wmOperator *op, wmEvent *event)
|
|||
BMO_ITER(e, &siter, em->bm, &bmop, i ? "edgeout2":"edgeout1", BM_EDGE) {
|
||||
float cent[3] = {0, 0, 0}, mid[4], vec[3];
|
||||
|
||||
if (!BMBVH_EdgeVisible(bvhtree, e, rv3d, obedit) || !e->l)
|
||||
if (!BMBVH_EdgeVisible(bvhtree, e, ar, v3d, obedit) || !e->l)
|
||||
continue;
|
||||
|
||||
/*method for calculating distance:
|
||||
|
@ -4810,9 +4812,6 @@ static int mesh_bevel_exec(bContext *C, wmOperator *op)
|
|||
{
|
||||
Object *obedit= CTX_data_edit_object(C);
|
||||
BMEditMesh *em= (((Mesh *)obedit->data))->edit_btmesh;
|
||||
Material *ma;
|
||||
Tex *tex;
|
||||
BMVert *eve;
|
||||
BMIter iter;
|
||||
BMEdge *eed;
|
||||
BMOperator bmop;
|
||||
|
@ -4821,7 +4820,7 @@ static int mesh_bevel_exec(bContext *C, wmOperator *op)
|
|||
float p3 = RNA_float_get(op->ptr, "param3");
|
||||
float p4 = RNA_float_get(op->ptr, "param4");
|
||||
float p5 = RNA_float_get(op->ptr, "param5");*/
|
||||
int i, tot, recursion = RNA_int_get(op->ptr, "recursion");
|
||||
int i, recursion = RNA_int_get(op->ptr, "recursion");
|
||||
float *w = NULL, ftot;
|
||||
int li;
|
||||
BLI_array_declare(w);
|
||||
|
|
|
@ -659,17 +659,25 @@ void scale_point(float *c1, float *p, float s)
|
|||
add_v3_v3(c1, p);
|
||||
}
|
||||
|
||||
int BMBVH_EdgeVisible(BMBVHTree *tree, BMEdge *e, RegionView3D *r3d, Object *obedit)
|
||||
|
||||
int BMBVH_EdgeVisible(BMBVHTree *tree, BMEdge *e, ARegion *ar, View3D *v3d, Object *obedit)
|
||||
{
|
||||
BMFace *f;
|
||||
RegionView3D *rv3d = ar->regiondata;
|
||||
float co1[3], co2[3], co3[3], dir1[4], dir2[4], dir3[4];
|
||||
float origin[3], invmat[4][4];
|
||||
float epsilon = 0.01f;
|
||||
float m[2], end[3];
|
||||
|
||||
if (r3d->persp == RV3D_ORTHO) {
|
||||
VECCOPY(origin, r3d->winmat[3]);
|
||||
if (!ar) {
|
||||
printf("error in BMBVH_EdgeVisible!\n");
|
||||
return 0;
|
||||
}
|
||||
VECCOPY(origin, r3d->viewinv[3]);
|
||||
|
||||
m[0] = ar->winx/2.0;
|
||||
m[1] = ar->winy/2.0;
|
||||
viewline(ar, v3d, m, origin, end);
|
||||
|
||||
invert_m4_m4(invmat, obedit->obmat);
|
||||
mul_m4_v3(invmat, origin);
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ struct BVHTree *BMBVH_BVHTree(struct BMBVHTree *tree);
|
|||
struct BMFace *BMBVH_RayCast(struct BMBVHTree *tree, float *co, float *dir, float *hitout);
|
||||
|
||||
int BMBVH_EdgeVisible(struct BMBVHTree *tree, struct BMEdge *e,
|
||||
struct RegionView3D *r3d, struct Object *obedit);
|
||||
struct ARegion *ar, struct View3D *v3d, struct Object *obedit);
|
||||
|
||||
#define BM_SEARCH_MAXDIST 0.4f
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ void paintface_flush_flags(Object *ob)
|
|||
{
|
||||
Mesh *me= get_mesh(ob);
|
||||
DerivedMesh *dm= ob->derivedFinal;
|
||||
MPoly *faces, *mf, *mf_orig;
|
||||
MPoly *mf_orig;
|
||||
DMFaceIter *fiter;
|
||||
int *index = NULL;
|
||||
int totface;
|
||||
|
@ -150,8 +150,6 @@ static int facesel_face_pick(struct bContext *C, Mesh *me, Object *ob, short *mv
|
|||
MTexPoly *EDBM_get_active_mtface(BMEditMesh *em, BMFace **act_efa, int sloppy)
|
||||
{
|
||||
BMFace *efa = NULL;
|
||||
BMLoop *l;
|
||||
BMIter iter, liter;
|
||||
|
||||
if(!EDBM_texFaceCheck(em))
|
||||
return NULL;
|
||||
|
@ -524,7 +522,7 @@ void edgetag_context_set(BMEditMesh *em, Scene *scene, BMEdge *eed, int val)
|
|||
}
|
||||
}
|
||||
|
||||
static float bm_cdata_get_single_float(BMesh *bm, CustomData *cdata, void *element, int type)
|
||||
static float bm_cdata_get_single_float(BMesh *UNUSED(bm), CustomData *cdata, void *element, int type)
|
||||
{
|
||||
BMHeader *ele = element;
|
||||
float *f;
|
||||
|
|
|
@ -924,10 +924,13 @@ static void knife_find_line_hits(knifetool_opdata *kcd)
|
|||
return;
|
||||
|
||||
/*unproject screen line*/
|
||||
view3d_unproject(&mats, v1, s1[0], s1[1], 0.0f);
|
||||
viewline(kcd->ar, kcd->vc.v3d, s1, v1, v3);
|
||||
viewline(kcd->ar, kcd->vc.v3d, s2, v2, v4);
|
||||
|
||||
/*view3d_unproject(&mats, v1, s1[0], s1[1], 0.0f);
|
||||
view3d_unproject(&mats, v2, s2[0], s2[1], 0.0f);
|
||||
view3d_unproject(&mats, v3, s1[0], s1[1], 1.0f-FLT_EPSILON);
|
||||
view3d_unproject(&mats, v4, s2[0], s2[1], 1.0f-FLT_EPSILON);
|
||||
view3d_unproject(&mats, v4, s2[0], s2[1], 1.0f-FLT_EPSILON);*/
|
||||
|
||||
mul_m4_v3(kcd->ob->imat, v1);
|
||||
mul_m4_v3(kcd->ob->imat, v2);
|
||||
|
|
|
@ -1090,8 +1090,7 @@ void OBJECT_OT_multires_reshape(wmOperatorType *ot)
|
|||
|
||||
static int multires_test_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *ob= ED_object_active_context(C), *secondob= NULL;
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
Object *ob= ED_object_active_context(C);
|
||||
Mesh *me = ob->data;
|
||||
MPoly *mp;
|
||||
MDisps *mdisps;
|
||||
|
|
|
@ -4363,7 +4363,8 @@ static int createSlideVerts(TransInfo *t)
|
|||
BMBVHTree *btree = BMBVH_NewBVH(em);
|
||||
SmallHash table;
|
||||
SlideData *sld = MEM_callocN(sizeof(*sld), "sld");
|
||||
RegionView3D *v3d = t->ar ? t->ar->regiondata : NULL; /* background mode support */
|
||||
View3D *v3d = t->sa ? t->sa->spacedata.first : NULL;
|
||||
RegionView3D *rv3d = t->ar ? t->ar->regiondata : NULL; /* background mode support */
|
||||
ARegion *ar = t->ar;
|
||||
float projectMat[4][4];
|
||||
float start[3] = {0.0f, 0.0f, 0.0f}, dir[3], end[3] = {0.0f, 0.0f, 0.0f};
|
||||
|
@ -4374,7 +4375,7 @@ static int createSlideVerts(TransInfo *t)
|
|||
/*ok, let's try to survive this*/
|
||||
unit_m4(projectMat);
|
||||
} else {
|
||||
view3d_get_object_project_mat(v3d, t->obedit, projectMat);
|
||||
view3d_get_object_project_mat(rv3d, t->obedit, projectMat);
|
||||
}
|
||||
|
||||
BLI_smallhash_init(&sld->vhash);
|
||||
|
@ -4558,7 +4559,7 @@ static int createSlideVerts(TransInfo *t)
|
|||
if (BM_TestHFlag(e2, BM_SELECT))
|
||||
continue;
|
||||
|
||||
if (!BMBVH_EdgeVisible(btree, e2, v3d, t->obedit))
|
||||
if (!BMBVH_EdgeVisible(btree, e2, ar, v3d, t->obedit))
|
||||
continue;
|
||||
|
||||
j = GET_INT_FROM_POINTER(BLI_smallhash_lookup(&table, (uintptr_t)v));
|
||||
|
|
Loading…
Reference in New Issue