added buttons in the Transform Properties for changing curve handle types, (Similar to how Metaballs can be selected) for easier access then H,Shift H, V keys

This commit is contained in:
Campbell Barton
2007-11-10 15:31:41 +00:00
parent 38d12b3c8d
commit 90b4ed9543
4 changed files with 68 additions and 14 deletions

View File

@@ -2351,6 +2351,8 @@ void sethandlesNurb(short code)
/* code==2: set vectorhandle */
/* code==3 (HD_ALIGN) it toggle, vectorhandles become HD_FREE */
/* code==4: sets icu flag to become IPO_AUTO_HORIZ, horizontal extremes on auto-handles */
/* code==5: Set align, like 3 but no toggle */
/* code==6: Clear align, like 3 but no toggle */
Nurb *nu;
BezTriple *bezt;
short a, ok=0;
@@ -2381,22 +2383,28 @@ void sethandlesNurb(short code)
/* there is 1 handle not FREE: FREE it all, else make ALIGNED */
nu= editNurb.first;
while(nu) {
if( (nu->type & 7)==1) {
bezt= nu->bezt;
a= nu->pntsu;
while(a--) {
if(bezt->f1 && bezt->h1) ok= 1;
if(bezt->f3 && bezt->h2) ok= 1;
if(ok) break;
bezt++;
if (code == 5) {
ok = HD_ALIGN;
} else if (code == 6) {
ok = HD_FREE;
} else {
/* Toggle */
while(nu) {
if( (nu->type & 7)==1) {
bezt= nu->bezt;
a= nu->pntsu;
while(a--) {
if(bezt->f1 && bezt->h1) ok= 1;
if(bezt->f3 && bezt->h2) ok= 1;
if(ok) break;
bezt++;
}
}
nu= nu->next;
}
nu= nu->next;
if(ok) ok= HD_FREE;
else ok= HD_ALIGN;
}
if(ok) ok= HD_FREE;
else ok= HD_ALIGN;
nu= editNurb.first;
while(nu) {
if( (nu->type & 7)==1) {

View File

@@ -455,6 +455,10 @@ void curvemap_buttons(struct uiBlock *block, struct CurveMapping *cumap, char la
#define B_SETW4 2122
#define B_SUBSURFTYPE 2123
#define B_TILTINTERP 2124
#define B_SETPT_AUTO 2125
#define B_SETPT_VECTOR 2126
#define B_SETPT_ALIGN 2127
#define B_SETPT_FREE 2128
/* *********************** */
#define B_FONTBUTS 2300

View File

@@ -2919,6 +2919,40 @@ void do_curvebuts(unsigned short event)
allqueue(REDRAWINFO, 1); /* 1, because header->win==0! */
break;
/* Buttons for aligning handles */
case B_SETPT_AUTO:
if(ob->type==OB_CURVE) {
sethandlesNurb(1);
BIF_undo_push("Auto Curve Handles");
DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
allqueue(REDRAWVIEW3D, 0);
}
break;
case B_SETPT_VECTOR:
if(ob->type==OB_CURVE) {
sethandlesNurb(2);
BIF_undo_push("Vector Curve Handles");
DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
allqueue(REDRAWVIEW3D, 0);
}
break;
case B_SETPT_ALIGN:
if(ob->type==OB_CURVE) {
sethandlesNurb(5);
BIF_undo_push("Align Curve Handles");
DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
allqueue(REDRAWVIEW3D, 0);
}
break;
case B_SETPT_FREE:
if(ob->type==OB_CURVE) {
sethandlesNurb(6);
BIF_undo_push("Free Align Curve Handles");
DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
allqueue(REDRAWVIEW3D, 0);
}
break;
}
}

View File

@@ -1697,7 +1697,6 @@ static void v3d_editvertex_buts(uiBlock *block, Object *ob, float lim)
Mat4MulVecfl(ob->obmat, median);
if(block) { // buttons
uiBlockBeginAlign(block);
if((ob->parent) && (ob->partype == PARBONE)) {
uiDefButBitS(block, TOG, V3D_GLOBAL_STATS, REDRAWVIEW3D, "Global", 160, 135, 70, 19, &G.vd->flag, 0, 0, 0, 0, "Displays global values");
@@ -1742,6 +1741,15 @@ static void v3d_editvertex_buts(uiBlock *block, Object *ob, float lim)
uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Weight:", 10, 20, 290, 19, &(tfp->ve_median[4]), 0.0, 1.0, 10, 3, "Weight is used for SoftBody Goal");
}
if(ob->type==OB_CURVE && (totw==0)) { /* bez curves have no w */
uiBlockBeginAlign(block);
uiDefBut(block, BUT,B_SETPT_AUTO,"Auto", 10, 44, 72, 19, 0, 0, 0, 0, 0, "Auto handles (Shift H)");
uiDefBut(block, BUT,B_SETPT_VECTOR,"Vector",82, 44, 73, 19, 0, 0, 0, 0, 0, "Vector handles (V)");
uiDefBut(block, BUT,B_SETPT_ALIGN,"Align",155, 44, 73, 19, 0, 0, 0, 0, 0, "Align handles (H Toggles)");
uiDefBut(block, BUT,B_SETPT_FREE,"Free", 227, 44, 72, 19, 0, 0, 0, 0, 0, "Align handles (H Toggles)");
uiBlockEndAlign(block);
}
if(totedge==1)
uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Crease W:", 10, 30, 290, 19, &(tfp->ve_median[3]), 0.0, 1.0, 10, 3, "");
else if(totedge>1)