forked from bartvdbraak/blender
transform manipulator didnt follow the active face in some cases, also rotate about active mixed with normal did not work as it did in 2.45, where the active edge could be used
as a rotation axis (this is quite useful)
This commit is contained in:
parent
96486b356f
commit
e459d5518e
@ -260,5 +260,6 @@ int EM_vertColorCheck(void); /* can we edit colors for this mesh?*/
|
||||
|
||||
void EM_set_actFace(struct EditFace *efa);
|
||||
struct EditFace * EM_get_actFace(int sloppy);
|
||||
int EM_get_actSelection(struct EditSelection *ese);
|
||||
|
||||
#endif
|
||||
|
@ -1530,35 +1530,11 @@ void snap_curs_to_active()
|
||||
if (G.obedit->type == OB_MESH)
|
||||
{
|
||||
/* check active */
|
||||
if (G.editMesh->selected.last) {
|
||||
EditSelection *ese = G.editMesh->selected.last;
|
||||
if ( ese->type == EDITVERT ) {
|
||||
EditVert *eve = (EditVert *)ese->data;
|
||||
VECCOPY(curs, eve->co);
|
||||
EditSelection ese;
|
||||
if (EM_get_actSelection(&ese)) {
|
||||
EM_editselection_center(curs, &ese);
|
||||
}
|
||||
else if ( ese->type == EDITEDGE ) {
|
||||
EditEdge *eed = (EditEdge *)ese->data;
|
||||
VecAddf(curs, eed->v1->co, eed->v2->co);
|
||||
VecMulf(curs, 0.5f);
|
||||
}
|
||||
else if ( ese->type == EDITFACE ) {
|
||||
EditFace *efa = (EditFace *)ese->data;
|
||||
|
||||
if (efa->v4)
|
||||
{
|
||||
VecAddf(curs, efa->v1->co, efa->v2->co);
|
||||
VecAddf(curs, curs, efa->v3->co);
|
||||
VecAddf(curs, curs, efa->v4->co);
|
||||
VecMulf(curs, 0.25f);
|
||||
}
|
||||
else
|
||||
{
|
||||
VecAddf(curs, efa->v1->co, efa->v2->co);
|
||||
VecAddf(curs, curs, efa->v3->co);
|
||||
VecMulf(curs, 1/3.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
Mat4MulVecfl(G.obedit->obmat, curs);
|
||||
}
|
||||
}
|
||||
|
@ -151,33 +151,6 @@ int facesel_face_pick(Mesh *me, short *mval, unsigned int *index, short rect)
|
||||
return 1;
|
||||
}
|
||||
|
||||
#if 0 // not used
|
||||
/* returns 0 if not found, otherwise 1 */
|
||||
static int facesel_edge_pick(Mesh *me, short *mval, unsigned int *index)
|
||||
{
|
||||
int dist;
|
||||
unsigned int min = me->totface + 1;
|
||||
unsigned int max = me->totface + me->totedge + 1;
|
||||
|
||||
if (me->totedge == 0)
|
||||
return 0;
|
||||
|
||||
if (G.vd->flag & V3D_NEEDBACKBUFDRAW) {
|
||||
check_backbuf();
|
||||
persp(PERSP_VIEW);
|
||||
}
|
||||
|
||||
*index = sample_backbuf_rect(mval, 50, min, max, &dist,0,NULL);
|
||||
|
||||
if (*index == 0)
|
||||
return 0;
|
||||
|
||||
(*index)--;
|
||||
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* only operates on the edit object - this is all thats needed at the moment */
|
||||
static void uv_calc_center_vector(float *result, Object *ob, EditMesh *em)
|
||||
{
|
||||
|
@ -103,6 +103,35 @@ EditFace * EM_get_actFace(int sloppy)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int EM_get_actSelection(EditSelection *ese)
|
||||
{
|
||||
EditSelection *ese_last = G.editMesh->selected.last;
|
||||
EditFace *efa = EM_get_actFace(0);
|
||||
|
||||
ese->next = ese->prev = NULL;
|
||||
|
||||
if (ese_last) {
|
||||
if (ese_last->type == EDITFACE) { /* if there is an active face, use it over the last selected face */
|
||||
if (efa) {
|
||||
ese->data = (void *)efa;
|
||||
} else {
|
||||
ese->data = ese_last->data;
|
||||
}
|
||||
ese->type = EDITFACE;
|
||||
} else {
|
||||
ese->data = ese_last->data;
|
||||
ese->type = ese_last->type;
|
||||
}
|
||||
} else if (efa) { /* no */
|
||||
ese->data = (void *)efa;
|
||||
ese->type = EDITFACE;
|
||||
} else {
|
||||
ese->data = NULL;
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* ********* Selection History ************ */
|
||||
static int EM_check_selection(void *data)
|
||||
{
|
||||
|
@ -972,11 +972,12 @@ void calculateCenter(TransInfo *t)
|
||||
calculateCenterMedian(t);
|
||||
break;
|
||||
case V3D_ACTIVE:
|
||||
{
|
||||
/* set median, and if if if... do object center */
|
||||
|
||||
EditSelection ese;
|
||||
/* EDIT MODE ACTIVE EDITMODE ELEMENT */
|
||||
if (G.obedit && G.obedit->type == OB_MESH && G.editMesh->selected.last) {
|
||||
EM_editselection_center(t->center, G.editMesh->selected.last);
|
||||
if (G.obedit && G.obedit->type == OB_MESH && EM_get_actSelection(&ese)) {
|
||||
EM_editselection_center(t->center, &ese);
|
||||
calculateCenter2D(t);
|
||||
break;
|
||||
} /* END EDIT MODE ACTIVE ELEMENT */
|
||||
@ -989,6 +990,8 @@ void calculateCenter(TransInfo *t)
|
||||
projectIntView(t, t->center, t->center2d);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/* setting constraint center */
|
||||
|
@ -230,11 +230,12 @@ int calc_manipulator_stats(ScrArea *sa)
|
||||
if(G.obedit->type==OB_MESH) {
|
||||
EditMesh *em = G.editMesh;
|
||||
EditVert *eve;
|
||||
EditSelection ese;
|
||||
float vec[3]= {0,0,0};
|
||||
|
||||
/* USE LAST SELECTE WITH ACTIVE */
|
||||
if (G.vd->around==V3D_ACTIVE && em->selected.last) {
|
||||
EM_editselection_center(vec, em->selected.last);
|
||||
if (G.vd->around==V3D_ACTIVE && EM_get_actSelection(&ese)) {
|
||||
EM_editselection_center(vec, &ese);
|
||||
calc_tw_center(vec);
|
||||
totsel= 1;
|
||||
} else {
|
||||
@ -438,7 +439,7 @@ int calc_manipulator_stats(ScrArea *sa)
|
||||
|
||||
strcpy(t->spacename, "normal");
|
||||
|
||||
type = getTransformOrientation(normal, plane, 0);
|
||||
type = getTransformOrientation(normal, plane, (G.vd->around == V3D_ACTIVE));
|
||||
|
||||
switch (type)
|
||||
{
|
||||
|
@ -379,16 +379,16 @@ int getTransformOrientation(float normal[3], float plane[3], int activeOnly)
|
||||
{
|
||||
EditMesh *em = G.editMesh;
|
||||
EditVert *eve;
|
||||
EditSelection ese;
|
||||
float vec[3]= {0,0,0};
|
||||
|
||||
/* USE LAST SELECTED WITH ACTIVE */
|
||||
if (activeOnly && em->selected.last)
|
||||
if (activeOnly && EM_get_actSelection(&ese))
|
||||
{
|
||||
EditSelection *ese = em->selected.last;
|
||||
EM_editselection_normal(normal, ese);
|
||||
EM_editselection_plane(plane, ese);
|
||||
EM_editselection_normal(normal, &ese);
|
||||
EM_editselection_plane(plane, &ese);
|
||||
|
||||
switch (ese->type)
|
||||
switch (ese.type)
|
||||
{
|
||||
case EDITVERT:
|
||||
result = ORIENTATION_VERT;
|
||||
|
Loading…
Reference in New Issue
Block a user