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>2009-12-10 13:40:28 +0300
committerJoshua Leung <aligorith@gmail.com>2009-12-10 13:40:28 +0300
commit6b7544bfda1d51e6d256240316ed1900e838faeb (patch)
treeb73a6011fb89b0c4bbeb20f80b03d5e45bb5d6a1
parent9358af05d09817fcba3c35e34bcdf8c6c08c3be8 (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.
-rw-r--r--release/scripts/ui/properties_scene.py3
-rw-r--r--source/blender/editors/animation/keyframing.c14
-rw-r--r--source/blender/editors/include/ED_keyframing.h2
-rw-r--r--source/blender/makesdna/DNA_anim_types.h11
-rw-r--r--source/blender/makesrna/intern/rna_animation.c4
5 files changed, 26 insertions, 8 deletions
diff --git a/release/scripts/ui/properties_scene.py b/release/scripts/ui/properties_scene.py
index 86703d9f05d..857b6bfff02 100644
--- a/release/scripts/ui/properties_scene.py
+++ b/release/scripts/ui/properties_scene.py
@@ -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):
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)
diff --git a/source/blender/makesdna/DNA_anim_types.h b/source/blender/makesdna/DNA_anim_types.h
index c5d0231ce62..6a9700a5573 100644
--- a/source/blender/makesdna/DNA_anim_types.h
+++ b/source/blender/makesdna/DNA_anim_types.h
@@ -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;
/* ************************************************ */
diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c
index 3e7638b3d51..fdf345015e2 100644
--- a/source/blender/makesrna/intern/rna_animation.c
+++ b/source/blender/makesrna/intern/rna_animation.c
@@ -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);
}