diff options
author | Joshua Leung <aligorith@gmail.com> | 2009-12-10 13:40:28 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2009-12-10 13:40:28 +0300 |
commit | 6b7544bfda1d51e6d256240316ed1900e838faeb (patch) | |
tree | b73a6011fb89b0c4bbeb20f80b03d5e45bb5d6a1 /source/blender/editors | |
parent | 9358af05d09817fcba3c35e34bcdf8c6c08c3be8 (diff) |
Durian Request: Default F-Curve Auto-Colour Modes
Added option to KeyingSets+Keyframing Functions which makes newly added F-Curves for Transforms + Colours to use the colour mode which uses the array index to determine the colour of the F-Curve.
The main implication of this is that when this option is enabled for a KeyingSet, all sets of XYZ F-Curves (i.e. location, rotation, scale) for transforms will be shown in Red/Green/Blue instead of some automatically determined "rainbow" colour. Useful for animators far too used to Maya's Graph Editor :P
This setting is named, "XYZ to RGB", though that doesn't make its purpose entirely clear.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/animation/keyframing.c | 14 | ||||
-rw-r--r-- | source/blender/editors/include/ED_keyframing.h | 2 |
2 files changed, 14 insertions, 2 deletions
diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index 3bfb8bdc867..3e25c9a6b60 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -274,6 +274,7 @@ int insert_vert_fcurve (FCurve *fcu, float x, float y, short flag) beztr.ipo= U.ipo_new; /* use default interpolation mode here... */ beztr.f1= beztr.f2= beztr.f3= SELECT; beztr.h1= beztr.h2= HD_AUTO; // XXX what about when we replace an old one? + //BEZKEYTYPE(&beztr)= scene->keytype; /* default keyframe type */ /* add temp beztriple to keyframes */ a= insert_bezt_fcurve(fcu, &beztr, flag); @@ -809,7 +810,7 @@ short insert_keyframe (ID *id, bAction *act, const char group[], const char rna_ return 0; } - /* get F-Curve - if no action is provided, keyframe to the default one attached to this ID-block */ + /* if no action is provided, keyframe to the default one attached to this ID-block */ if (act == NULL) { AnimData *adt= BKE_animdata_from_id(id); @@ -842,8 +843,19 @@ short insert_keyframe (ID *id, bAction *act, const char group[], const char rna_ /* will only loop once unless the array index was -1 */ for (; array_index < array_index_max; array_index++) { + /* make sure the F-Curve exists */ fcu= verify_fcurve(act, group, rna_path, array_index, 1); + /* set color mode if the F-Curve is new (i.e. without any keyframes) */ + if ((fcu->totvert == 0) && (flag & INSERTKEY_XYZ2RGB)) { + /* for Loc/Rot/Scale and also Color F-Curves, the color of the F-Curve in the Graph Editor, + * is determined by the array index for the F-Curve + */ + if (ELEM4(RNA_property_subtype(prop), PROP_TRANSLATION, PROP_XYZ, PROP_EULER, PROP_COLOR)) { + fcu->color_mode= FCURVE_COLOR_AUTO_RGB; + } + } + /* insert keyframe */ ret += insert_keyframe_direct(ptr, prop, fcu, cfra, flag); } diff --git a/source/blender/editors/include/ED_keyframing.h b/source/blender/editors/include/ED_keyframing.h index 97a08845020..45a62ee7bcb 100644 --- a/source/blender/editors/include/ED_keyframing.h +++ b/source/blender/editors/include/ED_keyframing.h @@ -149,7 +149,7 @@ short ANIM_driver_can_paste(void); /* Main Driver Management API calls: * Add a new driver for the specified property on the given ID block */ -short ANIM_add_driver (struct ID *id, const char rna_path[], int array_index, short flag, int type); +short ANIM_add_driver(struct ID *id, const char rna_path[], int array_index, short flag, int type); /* Main Driver Management API calls: * Remove the driver for the specified property on the given ID block (if available) |