added buttons in the Transform Properties for changing curve handle types, (Similar...
authorCampbell Barton <ideasman42@gmail.com>
Sat, 10 Nov 2007 15:31:41 +0000 (15:31 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sat, 10 Nov 2007 15:31:41 +0000 (15:31 +0000)
source/blender/blenkernel/intern/curve.c
source/blender/include/butspace.h
source/blender/src/buttons_editing.c
source/blender/src/drawview.c

index ece0a7f1d6c5403002d8df43ce592ef40a9f8abc..6676bf0e03ffcfe69ae7c03d6d3d37e33553a666 100644 (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) {
index fec85c03b77c94c253641e594f574a9abdfdb0b3..4fbfb8c1e80fc7a244776f733a57bac90e35a7a0 100644 (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
index ba836e84511c3a3df6b6508bf78916f3df1e2d8b..abd2fa015c3cd20cb83689d472e2af9eaee630f5 100644 (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;
        }
 }
 
index e437ad86cdaccff1ff8c1fefcddd921192e4586f..5ae9c43987cb253d7b1af79954d2a5d9027e98c9 100644 (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)