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.
This commit is contained in:
parent
9358af05d0
commit
6b7544bfda
@ -100,7 +100,8 @@ class SCENE_PT_keying_sets(SceneButtonsPanel):
|
||||
col = row.column()
|
||||
col.label(text="Keyframing Settings:")
|
||||
col.prop(ks, "insertkey_needed", text="Needed")
|
||||
col.prop(ks, "insertkey_visual", text="Visual")
|
||||
col.prop(ks, "insertkey_visual", text="Visual")
|
||||
col.prop(ks, "insertkey_xyz_to_rgb", text="XYZ to RGB")
|
||||
|
||||
|
||||
class SCENE_PT_keying_set_paths(SceneButtonsPanel):
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -291,8 +291,8 @@ typedef struct ChannelDriver {
|
||||
/* python expression to execute (may call functions defined in an accessory file)
|
||||
* which relates the target 'variables' in some way to yield a single usable value
|
||||
*/
|
||||
char expression[256];
|
||||
void *expr_comp; /* PyObject - compiled expression, dont save this */
|
||||
char expression[256]; /* expression to compile for evaluation */
|
||||
void *expr_comp; /* PyObject - compiled expression, dont save this */
|
||||
|
||||
float curval; /* result of previous evaluation, for subtraction from result under certain circumstances */
|
||||
float influence; /* influence of driver on result */ // XXX to be implemented... this is like the constraint influence setting
|
||||
@ -323,8 +323,8 @@ typedef enum eDriver_Flags {
|
||||
/* driver does replace value, but overrides (for layering of animation over driver) */
|
||||
// TODO: this needs to be implemented at some stage or left out...
|
||||
DRIVER_FLAG_LAYERING = (1<<2),
|
||||
|
||||
DRIVER_FLAG_RECOMPILE = (1<<3), /* use when the expression needs to be recompiled */
|
||||
/* use when the expression needs to be recompiled */
|
||||
DRIVER_FLAG_RECOMPILE = (1<<3),
|
||||
} eDriver_Flags;
|
||||
|
||||
/* F-Curves -------------------------------------- */
|
||||
@ -367,7 +367,7 @@ typedef struct FCurve {
|
||||
char *rna_path; /* RNA-path to resolve data-access */
|
||||
|
||||
/* curve coloring (for editor) */
|
||||
int color_mode; /* coloring method to use */
|
||||
int color_mode; /* coloring method to use (eFCurve_Coloring) */
|
||||
float color[3]; /* the last-color this curve took */
|
||||
} FCurve;
|
||||
|
||||
@ -703,6 +703,7 @@ typedef enum eInsertKeyFlags {
|
||||
INSERTKEY_FAST = (1<<2), /* don't recalculate handles,etc. after adding key */
|
||||
INSERTKEY_FASTR = (1<<3), /* don't realloc mem (or increase count, as array has already been set out) */
|
||||
INSERTKEY_REPLACE = (1<<4), /* only replace an existing keyframe (this overrides INSERTKEY_NEEDED) */
|
||||
INSERTKEY_XYZ2RGB = (1<<5), /* transform F-Curves should have XYZ->RGB color mode */
|
||||
} eInsertKeyFlags;
|
||||
|
||||
/* ************************************************ */
|
||||
|
@ -267,6 +267,10 @@ static void rna_def_keyingset(BlenderRNA *brna)
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "keyingflag", INSERTKEY_MATRIX);
|
||||
RNA_def_property_ui_text(prop, "Insert Keyframes - Visual", "Insert keyframes based on 'visual transforms'.");
|
||||
|
||||
prop= RNA_def_property(srna, "insertkey_xyz_to_rgb", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "keyingflag", INSERTKEY_XYZ2RGB);
|
||||
RNA_def_property_ui_text(prop, "XYZ Transforms to RGB", "Color for newly added transformation F-Curves (Location, Rotation, Scale) and also Color is based on the transform axis.");
|
||||
|
||||
/* Keying Set API */
|
||||
RNA_api_keyingset(srna);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user