Bassam Feature Request: "Auto Clamped" handles can now be set per
authorJoshua Leung <aligorith@gmail.com>
Thu, 4 Aug 2011 14:13:05 +0000 (14:13 +0000)
committerJoshua Leung <aligorith@gmail.com>
Thu, 4 Aug 2011 14:13:05 +0000 (14:13 +0000)
handle/key

This used to be a weird per-curve setting which would happen to get
applied/work correctly if handles were set to "auto", and was a source
of constant confusion for both old and new animators. The main effect
of this handle-type/option was really to just ensure that auto-handles
stayed horizontal, instead of tilting as the keys were moved.

This commit simply changes this from a per-curve to per
keyframe/handle setting.

19 files changed:
source/blender/blenkernel/intern/curve.c
source/blender/blenkernel/intern/fcurve.c
source/blender/blenkernel/intern/ipo.c
source/blender/blenkernel/intern/nla.c
source/blender/blenloader/intern/readfile.c
source/blender/editors/animation/drivers.c
source/blender/editors/animation/keyframes_edit.c
source/blender/editors/animation/keyframing.c
source/blender/editors/include/UI_resources.h
source/blender/editors/interface/resources.c
source/blender/editors/space_action/action_edit.c
source/blender/editors/space_graph/graph_edit.c
source/blender/makesdna/DNA_anim_types.h
source/blender/makesdna/DNA_curve_types.h
source/blender/makesdna/DNA_userdef_types.h
source/blender/makesrna/RNA_enum_types.h
source/blender/makesrna/intern/rna_curve.c
source/blender/makesrna/intern/rna_fcurve.c
source/blender/makesrna/intern/rna_userdef.c

index eb364af6ff8211ad1af1f627c1c5a5be74e6ec0e..2f1a85c57b314bd0bb130bbfefa1e0e182973668 100644 (file)
@@ -2473,7 +2473,7 @@ void calchandleNurb(BezTriple *bezt, BezTriple *prev, BezTriple *next, int mode)
        if(len2==0.0f) len2=1.0f;
 
 
-       if(bezt->h1==HD_AUTO || bezt->h2==HD_AUTO) {    /* auto */
+       if(ELEM(bezt->h1,HD_AUTO,HD_AUTO_ANIM) || ELEM(bezt->h2,HD_AUTO,HD_AUTO_ANIM)) {    /* auto */
                vx= dx1/len2 + dx/len1;
                vy= dy1/len2 + dy/len1;
                vz= dz1/len2 + dz/len1;
@@ -2484,13 +2484,13 @@ void calchandleNurb(BezTriple *bezt, BezTriple *prev, BezTriple *next, int mode)
                        if(len1>5.0f*len2) len1= 5.0f*len2;     
                        if(len2>5.0f*len1) len2= 5.0f*len1;
                        
-                       if(bezt->h1==HD_AUTO) {
+                       if(ELEM(bezt->h1,HD_AUTO,HD_AUTO_ANIM)) {
                                len1/=len;
                                *(p2-3)= *p2-vx*len1;
                                *(p2-2)= *(p2+1)-vy*len1;
                                *(p2-1)= *(p2+2)-vz*len1;
                                
-                               if(mode==2 && next && prev) {   // keep horizontal if extrema
+                               if((bezt->h1==HD_AUTO_ANIM) && next && prev) {  // keep horizontal if extrema
                                        float ydiff1= prev->vec[1][1] - bezt->vec[1][1];
                                        float ydiff2= next->vec[1][1] - bezt->vec[1][1];
                                        if( (ydiff1 <= 0.0f && ydiff2 <= 0.0f) || (ydiff1 >= 0.0f && ydiff2 >= 0.0f) ) {
@@ -2512,13 +2512,13 @@ void calchandleNurb(BezTriple *bezt, BezTriple *prev, BezTriple *next, int mode)
                                        }
                                }
                        }
-                       if(bezt->h2==HD_AUTO) {
+                       if(ELEM(bezt->h2,HD_AUTO,HD_AUTO_ANIM)) {
                                len2/=len;
                                *(p2+3)= *p2+vx*len2;
                                *(p2+4)= *(p2+1)+vy*len2;
                                *(p2+5)= *(p2+2)+vz*len2;
                                
-                               if(mode==2 && next && prev) {   // keep horizontal if extrema
+                               if((bezt->h2==HD_AUTO_ANIM) && next && prev) {  // keep horizontal if extrema
                                        float ydiff1= prev->vec[1][1] - bezt->vec[1][1];
                                        float ydiff2= next->vec[1][1] - bezt->vec[1][1];
                                        if( (ydiff1 <= 0.0f && ydiff2 <= 0.0f) || (ydiff1 >= 0.0f && ydiff2 >= 0.0f) ) {
index aa8f817ae3c08c6049f6d5fce0d6ad02b1e86fc4..28f17b3cf8681d60d9755202aec8e42c977ea904 100644 (file)
@@ -792,13 +792,10 @@ void calchandles_fcurve (FCurve *fcu)
                if (bezt->vec[2][0] < bezt->vec[1][0]) bezt->vec[2][0]= bezt->vec[1][0];
                
                /* calculate auto-handles */
-               if (fcu->flag & FCURVE_AUTO_HANDLES) 
-                       calchandleNurb(bezt, prev, next, 2);    /* 2==special autohandle && keep extrema horizontal */
-               else
-                       calchandleNurb(bezt, prev, next, 1);    /* 1==special autohandle */
+               calchandleNurb(bezt, prev, next, 1);    /* 1==special autohandle */
                
                /* for automatic ease in and out */
-               if ((bezt->h1==HD_AUTO) && (bezt->h2==HD_AUTO)) {
+               if (ELEM(bezt->h1,HD_AUTO,HD_AUTO_ANIM) && ELEM(bezt->h2,HD_AUTO,HD_AUTO_ANIM)) {
                        /* only do this on first or last beztriple */
                        if ((a == 0) || (a == fcu->totvert-1)) {
                                /* set both handles to have same horizontal value as keyframe */
@@ -846,9 +843,9 @@ void testhandles_fcurve (FCurve *fcu)
                /* one or two handles selected only */
                if (ELEM(flag, 0, 7)==0) {
                        /* auto handles become aligned */
-                       if (bezt->h1==HD_AUTO)
+                       if (ELEM(bezt->h1, HD_AUTO, HD_AUTO_ANIM))
                                bezt->h1= HD_ALIGN;
-                       if (bezt->h2==HD_AUTO)
+                       if (ELEM(bezt->h2, HD_AUTO, HD_AUTO_ANIM))
                                bezt->h2= HD_ALIGN;
                        
                        /* vector handles become 'free' when only one half selected */
index 104ce2b3b329bba059c930fe240eb0b132f97a2b..d41a3a36b2db9fb01d62a26ca46c0dfaddcc50e9 100644 (file)
@@ -1157,7 +1157,6 @@ static void icu_to_fcurves (ID *id, ListBase *groups, ListBase *list, IpoCurve *
        if (icu->flag & IPO_ACTIVE) fcu->flag |= FCURVE_ACTIVE;
        if (icu->flag & IPO_MUTE) fcu->flag |= FCURVE_MUTED;
        if (icu->flag & IPO_PROTECT) fcu->flag |= FCURVE_PROTECTED;
-       if (icu->flag & IPO_AUTO_HORIZ) fcu->flag |= FCURVE_AUTO_HANDLES;
        
        /* set extrapolation */
        switch (icu->extrap) {
@@ -1242,6 +1241,12 @@ static void icu_to_fcurves (ID *id, ListBase *groups, ListBase *list, IpoCurve *
                                        /* 'hide' flag is now used for keytype - only 'keyframes' existed before */
                                        dst->hide= BEZT_KEYTYPE_KEYFRAME;
                                        
+                                       /* auto-handles - per curve to per handle */
+                                       if (icu->flag & IPO_AUTO_HORIZ) {
+                                               if (dst->h1 == HD_AUTO) dst->h1 = HD_AUTO_ANIM;
+                                               if (dst->h2 == HD_AUTO) dst->h2 = HD_AUTO_ANIM;
+                                       }
+                                       
                                        /* correct values, by checking if the flag of interest is set */
                                        if ( ((int)(dst->vec[1][1])) & (abp->bit) )
                                                dst->vec[0][1]= dst->vec[1][1]= dst->vec[2][1] = 1.0f;
@@ -1292,6 +1297,12 @@ static void icu_to_fcurves (ID *id, ListBase *groups, ListBase *list, IpoCurve *
                                        
                                /* 'hide' flag is now used for keytype - only 'keyframes' existed before */
                                dst->hide= BEZT_KEYTYPE_KEYFRAME;
+                               
+                               /* auto-handles - per curve to per handle */
+                               if (icu->flag & IPO_AUTO_HORIZ) {
+                                       if (dst->h1 == HD_AUTO) dst->h1 = HD_AUTO_ANIM;
+                                       if (dst->h2 == HD_AUTO) dst->h2 = HD_AUTO_ANIM;
+                               }
                                        
                                /* correct values for euler rotation curves 
                                 *      - they were degrees/10 
index 8391e9f6ab11355a868aed2755566b72c301f664..f2ce8e4e6f1e045fbc732a03a83aacd4de263791 100644 (file)
@@ -1185,7 +1185,7 @@ void BKE_nlastrip_validate_fcurves (NlaStrip *strip)
                        BLI_addtail(&strip->fcurves, fcu);
                        
                        /* set default flags */
-                       fcu->flag = (FCURVE_VISIBLE|FCURVE_AUTO_HANDLES|FCURVE_SELECTED);
+                       fcu->flag = (FCURVE_VISIBLE|FCURVE_SELECTED);
                        
                        /* store path - make copy, and store that */
                        fcu->rna_path= BLI_strdupn("influence", 9);
@@ -1206,7 +1206,7 @@ void BKE_nlastrip_validate_fcurves (NlaStrip *strip)
                        BLI_addtail(&strip->fcurves, fcu);
                        
                        /* set default flags */
-                       fcu->flag = (FCURVE_VISIBLE|FCURVE_AUTO_HANDLES|FCURVE_SELECTED);
+                       fcu->flag = (FCURVE_VISIBLE|FCURVE_SELECTED);
                        
                        /* store path - make copy, and store that */
                        fcu->rna_path= BLI_strdupn("strip_time", 10);
index 1737b44a56faf8e2131d0d303a0a052ab85c9036..435ae62123abb023ba58058b1f90f90fd19d3071 100644 (file)
@@ -11799,6 +11799,38 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                                SEQ_END
                        }
                }
+               {
+                       /* Make "auto-clamped" handles a per-keyframe setting instead of per-FCurve 
+                        *
+                        * We're only patching F-Curves in Actions here, since it is assumed that most
+                        * drivers out there won't be using this (and if they are, they're in the minority).
+                        * While we should aim to fix everything ideally, in practice it's far too hard
+                        * to get to every animdata block, not to mention the performance hit that'd have
+                        */
+                       bAction *act;
+                       FCurve *fcu;
+                       
+                       for (act = main->action.first; act; act = act->id.next) {
+                               for (fcu = act->curves.first; fcu; fcu = fcu->next) {
+                                       BezTriple *bezt;
+                                       unsigned int i = 0;
+                                       
+                                       /* only need to touch curves that had this flag set */
+                                       if ((fcu->flag & FCURVE_AUTO_HANDLES) == 0)
+                                               continue;
+                                       if ((fcu->totvert == 0) || (fcu->bezt == NULL))
+                                               continue;
+                                               
+                                       /* only change auto-handles to auto-clamped */
+                                       for (bezt=fcu->bezt; i < fcu->totvert; i++, bezt++) {
+                                               if (bezt->h1 == HD_AUTO) bezt->h1 = HD_AUTO_ANIM;
+                                               if (bezt->h2 == HD_AUTO) bezt->h2 = HD_AUTO_ANIM;
+                                       }
+                                       
+                                       fcu->flag &= ~FCURVE_AUTO_HANDLES;
+                               }
+                       }
+               }
        }
        
        /* WATCH IT!!!: pointers from libdata have not been converted yet here! */
index c9e422baa3ec3d1f7cbdddd7d3388d3ac493bfa6..3df65a942dadb5c9d02fb5a5c3eb1d9cbf4f2f4d 100644 (file)
@@ -108,7 +108,7 @@ FCurve *verify_driver_fcurve (ID *id, const char rna_path[], const int array_ind
                /* use default settings to make a F-Curve */
                fcu= MEM_callocN(sizeof(FCurve), "FCurve");
                
-               fcu->flag = (FCURVE_VISIBLE|FCURVE_AUTO_HANDLES|FCURVE_SELECTED);
+               fcu->flag = (FCURVE_VISIBLE|FCURVE_SELECTED);
                
                /* store path - make copy, and store that */
                fcu->rna_path= BLI_strdupn(rna_path, strlen(rna_path));
@@ -386,10 +386,6 @@ short ANIM_paste_driver (ReportList *reports, ID *id, const char rna_path[], int
                copy_fmodifiers(&fcu->modifiers, &channeldriver_copypaste_buf->modifiers);
                
                        /* flags - on a per-relevant-flag basis */
-               if (channeldriver_copypaste_buf->flag & FCURVE_AUTO_HANDLES)
-                       fcu->flag |= FCURVE_AUTO_HANDLES;
-               else
-                       fcu->flag &= ~FCURVE_AUTO_HANDLES;
                        /* extrapolation mode */
                fcu->extend= channeldriver_copypaste_buf->extend;
                        
index 9f3d40a57096d197c5f5fb594da3edbeece5221b..ae9107ebe5af3ffcbba20ba3c2409cc81f1ea89e 100644 (file)
@@ -756,20 +756,37 @@ KeyframeEditFunc ANIM_editkeyframes_mirror(short type)
 /* ******************************************* */
 /* Settings */
 
+/* standard validation step for a few of these (implemented as macro for inlining without fn-call overhead):
+ *     "if the handles are not of the same type, set them to type free"
+ */
+#define ENSURE_HANDLES_MATCH(bezt) \
+               if (bezt->h1 != bezt->h2) { \
+                       if ELEM3(bezt->h1, HD_ALIGN, HD_AUTO, HD_AUTO_ANIM) bezt->h1= HD_FREE; \
+                       if ELEM3(bezt->h2, HD_ALIGN, HD_AUTO, HD_AUTO_ANIM) bezt->h2= HD_FREE; \
+               }
+
 /* Sets the selected bezier handles to type 'auto' */
 static short set_bezier_auto(KeyframeEditData *UNUSED(ked), BezTriple *bezt) 
 {
-       if((bezt->f1  & SELECT) || (bezt->f3 & SELECT)) {
-               if (bezt->f1 & SELECT) bezt->h1= HD_AUTO; /* the secret code for auto */
+       if ((bezt->f1 & SELECT) || (bezt->f3 & SELECT)) {
+               if (bezt->f1 & SELECT) bezt->h1= HD_AUTO;
                if (bezt->f3 & SELECT) bezt->h2= HD_AUTO;
                
-               /* if the handles are not of the same type, set them
-                * to type free
-                */
-               if (bezt->h1 != bezt->h2) {
-                       if ELEM(bezt->h1, HD_ALIGN, HD_AUTO) bezt->h1= HD_FREE;
-                       if ELEM(bezt->h2, HD_ALIGN, HD_AUTO) bezt->h2= HD_FREE;
-               }
+               ENSURE_HANDLES_MATCH(bezt);
+       }
+       return 0;
+}
+
+/* Sets the selected bezier handles to type 'auto-clamped'
+ * NOTE: this is like auto above, but they're handled a bit different
+ */
+static short set_bezier_auto_clamped(KeyframeEditData *UNUSED(ked), BezTriple *bezt) 
+{
+       if ((bezt->f1 & SELECT) || (bezt->f3 & SELECT)) {
+               if (bezt->f1 & SELECT) bezt->h1= HD_AUTO_ANIM;
+               if (bezt->f3 & SELECT) bezt->h2= HD_AUTO_ANIM;
+               
+               ENSURE_HANDLES_MATCH(bezt);
        }
        return 0;
 }
@@ -781,13 +798,7 @@ static short set_bezier_vector(KeyframeEditData *UNUSED(ked), BezTriple *bezt)
                if (bezt->f1 & SELECT) bezt->h1= HD_VECT;
                if (bezt->f3 & SELECT) bezt->h2= HD_VECT;
                
-               /* if the handles are not of the same type, set them
-                * to type free
-                */
-               if (bezt->h1 != bezt->h2) {
-                       if ELEM(bezt->h1, HD_ALIGN, HD_AUTO) bezt->h1= HD_FREE;
-                       if ELEM(bezt->h2, HD_ALIGN, HD_AUTO) bezt->h2= HD_FREE;
-               }
+               ENSURE_HANDLES_MATCH(bezt);
        }
        return 0;
 }
@@ -824,8 +835,9 @@ KeyframeEditFunc ANIM_editkeyframes_handles(short code)
 {
        switch (code) {
                case HD_AUTO: /* auto */
-               case HD_AUTO_ANIM: /* auto clamped */
                        return set_bezier_auto;
+               case HD_AUTO_ANIM: /* auto clamped */
+                       return set_bezier_auto_clamped;
                        
                case HD_VECT: /* vector */
                        return set_bezier_vector;
index 109da669ce6e3fac118192ec39c0c88855bc17c4..fbedb466f7e1a1a3d3a743f8036a41312b1593db 100644 (file)
@@ -174,7 +174,7 @@ FCurve *verify_fcurve (bAction *act, const char group[], const char rna_path[],
                /* use default settings to make a F-Curve */
                fcu= MEM_callocN(sizeof(FCurve), "FCurve");
                
-               fcu->flag = (FCURVE_VISIBLE|FCURVE_AUTO_HANDLES|FCURVE_SELECTED);
+               fcu->flag = (FCURVE_VISIBLE|FCURVE_SELECTED);
                if (act->curves.first==NULL) 
                        fcu->flag |= FCURVE_ACTIVE;     /* first one added active */
                        
index 2bc2aac165f6fe694781ae04f0899895a411a028..ff9a1f539a1125a0b69733dde524e72be96f21ba 100644 (file)
@@ -183,10 +183,12 @@ enum {
        TH_HANDLE_AUTO,
        TH_HANDLE_VECT,
        TH_HANDLE_ALIGN,
+       TH_HANDLE_AUTOCLAMP,
        TH_HANDLE_SEL_FREE,
        TH_HANDLE_SEL_AUTO,
        TH_HANDLE_SEL_VECT,
        TH_HANDLE_SEL_ALIGN,
+       TH_HANDLE_SEL_AUTOCLAMP,
 
        TH_ACTIVE_SPLINE,
        TH_LASTSEL_POINT,
index dd63cdf586169c80493920cee052b1eef9818c1e..00c92b85ee7b56361a8de2634a057285a77e8bf9 100644 (file)
@@ -328,6 +328,8 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo
                                cp= ts->handle_free; break;
                        case TH_HANDLE_AUTO:
                                cp= ts->handle_auto; break;
+                       case TH_HANDLE_AUTOCLAMP:
+                               cp= ts->handle_auto_clamped; break;
                        case TH_HANDLE_VECT:
                                cp= ts->handle_vect; break;
                        case TH_HANDLE_ALIGN:
@@ -336,11 +338,13 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo
                                cp= ts->handle_sel_free; break;
                        case TH_HANDLE_SEL_AUTO:
                                cp= ts->handle_sel_auto; break;
+                       case TH_HANDLE_SEL_AUTOCLAMP:
+                               cp= ts->handle_sel_auto_clamped; break;
                        case TH_HANDLE_SEL_VECT:
                                cp= ts->handle_sel_vect; break;
                        case TH_HANDLE_SEL_ALIGN:
                                cp= ts->handle_sel_align; break;
-
+               
                        case TH_SYNTAX_B:
                                cp= ts->syntaxb; break;
                        case TH_SYNTAX_V:
@@ -667,6 +671,8 @@ void ui_theme_init_default(void)
 
        SETCOL(btheme->tipo.handle_vertex,              0, 0, 0, 255);
        SETCOL(btheme->tipo.handle_vertex_select, 255, 133, 0, 255);
+       SETCOL(btheme->tipo.handle_auto_clamped, 0x99, 0x40, 0x30, 255);
+       SETCOL(btheme->tipo.handle_sel_auto_clamped, 0xf0, 0xaf, 0x90, 255);
        btheme->tipo.handle_vertex_size= 4;
        
        SETCOL(btheme->tipo.ds_channel,         82, 96, 110, 255);
@@ -1557,6 +1563,21 @@ void init_userdef_do_versions(void)
                U.autokey_flag &= ~AUTOKEY_FLAG_ONLYKEYINGSET;
        }
        
+       if (bmain->versionfile < 258 || (bmain->versionfile == 258 && bmain->subversionfile < 1)) {
+               bTheme *btheme;
+               
+               /* if new keyframes handle default is stuff "auto", make it "auto-clamped" instead */
+               if (U.keyhandles_new == HD_AUTO) 
+                       U.keyhandles_new = HD_AUTO_ANIM;
+                       
+               /* theme color additions */
+               for (btheme= U.themes.first; btheme; btheme= btheme->next) {
+                       /* auto-clamped handles -> based on auto */
+                       SETCOL(btheme->tipo.handle_auto_clamped, 0x99, 0x40, 0x30, 255);
+                       SETCOL(btheme->tipo.handle_sel_auto_clamped, 0xf0, 0xaf, 0x90, 255);
+               }
+       }
+       
        /* GL Texture Garbage Collection (variable abused above!) */
        if (U.textimeout == 0) {
                U.texcollectrate = 60;
index 40d73a59a429b12eb4f8b14c98f544a86c3cf439..5276e62b9eb0710f89abbf1b56383458e3472bbc 100644 (file)
@@ -1103,17 +1103,6 @@ void ACTION_OT_interpolation_type (wmOperatorType *ot)
 
 /* ******************** Set Handle-Type Operator *********************** */
 
-static EnumPropertyItem actkeys_handle_type_items[] = {
-       {HD_FREE, "FREE", 0, "Free", ""},
-       {HD_VECT, "VECTOR", 0, "Vector", ""},
-       {HD_ALIGN, "ALIGNED", 0, "Aligned", ""},
-       {0, "", 0, "", ""},
-       {HD_AUTO, "AUTO", 0, "Auto", "Handles that are automatically adjusted upon moving the keyframe"},
-       {HD_AUTO_ANIM, "ANIM_CLAMPED", 0, "Auto Clamped", "Auto handles clamped to not overshoot"},
-       {0, NULL, 0, NULL, NULL}};
-
-/* ------------------- */
-
 /* this function is responsible for setting handle-type of selected keyframes */
 static void sethandles_action_keys(bAnimContext *ac, short mode) 
 {
@@ -1136,12 +1125,6 @@ static void sethandles_action_keys(bAnimContext *ac, short mode)
                
                /* any selected keyframes for editing? */
                if (ANIM_fcurve_keyframes_loop(NULL, fcu, NULL, sel_cb, NULL)) {
-                       /* for auto/auto-clamped, toggle the auto-handles flag on the F-Curve */
-                       if (mode == HD_AUTO_ANIM)
-                               fcu->flag |= FCURVE_AUTO_HANDLES;
-                       else if (mode == HD_AUTO)
-                               fcu->flag &= ~FCURVE_AUTO_HANDLES;
-                       
                        /* change type of selected handles */
                        ANIM_fcurve_keyframes_loop(NULL, fcu, NULL, edit_cb, calchandles_fcurve);
                }
@@ -1195,7 +1178,7 @@ void ACTION_OT_handle_type (wmOperatorType *ot)
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
        
        /* id-props */
-       ot->prop= RNA_def_enum(ot->srna, "type", actkeys_handle_type_items, 0, "Type", "");
+       ot->prop= RNA_def_enum(ot->srna, "type", keyframe_handle_type_items, 0, "Type", "");
 }
 
 /* ******************** Set Keyframe-Type Operator *********************** */
index d88a18ffcbccbd837a950ec2a9cf597cf9ef9786..900aa6f619705cd104d6cc4f76a79f0a903c16cb 100644 (file)
@@ -1447,8 +1447,6 @@ void GRAPH_OT_interpolation_type (wmOperatorType *ot)
 
 /* ******************** Set Handle-Type Operator *********************** */
 
-/* ------------------- */
-
 /* this function is responsible for setting handle-type of selected keyframes */
 static void sethandles_graph_keys(bAnimContext *ac, short mode) 
 {
@@ -1471,12 +1469,6 @@ static void sethandles_graph_keys(bAnimContext *ac, short mode)
                
                /* any selected keyframes for editing? */
                if (ANIM_fcurve_keyframes_loop(NULL, fcu, NULL, sel_cb, NULL)) {
-                       /* for auto/auto-clamped, toggle the auto-handles flag on the F-Curve */
-                       if (mode == HD_AUTO_ANIM)
-                               fcu->flag |= FCURVE_AUTO_HANDLES;
-                       else if (mode == HD_AUTO)
-                               fcu->flag &= ~FCURVE_AUTO_HANDLES;
-                       
                        /* change type of selected handles */
                        ANIM_fcurve_keyframes_loop(NULL, fcu, NULL, edit_cb, calchandles_fcurve);
                }
@@ -1513,15 +1505,6 @@ static int graphkeys_handletype_exec(bContext *C, wmOperator *op)
  
  void GRAPH_OT_handle_type (wmOperatorType *ot)
 {
-        /* sync with editcurve_handle_type_items */
-        static EnumPropertyItem graphkeys_handle_type_items[] = {
-                {HD_AUTO, "AUTO", 0, "Automatic", "Handles that are automatically adjusted upon moving the keyframe. Whole curve"},
-                {HD_VECT, "VECTOR", 0, "Vector", ""},
-                {HD_ALIGN, "ALIGNED", 0, "Aligned", ""},
-                {HD_FREE, "FREE_ALIGN", 0, "Free", ""},
-                {HD_AUTO_ANIM, "ANIM_CLAMPED", 0, "Auto Clamped", "Auto handles clamped to not overshoot. Whole curve"},
-                {0, NULL, 0, NULL, NULL}};      
-
        /* identifiers */
        ot->name= "Set Keyframe Handle Type";
        ot->idname= "GRAPH_OT_handle_type";
@@ -1536,7 +1519,7 @@ static int graphkeys_handletype_exec(bContext *C, wmOperator *op)
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
        
        /* id-props */
-       ot->prop= RNA_def_enum(ot->srna, "type", graphkeys_handle_type_items, 0, "Type", "");
+       ot->prop= RNA_def_enum(ot->srna, "type", keyframe_handle_type_items, 0, "Type", "");
 }
 
 /* ************************************************************************** */
index 00a9786fc6fdcbc8a3c29c7ccf14e3631f62a360..374799ecf08a6ef2f3d7154a2865019ae6110d90 100644 (file)
@@ -473,7 +473,9 @@ typedef enum eFCurve_Flags {
        FCURVE_PROTECTED        = (1<<3),
                /* fcurve will not be evaluated for the next round */
        FCURVE_MUTED            = (1<<4),
+       
                /* fcurve uses 'auto-handles', which stay horizontal... */
+               // DEPRECATED
        FCURVE_AUTO_HANDLES     = (1<<5),
        
                /* skip evaluation, as RNA-path cannot be resolved (similar to muting, but cannot be set by user) */
index b51612037fc6bd0fe1fb36c6a9cbf229ab13fe3d..a38b33e66407b8262994afdb833b8cdeb064eff8 100644 (file)
@@ -314,7 +314,7 @@ typedef enum eBezTriple_Handle {
        HD_AUTO,
        HD_VECT,
        HD_ALIGN,
-       HD_AUTO_ANIM    /* not real handle type, but is just used as dummy item for anim code */
+       HD_AUTO_ANIM    /* auto-clamped handles for animation */
 } eBezTriple_Handle;
 
 /* interpolation modes (used only for BezTriple->ipo) */
index 85a64e02ddbeaa642c97ce9580c4587b1eb4bdd4..e5558c1738b90da821ae0f94819ad13e4eb9471c 100644 (file)
@@ -210,10 +210,13 @@ typedef struct ThemeSpace {
        char bone_solid[4], bone_pose[4];
        char strip[4], strip_select[4];
        char cframe[4];
+       
        char nurb_uline[4], nurb_vline[4];
        char act_spline[4], nurb_sel_uline[4], nurb_sel_vline[4], lastsel_point[4];
-       char handle_free[4], handle_auto[4], handle_vect[4], handle_align[4];
-       char handle_sel_free[4], handle_sel_auto[4], handle_sel_vect[4], handle_sel_align[4];
+       
+       char handle_free[4], handle_auto[4], handle_vect[4], handle_align[4], handle_auto_clamped[4];
+       char handle_sel_free[4], handle_sel_auto[4], handle_sel_vect[4], handle_sel_align[4], handle_sel_auto_clamped[4];
+       
        char ds_channel[4], ds_subchannel[4]; // dopesheet
        
        char console_output[4], console_input[4], console_info[4], console_error[4];
index 56eb20f01b2fe5a168ff3ee968de8021b5f866ad..d09d1359ce8dd33feaa4bb204857ef58c07d6928 100644 (file)
@@ -58,6 +58,7 @@ extern EnumPropertyItem image_type_items[];
 extern EnumPropertyItem beztriple_keyframe_type_items[];
 extern EnumPropertyItem beztriple_handle_type_items[];
 extern EnumPropertyItem beztriple_interpolation_mode_items[];
+extern EnumPropertyItem keyframe_handle_type_items[];
 
 extern EnumPropertyItem keyingset_path_grouping_items[];
 
index 260d483b9d24fc735772d6a93a71cb277ef3d87a..4e7fceed7e1a4325b0e3c95f8c7e9b247afd0a51 100644 (file)
@@ -51,6 +51,14 @@ EnumPropertyItem beztriple_handle_type_items[] = {
                {HD_VECT, "VECTOR", 0, "Vector", ""},
                {HD_ALIGN, "ALIGNED", 0, "Aligned", ""},
                {0, NULL, 0, NULL, NULL}};
+               
+EnumPropertyItem keyframe_handle_type_items[] = {
+               {HD_FREE, "FREE", 0, "Free", ""},
+               {HD_AUTO, "AUTO", 0, "Auto", ""},
+               {HD_AUTO_ANIM, "AUTO_CLAMPED", 0, "Auto Clamped", "Auto handles clamped to not overshoot"},
+               {HD_VECT, "VECTOR", 0, "Vector", ""},
+               {HD_ALIGN, "ALIGNED", 0, "Aligned", ""},
+               {0, NULL, 0, NULL, NULL}};
 
 EnumPropertyItem beztriple_interpolation_mode_items[] = {
                {BEZT_IPO_CONST, "CONSTANT", 0, "Constant", ""},
index cd85e100521989e3a273afd4b883c6d041d45fa8..2f37a6921d18510d00ec948c85517d0d72f3f849 100644 (file)
@@ -1336,13 +1336,13 @@ static void rna_def_fkeyframe(BlenderRNA *brna)
        /* Enums */
        prop= RNA_def_property(srna, "handle_left_type", PROP_ENUM, PROP_NONE);
        RNA_def_property_enum_sdna(prop, NULL, "h1");
-       RNA_def_property_enum_items(prop, beztriple_handle_type_items);
+       RNA_def_property_enum_items(prop, keyframe_handle_type_items);
        RNA_def_property_ui_text(prop, "Left Handle Type", "Handle types");
        RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME_PROP, NULL);
        
        prop= RNA_def_property(srna, "handle_right_type", PROP_ENUM, PROP_NONE);
        RNA_def_property_enum_sdna(prop, NULL, "h2");
-       RNA_def_property_enum_items(prop, beztriple_handle_type_items);
+       RNA_def_property_enum_items(prop, keyframe_handle_type_items);
        RNA_def_property_ui_text(prop, "Right Handle Type", "Handle types");
        RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME_PROP, NULL);
        
@@ -1541,11 +1541,6 @@ static void rna_def_fcurve(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Muted", "F-Curve is not evaluated");
        RNA_def_property_update(prop, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL);
        
-       prop= RNA_def_property(srna, "use_auto_handle_clamp", PROP_BOOLEAN, PROP_NONE);
-       RNA_def_property_boolean_sdna(prop, NULL, "flag", FCURVE_AUTO_HANDLES);
-       RNA_def_property_ui_text(prop, "Auto Clamped Handles", "All auto-handles for F-Curve are clamped");
-       RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME_PROP, NULL);
-       
        prop= RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", FCURVE_VISIBLE);
        RNA_def_property_ui_text(prop, "Hide", "F-Curve and its keyframes are hidden in the Graph Editor graphs");
index 64cd7dc646ff7d8e29b91256b5854a46e5d2e7b7..7cafc39d0ff17a34cc918f7c9c339a76ff635723 100644 (file)
@@ -878,6 +878,21 @@ static void rna_def_userdef_theme_spaces_curves(StructRNA *srna, short incl_nurb
        RNA_def_property_array(prop, 3);
        RNA_def_property_ui_text(prop, "Align handle selected color", "");
        RNA_def_property_update(prop, 0, "rna_userdef_update");
+       
+       if (incl_nurbs == 0) {
+               /* assume that when nurbs are off, this is for 2D (i.e. anim) editors */
+               prop= RNA_def_property(srna, "handle_auto_clamped", PROP_FLOAT, PROP_COLOR_GAMMA);
+               RNA_def_property_float_sdna(prop, NULL, "handle_auto_clamped");
+               RNA_def_property_array(prop, 3);
+               RNA_def_property_ui_text(prop, "Auto-Clamped handle color", "");
+               RNA_def_property_update(prop, 0, "rna_userdef_update");
+               
+               prop= RNA_def_property(srna, "handle_sel_auto_clamped", PROP_FLOAT, PROP_COLOR_GAMMA);
+               RNA_def_property_float_sdna(prop, NULL, "handle_sel_auto_clamped");
+               RNA_def_property_array(prop, 3);
+               RNA_def_property_ui_text(prop, "Auto-Clamped handle selected color", "");
+               RNA_def_property_update(prop, 0, "rna_userdef_update");
+       }
 
        prop= RNA_def_property(srna, "lastsel_point", PROP_FLOAT, PROP_COLOR_GAMMA);
        RNA_def_property_float_sdna(prop, NULL, "lastsel_point");
@@ -2254,7 +2269,7 @@ static void rna_def_userdef_edit(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "New Interpolation Type", "");
        
        prop= RNA_def_property(srna, "keyframe_new_handle_type", PROP_ENUM, PROP_NONE);
-       RNA_def_property_enum_items(prop, beztriple_handle_type_items);
+       RNA_def_property_enum_items(prop, keyframe_handle_type_items);
        RNA_def_property_enum_sdna(prop, NULL, "keyhandles_new");
        RNA_def_property_ui_text(prop, "New Handles Type", "");