committing working copy

This commit is contained in:
Joseph Eagar
2010-07-22 22:17:20 +00:00
parent a23e3c42f5
commit 37f2c8a64c
4 changed files with 86 additions and 6 deletions

View File

@@ -223,7 +223,8 @@ void dissolve_edgeloop_exec(BMesh *bm, BMOperator *op)
/*clean up extreneous 2-valence vertices*/
for (i=0; i<BLI_array_count(verts); i++) {
BM_Collapse_Vert(bm, verts[i]->e, verts[i], 1.0);
if (verts[i]->e)
BM_Collapse_Vert(bm, verts[i]->e, verts[i], 1.0);
}
BLI_array_free(verts);

View File

@@ -107,7 +107,10 @@ int get_view3d_cliprange(struct View3D *v3d, struct RegionView3D *rv3d, float *c
int get_view3d_viewplane(struct View3D *v3d, struct RegionView3D *rv3d, int winxi, int winyi, rctf *viewplane, float *clipsta, float *clipend, float *pixsize);
int get_view3d_ortho(struct View3D *v3d, struct RegionView3D *rv3d);
void view3d_get_object_project_mat(struct RegionView3D *v3d, struct Object *ob, float pmat[4][4]);
/* computes screen x/y in vec */
void view3d_project_float(struct ARegion *a, float *vec, float *adr, float mat[4][4]);
/* computes z, as well as x and y */
void view3d_project_float_v3(struct ARegion *a, float *vec, float *adr, float mat[4][4]);
/* drawobject.c itterators */
void mesh_foreachScreenVert(struct ViewContext *vc, void (*func)(void *userData, struct BMVert *eve, int x, int y, int index), void *userData, int clipVerts);

View File

@@ -699,6 +699,26 @@ void view3d_project_float(ARegion *ar, float *vec, float *adr, float mat[4][4])
}
}
/* use above call to get projecting mat */
void view3d_project_float_v3(ARegion *ar, float *vec, float *adr, float mat[4][4])
{
float vec4[4];
VECCOPY(vec4, vec);
adr[0]= IS_CLIPPED;
vec4[3]= 1.0;
mul_m4_v4(mat, vec4);
if( vec4[3]>FLT_EPSILON ) {
adr[0] = (float)(ar->winx/2.0f)+(ar->winx/2.0f)*vec4[0]/vec4[3];
adr[1] = (float)(ar->winy/2.0f)+(ar->winy/2.0f)*vec4[1]/vec4[3];
adr[2] = vec4[2]/vec4[3];
} else {
adr[0] = adr[1] = adr[2] = 0.0f;
}
}
int boundbox_clip(RegionView3D *rv3d, float obmat[][4], BoundBox *bb)
{
/* return 1: draw */

View File

@@ -4273,9 +4273,10 @@ static int createSlideVerts(TransInfo *t)
SlideData *sld = MEM_callocN(sizeof(*sld), "sld");
TransDataSlideUv *slideuvs=NULL, *suv=NULL, *suv_last=NULL;
RegionView3D *v3d = t->ar->regiondata;
ARegion *ar = t->ar;
float projectMat[4][4];
float start[3] = {0.0f, 0.0f, 0.0f}, end[3] = {0.0f, 0.0f, 0.0f};
float vec[3], vec2[3];
float vec[3], vec2[3], size, dis=0.0, z;
float totvec=0.0;
int uvlay_tot= CustomData_number_of_layers(&em->bm->pdata, CD_MTFACE);
int uvlay_idx, numsel, i, j;
@@ -4443,11 +4444,66 @@ static int createSlideVerts(TransInfo *t)
sld->sv = tempsv;
sld->totsv = j;
sld->start[0] = t->mval[0] - 40;
sld->start[1] = t->mval[1];
/*find mouse vector*/
dis = z = 10000.0f;
size = 50.0;
BM_ITER(e, &iter, em->bm, BM_EDGES_OF_MESH, NULL) {
if (BM_TestHFlag(e, BM_SELECT)) {
BMIter iter2;
BMEdge *e2;
float vec1[3], vec2[3], dir[3], vec[3], mval[2] = {t->mval[0], t->mval[1]}, d, z2;
for (i=0; i<2; i++) {
BM_ITER(e2, &iter2, em->bm, BM_EDGES_OF_VERT, i?e->v1:e->v2) {
if (BM_TestHFlag(e2, BM_SELECT))
continue;
sld->end[0] = t->mval[0] + 40;
sld->end[1] = t->mval[1];
view3d_project_float_v3(ar, e2->v1->co, vec1, projectMat);
view3d_project_float_v3(ar, e2->v2->co, vec2, projectMat);
add_v3_v3v3(vec, vec1, vec2);
mul_v3_fl(vec, 0.5);
z2 = vec[2];
d = dist_to_line_segment_v2(mval, vec1, vec2);
if (d < dis || (d < 15 && z2 < z)) {
dis = d;
size = len_v3v3(vec1, vec2);
}
}
}
view3d_project_float(ar, e->v1->co, vec1, projectMat);
view3d_project_float(ar, e->v2->co, vec2, projectMat);
sub_v3_v3v3(vec, vec1, vec2);
normalize_v3(vec);
if (dot_v3v3(dir, dir) != 0.0f) {
copy_v3_v3(dir, start);
normalize_v3(dir);
if (dot_v3v3(dir, vec) < 0.0) {
mul_v3_fl(dir, -1.0);
}
}
add_v3_v3(start, dir);
}
}
normalize_v3(start);
mul_v3_fl(start, size);
end[0] = start[1];
end[1] = -start[0];
SWAP(float, start[0], start[1]);
sld->start[0] = t->mval[0] + start[0];
sld->start[1] = t->mval[1] + start[1];
sld->end[0] = t->mval[0] + end[0];
sld->end[1] = t->mval[1] + end[1];
t->customData = sld;