Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2011-08-04 18:13:05 +0400
committerJoshua Leung <aligorith@gmail.com>2011-08-04 18:13:05 +0400
commit900928f8bf47b8f1bbb1b2cd863d2d9649c940a0 (patch)
treee5d20746f2a35a5dca94dba00d1d0dc1ff83eeec /source/blender
parent2ed11158db7cfc157c26475a2dcb5f513043cd72 (diff)
Bassam Feature Request: "Auto Clamped" handles can now be set per
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.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/intern/curve.c10
-rw-r--r--source/blender/blenkernel/intern/fcurve.c11
-rw-r--r--source/blender/blenkernel/intern/ipo.c13
-rw-r--r--source/blender/blenkernel/intern/nla.c4
-rw-r--r--source/blender/blenloader/intern/readfile.c32
-rw-r--r--source/blender/editors/animation/drivers.c6
-rw-r--r--source/blender/editors/animation/keyframes_edit.c46
-rw-r--r--source/blender/editors/animation/keyframing.c2
-rw-r--r--source/blender/editors/include/UI_resources.h2
-rw-r--r--source/blender/editors/interface/resources.c23
-rw-r--r--source/blender/editors/space_action/action_edit.c19
-rw-r--r--source/blender/editors/space_graph/graph_edit.c19
-rw-r--r--source/blender/makesdna/DNA_anim_types.h2
-rw-r--r--source/blender/makesdna/DNA_curve_types.h2
-rw-r--r--source/blender/makesdna/DNA_userdef_types.h7
-rw-r--r--source/blender/makesrna/RNA_enum_types.h1
-rw-r--r--source/blender/makesrna/intern/rna_curve.c8
-rw-r--r--source/blender/makesrna/intern/rna_fcurve.c9
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c17
19 files changed, 147 insertions, 86 deletions
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c
index eb364af6ff8..2f1a85c57b3 100644
--- a/source/blender/blenkernel/intern/curve.c
+++ b/source/blender/blenkernel/intern/curve.c
@@ -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) ) {
diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c
index aa8f817ae3c..28f17b3cf86 100644
--- a/source/blender/blenkernel/intern/fcurve.c
+++ b/source/blender/blenkernel/intern/fcurve.c
@@ -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 */
diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c
index 104ce2b3b32..d41a3a36b2d 100644
--- a/source/blender/blenkernel/intern/ipo.c
+++ b/source/blender/blenkernel/intern/ipo.c
@@ -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
diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c
index 8391e9f6ab1..f2ce8e4e6f1 100644
--- a/source/blender/blenkernel/intern/nla.c
+++ b/source/blender/blenkernel/intern/nla.c
@@ -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);
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 1737b44a56f..435ae62123a 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -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! */
diff --git a/source/blender/editors/animation/drivers.c b/source/blender/editors/animation/drivers.c
index c9e422baa3e..3df65a942da 100644
--- a/source/blender/editors/animation/drivers.c
+++ b/source/blender/editors/animation/drivers.c
@@ -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;
diff --git a/source/blender/editors/animation/keyframes_edit.c b/source/blender/editors/animation/keyframes_edit.c
index 9f3d40a5709..ae9107ebe5a 100644
--- a/source/blender/editors/animation/keyframes_edit.c
+++ b/source/blender/editors/animation/keyframes_edit.c
@@ -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;
diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c
index 109da669ce6..fbedb466f7e 100644
--- a/source/blender/editors/animation/keyframing.c
+++ b/source/blender/editors/animation/keyframing.c
@@ -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 */
diff --git a/source/blender/editors/include/UI_resources.h b/source/blender/editors/include/UI_resources.h
index 2bc2aac165f..ff9a1f539a1 100644
--- a/source/blender/editors/include/UI_resources.h
+++ b/source/blender/editors/include/UI_resources.h
@@ -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,
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index dd63cdf5861..00c92b85ee7 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -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;
diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c
index 40d73a59a42..5276e62b9eb 100644
--- a/source/blender/editors/space_action/action_edit.c
+++ b/source/blender/editors/space_action/action_edit.c
@@ -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 *********************** */
diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c
index d88a18ffcbc..900aa6f6197 100644
--- a/source/blender/editors/space_graph/graph_edit.c
+++ b/source/blender/editors/space_graph/graph_edit.c
@@ -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", "");
}
/* ************************************************************************** */
diff --git a/source/blender/makesdna/DNA_anim_types.h b/source/blender/makesdna/DNA_anim_types.h
index 00a9786fc6f..374799ecf08 100644
--- a/source/blender/makesdna/DNA_anim_types.h
+++ b/source/blender/makesdna/DNA_anim_types.h
@@ -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) */
diff --git a/source/blender/makesdna/DNA_curve_types.h b/source/blender/makesdna/DNA_curve_types.h
index b51612037fc..a38b33e6640 100644
--- a/source/blender/makesdna/DNA_curve_types.h
+++ b/source/blender/makesdna/DNA_curve_types.h
@@ -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) */
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index 85a64e02ddb..e5558c1738b 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -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];
diff --git a/source/blender/makesrna/RNA_enum_types.h b/source/blender/makesrna/RNA_enum_types.h
index 56eb20f01b2..d09d1359ce8 100644
--- a/source/blender/makesrna/RNA_enum_types.h
+++ b/source/blender/makesrna/RNA_enum_types.h
@@ -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[];
diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c
index 260d483b9d2..4e7fceed7e1 100644
--- a/source/blender/makesrna/intern/rna_curve.c
+++ b/source/blender/makesrna/intern/rna_curve.c
@@ -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", ""},
diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c
index cd85e100521..2f37a6921d1 100644
--- a/source/blender/makesrna/intern/rna_fcurve.c
+++ b/source/blender/makesrna/intern/rna_fcurve.c
@@ -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");
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index 64cd7dc646f..7cafc39d0ff 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -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", "");