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:
authorXiao Xiangquan <xiaoxiangquan@gmail.com>2011-09-01 19:08:32 +0400
committerXiao Xiangquan <xiaoxiangquan@gmail.com>2011-09-01 19:08:32 +0400
commit981f7fcd0d315abb425bf34dd37f7cd4d9e8d55e (patch)
tree70800c93ec1a12579c32874e2a72eaf3290eba8e /source/blender/editors/space_graph
parent5b91a783cf0ec132398a2767d3419d675e5126b5 (diff)
parent2365c64014b3e067bb212b2061f1d14c1f944090 (diff)
merge with trunk r39834
Diffstat (limited to 'source/blender/editors/space_graph')
-rw-r--r--source/blender/editors/space_graph/graph_buttons.c100
-rw-r--r--source/blender/editors/space_graph/graph_draw.c39
-rw-r--r--source/blender/editors/space_graph/graph_edit.c111
-rw-r--r--source/blender/editors/space_graph/graph_ops.c6
-rw-r--r--source/blender/editors/space_graph/graph_select.c32
-rw-r--r--source/blender/editors/space_graph/graph_utils.c27
-rw-r--r--source/blender/editors/space_graph/space_graph.c18
7 files changed, 221 insertions, 112 deletions
diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c
index 54e2df45cff..1397a5ada94 100644
--- a/source/blender/editors/space_graph/graph_buttons.c
+++ b/source/blender/editors/space_graph/graph_buttons.c
@@ -1,6 +1,4 @@
/*
- * $Id$
- *
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
@@ -55,6 +53,7 @@
#include "BKE_fcurve.h"
#include "BKE_main.h"
#include "BKE_screen.h"
+#include "BKE_unit.h"
#include "WM_api.h"
@@ -79,8 +78,7 @@
/* ******************* graph editor space & buttons ************** */
-#define B_NOP 1
-#define B_REDR 2
+#define B_REDR 1
/* -------------- */
@@ -246,6 +244,34 @@ static short get_active_fcurve_keyframe_edit(FCurve *fcu, BezTriple **bezt, BezT
return 0;
}
+/* update callback for active keyframe properties - base updates stuff */
+static void graphedit_activekey_update_cb(bContext *UNUSED(C), void *fcu_ptr, void *UNUSED(bezt_ptr))
+{
+ FCurve *fcu = (FCurve *)fcu_ptr;
+
+ /* make sure F-Curve and its handles are still valid after this editing */
+ sort_time_fcurve(fcu);
+ testhandles_fcurve(fcu);
+}
+
+/* update callback for active keyframe properties - handle-editing wrapper */
+static void graphedit_activekey_handles_cb(bContext *C, void *fcu_ptr, void *bezt_ptr)
+{
+ BezTriple *bezt = (BezTriple *)bezt_ptr;
+
+ /* since editing the handles, make sure they're set to types which are receptive to editing
+ * see transform_conversions.c :: createTransGraphEditData(), last step in second loop
+ */
+ if (ELEM(bezt->h1, HD_AUTO, HD_AUTO_ANIM) && ELEM(bezt->h2, HD_AUTO, HD_AUTO_ANIM)) {
+ /* by changing to aligned handles, these can now be moved... */
+ bezt->h1= HD_ALIGN;
+ bezt->h2= HD_ALIGN;
+ }
+
+ /* now call standard updates */
+ graphedit_activekey_update_cb(C, fcu_ptr, bezt_ptr);
+}
+
static void graph_panel_key_properties(const bContext *C, Panel *pa)
{
bAnimListElem *ale;
@@ -264,27 +290,66 @@ static void graph_panel_key_properties(const bContext *C, Panel *pa)
/* only show this info if there are keyframes to edit */
if (get_active_fcurve_keyframe_edit(fcu, &bezt, &prevbezt)) {
- PointerRNA bezt_ptr;
+ PointerRNA bezt_ptr, id_ptr, fcu_prop_ptr;
+ PropertyRNA *fcu_prop = NULL;
+ uiBut *but;
+ int unit = B_UNIT_NONE;
/* RNA pointer to keyframe, to allow editing */
RNA_pointer_create(ale->id, &RNA_Keyframe, bezt, &bezt_ptr);
+ /* get property that F-Curve affects, for some unit-conversion magic */
+ RNA_id_pointer_create(ale->id, &id_ptr);
+ if (RNA_path_resolve(&id_ptr, fcu->rna_path, &fcu_prop_ptr, &fcu_prop) && fcu_prop) {
+ /* determine the unit for this property */
+ unit = RNA_SUBTYPE_UNIT(RNA_property_subtype(fcu_prop));
+ }
+
/* interpolation */
col= uiLayoutColumn(layout, 0);
uiItemR(col, &bezt_ptr, "interpolation", 0, NULL, ICON_NONE);
- /* numerical coordinate editing */
+ /* numerical coordinate editing
+ * - we use the button-versions of the calls so that we can attach special update handlers
+ * and unit conversion magic that cannot be achieved using a purely RNA-approach
+ */
+ // XXX:
col= uiLayoutColumn(layout, 1);
/* keyframe itself */
- uiItemR(col, &bezt_ptr, "co", 0, "Key", ICON_NONE);
+ {
+ uiItemL(col, "Key:", ICON_NONE);
+
+ but = uiDefButR(block, NUM, B_REDR, "Frame", 0, 0, UI_UNIT_X, UI_UNIT_Y, &bezt_ptr, "co", 0, 0, 0, -1, -1, NULL);
+ uiButSetFunc(but, graphedit_activekey_update_cb, fcu, bezt);
+
+ but = uiDefButR(block, NUM, B_REDR, "Value", 0, 0, UI_UNIT_X, UI_UNIT_Y, &bezt_ptr, "co", 1, 0, 0, -1, -1, NULL);
+ uiButSetFunc(but, graphedit_activekey_update_cb, fcu, bezt);
+ uiButSetUnitType(but, unit);
+ }
/* previous handle - only if previous was Bezier interpolation */
- if ((prevbezt) && (prevbezt->ipo == BEZT_IPO_BEZ))
- uiItemR(col, &bezt_ptr, "handle_left", 0, NULL, ICON_NONE);
+ if ((prevbezt) && (prevbezt->ipo == BEZT_IPO_BEZ)) {
+ uiItemL(col, "Left Handle:", ICON_NONE);
+
+ but = uiDefButR(block, NUM, B_REDR, "X", 0, 0, UI_UNIT_X, UI_UNIT_Y, &bezt_ptr, "handle_left", 0, 0, 0, -1, -1, NULL);
+ uiButSetFunc(but, graphedit_activekey_handles_cb, fcu, bezt);
+
+ but = uiDefButR(block, NUM, B_REDR, "Y", 0, 0, UI_UNIT_X, UI_UNIT_Y, &bezt_ptr, "handle_left", 1, 0, 0, -1, -1, NULL);
+ uiButSetFunc(but, graphedit_activekey_handles_cb, fcu, bezt);
+ uiButSetUnitType(but, unit);
+ }
/* next handle - only if current is Bezier interpolation */
- if (bezt->ipo == BEZT_IPO_BEZ)
- uiItemR(col, &bezt_ptr, "handle_right", 0, NULL, ICON_NONE);
+ if (bezt->ipo == BEZT_IPO_BEZ) {
+ uiItemL(col, "Right Handle:", ICON_NONE);
+
+ but = uiDefButR(block, NUM, B_REDR, "X", 0, 0, UI_UNIT_X, UI_UNIT_Y, &bezt_ptr, "handle_right", 0, 0, 0, -1, -1, NULL);
+ uiButSetFunc(but, graphedit_activekey_handles_cb, fcu, bezt);
+
+ but = uiDefButR(block, NUM, B_REDR, "Y", 0, 0, UI_UNIT_X, UI_UNIT_Y, &bezt_ptr, "handle_right", 1, 0, 0, -1, -1, NULL);
+ uiButSetFunc(but, graphedit_activekey_handles_cb, fcu, bezt);
+ uiButSetUnitType(but, unit);
+ }
}
else {
if ((fcu->bezt == NULL) && (fcu->modifiers.first)) {
@@ -474,7 +539,7 @@ static void graph_panel_driverVar__locDiff(uiLayout *layout, ID *id, DriverVar *
uiItemPointerR(col, &dtar_ptr, "bone_target", &tar_ptr, "bones", "", ICON_BONE_DATA);
}
- uiItemR(col, &dtar_ptr, "use_local_space_transform", 0, NULL, ICON_NONE);
+ uiItemR(col, &dtar_ptr, "transform_space", 0, NULL, ICON_NONE);
col= uiLayoutColumn(layout, 1);
uiTemplateAnyID(col, &dtar2_ptr, "id", "id_type", "Ob/Bone 2:");
@@ -486,7 +551,7 @@ static void graph_panel_driverVar__locDiff(uiLayout *layout, ID *id, DriverVar *
uiItemPointerR(col, &dtar2_ptr, "bone_target", &tar_ptr, "bones", "", ICON_BONE_DATA);
}
- uiItemR(col, &dtar2_ptr, "use_local_space_transform", 0, NULL, ICON_NONE);
+ uiItemR(col, &dtar2_ptr, "transform_space", 0, NULL, ICON_NONE);
}
/* settings for 'transform channel' driver variable type */
@@ -495,7 +560,7 @@ static void graph_panel_driverVar__transChan(uiLayout *layout, ID *id, DriverVar
DriverTarget *dtar= &dvar->targets[0];
Object *ob = (Object *)dtar->id;
PointerRNA dtar_ptr;
- uiLayout *col, *row;
+ uiLayout *col, *subcol;
/* initialise RNA pointer to the target */
RNA_pointer_create(id, &RNA_DriverTarget, dtar, &dtar_ptr);
@@ -511,9 +576,9 @@ static void graph_panel_driverVar__transChan(uiLayout *layout, ID *id, DriverVar
uiItemPointerR(col, &dtar_ptr, "bone_target", &tar_ptr, "bones", "", ICON_BONE_DATA);
}
- row= uiLayoutRow(layout, 1);
- uiItemR(row, &dtar_ptr, "transform_type", 0, "", ICON_NONE);
- uiItemR(row, &dtar_ptr, "use_local_space_transform", 0, NULL, ICON_NONE);
+ subcol= uiLayoutColumn(layout, 1);
+ uiItemR(subcol, &dtar_ptr, "transform_type", 0, NULL, ICON_NONE);
+ uiItemR(subcol, &dtar_ptr, "transform_space", 0, "Space", ICON_NONE);
}
/* driver settings for active F-Curve (only for 'Drivers' mode) */
@@ -661,7 +726,6 @@ static void graph_panel_drivers(const bContext *C, Panel *pa)
static void do_graph_region_modifier_buttons(bContext *C, void *UNUSED(arg), int event)
{
switch (event) {
- case B_REDR:
case B_FMODIFIER_REDRAW: // XXX this should send depsgraph updates too
WM_event_add_notifier(C, NC_ANIMATION, NULL); // XXX need a notifier specially for F-Modifiers
break;
diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c
index 382bb71a592..dc5e71f0406 100644
--- a/source/blender/editors/space_graph/graph_draw.c
+++ b/source/blender/editors/space_graph/graph_draw.c
@@ -1,6 +1,4 @@
/*
- * $Id$
- *
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
@@ -356,10 +354,6 @@ static void draw_fcurve_handles (SpaceIpo *sipo, FCurve *fcu)
float *fp;
unsigned char col[4];
- /* if only selected keyframes have handles shown, skip the first round */
- if ((sel == 0) && (sipo->flag & SIPO_SELVHANDLESONLY))
- continue;
-
for (b= 0; b < fcu->totvert; b++, prevbezt=bezt, bezt++) {
/* if only selected keyframes can get their handles shown,
* check that keyframe is selected
@@ -372,7 +366,7 @@ static void draw_fcurve_handles (SpaceIpo *sipo, FCurve *fcu)
/* draw handle with appropriate set of colors if selection is ok */
if ((bezt->f2 & SELECT)==sel) {
fp= bezt->vec[0];
-
+
/* only draw first handle if previous segment had handles */
if ( (!prevbezt && (bezt->ipo==BEZT_IPO_BEZ)) || (prevbezt && (prevbezt->ipo==BEZT_IPO_BEZ)) )
{
@@ -382,14 +376,14 @@ static void draw_fcurve_handles (SpaceIpo *sipo, FCurve *fcu)
glVertex2fv(fp); glVertex2fv(fp+3);
}
-
+
/* only draw second handle if this segment is bezier */
if (bezt->ipo == BEZT_IPO_BEZ)
{
UI_GetThemeColor3ubv(basecol + bezt->h2, col);
col[3]= drawFCurveFade(fcu) * 255;
glColor4ubv((GLubyte *)col);
-
+
glVertex2fv(fp+3); glVertex2fv(fp+6);
}
}
@@ -402,7 +396,7 @@ static void draw_fcurve_handles (SpaceIpo *sipo, FCurve *fcu)
UI_GetThemeColor3ubv(basecol + bezt->h1, col);
col[3]= drawFCurveFade(fcu) * 255;
glColor4ubv((GLubyte *)col);
-
+
glVertex2fv(fp); glVertex2fv(fp+3);
}
@@ -684,6 +678,7 @@ static void draw_fcurve_curve_bezts (bAnimContext *ac, ID *id, FCurve *fcu, View
}
/* draw curve between first and last keyframe (if there are enough to do so) */
+ // TODO: optimise this to not have to calc stuff out of view too?
while (b--) {
if (prevbezt->ipo==BEZT_IPO_CONST) {
/* Constant-Interpolation: draw segment between previous keyframe and next, but holding same value */
@@ -706,12 +701,12 @@ static void draw_fcurve_curve_bezts (bAnimContext *ac, ID *id, FCurve *fcu, View
* - resol determines number of points to sample in between keyframes
*/
- /* resol not depending on horizontal resolution anymore, drivers for example... */
- // TODO: would be nice to make this depend on the scale of the graph too...
+ /* resol depends on distance between points (not just horizontal) OR is a fixed high res */
+ // TODO: view scale should factor into this someday too...
if (fcu->driver)
resol= 32;
else
- resol= (int)(3.0*sqrt(bezt->vec[1][0] - prevbezt->vec[1][0]));
+ resol= (int)(5.0f*len_v2v2(bezt->vec[1], prevbezt->vec[1]));
if (resol < 2) {
/* only draw one */
@@ -721,6 +716,7 @@ static void draw_fcurve_curve_bezts (bAnimContext *ac, ID *id, FCurve *fcu, View
}
else {
/* clamp resolution to max of 32 */
+ // NOTE: higher values will crash
if (resol > 32) resol= 32;
v1[0]= prevbezt->vec[1][0];
@@ -834,7 +830,7 @@ void graph_draw_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGri
int filter;
/* build list of curves to draw */
- filter= (ANIMFILTER_VISIBLE|ANIMFILTER_CURVESONLY|ANIMFILTER_CURVEVISIBLE);
+ filter= (ANIMFILTER_DATA_VISIBLE|ANIMFILTER_CURVE_VISIBLE);
filter |= ((sel) ? (ANIMFILTER_SEL) : (ANIMFILTER_UNSEL));
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
@@ -877,6 +873,11 @@ void graph_draw_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGri
glColor4f(fcu->color[0], fcu->color[1], fcu->color[2], drawFCurveFade(fcu));
}
+ /* draw active F-Curve thicker than the rest to make it stand out */
+ if (fcu->flag & FCURVE_ACTIVE) {
+ glLineWidth(2.0);
+ }
+
/* anti-aliased lines for less jagged appearance */
if ((sipo->flag & SIPO_BEAUTYDRAW_OFF)==0) glEnable(GL_LINE_SMOOTH);
glEnable(GL_BLEND);
@@ -898,6 +899,7 @@ void graph_draw_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGri
/* restore settings */
setlinestyle(0);
+ glLineWidth(1.0);
if ((sipo->flag & SIPO_BEAUTYDRAW_OFF)==0) glDisable(GL_LINE_SMOOTH);
glDisable(GL_BLEND);
@@ -964,10 +966,11 @@ void graph_draw_channel_names(bContext *C, bAnimContext *ac, ARegion *ar)
View2D *v2d= &ar->v2d;
float y= 0.0f, height;
- int items, i=0;
+ size_t items;
+ int i=0;
/* build list of channels to draw */
- filter= (ANIMFILTER_VISIBLE|ANIMFILTER_CHANNELS);
+ filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_LIST_CHANNELS);
items= ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* Update max-extent of channels here (taking into account scrollers):
@@ -1001,6 +1004,7 @@ void graph_draw_channel_names(bContext *C, bAnimContext *ac, ARegion *ar)
}
{ /* second pass: widgets */
uiBlock *block= uiBeginBlock(C, ar, "graph channel buttons", UI_EMBOSS);
+ size_t channel_index = 0;
y= (float)ACHANNEL_FIRST;
@@ -1017,11 +1021,12 @@ void graph_draw_channel_names(bContext *C, bAnimContext *ac, ARegion *ar)
IN_RANGE(ymaxc, v2d->cur.ymin, v2d->cur.ymax) )
{
/* draw all channels using standard channel-drawing API */
- ANIM_channel_draw_widgets(ac, ale, block, yminc, ymaxc);
+ ANIM_channel_draw_widgets(C, ac, ale, block, yminc, ymaxc, channel_index);
}
/* adjust y-position for next one */
y -= ACHANNEL_STEP;
+ channel_index++;
}
uiEndBlock(C, block);
diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c
index 56e96cf5c07..c3a0069a1a1 100644
--- a/source/blender/editors/space_graph/graph_edit.c
+++ b/source/blender/editors/space_graph/graph_edit.c
@@ -92,7 +92,7 @@ void get_graph_keyframe_extents (bAnimContext *ac, float *xmin, float *xmax, flo
int filter;
/* get data to filter, from Dopesheet */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
+ filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* set large values to try to override */
@@ -283,7 +283,7 @@ void GRAPH_OT_view_selected (wmOperatorType *ot)
/* Bake each F-Curve into a set of samples, and store as a ghost curve */
static void create_ghost_curves (bAnimContext *ac, int start, int end)
{
- SpaceIpo *sipo= (SpaceIpo *)ac->sa->spacedata.first;
+ SpaceIpo *sipo= (SpaceIpo *)ac->sl;
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
@@ -298,7 +298,7 @@ static void create_ghost_curves (bAnimContext *ac, int start, int end)
}
/* filter data */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_SEL | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
+ filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* loop through filtered data and add keys between selected keyframes on every frame */
@@ -403,7 +403,7 @@ static int graphkeys_clear_ghostcurves_exec(bContext *C, wmOperator *UNUSED(op))
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
- sipo= (SpaceIpo *)ac.sa->spacedata.first;
+ sipo= (SpaceIpo *)ac.sl;
/* if no ghost curves, don't do anything */
if (sipo->ghostCurves.first == NULL)
@@ -457,7 +457,7 @@ static void insert_graph_keys(bAnimContext *ac, short mode)
short flag = 0;
/* filter data */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
+ filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
if (mode == 2) filter |= ANIMFILTER_SEL;
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
@@ -652,7 +652,7 @@ static short copy_graph_keys (bAnimContext *ac)
free_anim_copybuf();
/* filter data */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
+ filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* copy keyframes */
@@ -671,7 +671,7 @@ static short paste_graph_keys (bAnimContext *ac,
int filter, ok=0;
/* filter data */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
+ filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* paste keyframes */
@@ -777,7 +777,7 @@ static void duplicate_graph_keys (bAnimContext *ac)
int filter;
/* filter data */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
+ filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* loop through filtered data and delete selected keys */
@@ -846,7 +846,7 @@ static void delete_graph_keys (bAnimContext *ac)
int filter;
/* filter data */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
+ filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* loop through filtered data and delete selected keys */
@@ -913,7 +913,7 @@ static void clean_graph_keys (bAnimContext *ac, float thresh)
int filter;
/* filter data */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_SEL | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
+ filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_SEL | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* loop through filtered data and clean curves */
@@ -980,7 +980,7 @@ static void bake_graph_curves (bAnimContext *ac, int start, int end)
int filter;
/* filter data */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
+ filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* loop through filtered data and add keys between selected keyframes on every frame */
@@ -1128,7 +1128,7 @@ static int graphkeys_sound_bake_exec(bContext *C, wmOperator *op)
end = CFRA + sbi.length - 1;
/* filter anim channels */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
+ filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
/* loop through all selected F-Curves, replacing its data with the sound samples */
@@ -1217,7 +1217,7 @@ static void sample_graph_keys (bAnimContext *ac)
int filter;
/* filter data */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE| ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
+ filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* loop through filtered data and add keys between selected keyframes on every frame */
@@ -1271,10 +1271,17 @@ void GRAPH_OT_sample (wmOperatorType *ot)
/* ******************** Set Extrapolation-Type Operator *********************** */
+/* defines for make/clear cyclic extrapolation tools */
+#define MAKE_CYCLIC_EXPO -1
+#define CLEAR_CYCLIC_EXPO -2
+
/* defines for set extrapolation-type for selected keyframes tool */
static EnumPropertyItem prop_graphkeys_expo_types[] = {
{FCURVE_EXTRAPOLATE_CONSTANT, "CONSTANT", 0, N_("Constant Extrapolation"), ""},
{FCURVE_EXTRAPOLATE_LINEAR, "LINEAR", 0, N_("Linear Extrapolation"), ""},
+
+ {MAKE_CYCLIC_EXPO, "MAKE_CYCLIC", 0, "Make Cyclic (F-Modifier)", "Add Cycles F-Modifier if one doesn't exist already"},
+ {CLEAR_CYCLIC_EXPO, "CLEAR_CYCLIC", 0, "Clear Cyclic (F-Modifier)", "Remove Cycles F-Modifier if not needed anymore"},
{0, NULL, 0, NULL, NULL}
};
@@ -1286,13 +1293,40 @@ static void setexpo_graph_keys(bAnimContext *ac, short mode)
int filter;
/* filter data */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
+ filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* loop through setting mode per F-Curve */
for (ale= anim_data.first; ale; ale= ale->next) {
FCurve *fcu= (FCurve *)ale->data;
- fcu->extend= mode;
+
+ if (mode >= 0) {
+ /* just set mode setting */
+ fcu->extend= mode;
+ }
+ else {
+ /* shortcuts for managing Cycles F-Modifiers to make it easier to toggle cyclic animation
+ * without having to go through FModifier UI in Graph Editor to do so
+ */
+ if (mode == MAKE_CYCLIC_EXPO) {
+ /* only add if one doesn't exist */
+ if (list_has_suitable_fmodifier(&fcu->modifiers, FMODIFIER_TYPE_CYCLES, -1) == 0) {
+ // TODO: add some more preset versions which set different extrapolation options?
+ add_fmodifier(&fcu->modifiers, FMODIFIER_TYPE_CYCLES);
+ }
+ }
+ else if (mode == CLEAR_CYCLIC_EXPO) {
+ /* remove all the modifiers fitting this description */
+ FModifier *fcm, *fcn=NULL;
+
+ for (fcm = fcu->modifiers.first; fcm; fcm = fcn) {
+ fcn = fcm->next;
+
+ if (fcm->type == FMODIFIER_TYPE_CYCLES)
+ remove_fmodifier(&fcu->modifiers, fcm);
+ }
+ }
+ }
}
/* cleanup */
@@ -1355,7 +1389,7 @@ static void setipo_graph_keys(bAnimContext *ac, short mode)
KeyframeEditFunc set_cb= ANIM_editkeyframes_ipo(mode);
/* filter data */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
+ filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* loop through setting BezTriple interpolation
@@ -1415,8 +1449,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)
{
@@ -1428,7 +1460,7 @@ static void sethandles_graph_keys(bAnimContext *ac, short mode)
KeyframeEditFunc sel_cb= ANIM_editkeyframes_ok(BEZT_OK_SELECTED);
/* filter data */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
+ filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* loop through setting flags for handles
@@ -1439,12 +1471,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);
}
@@ -1481,15 +1507,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, N_("Automatic"), N_("Handles that are automatically adjusted upon moving the keyframe. Whole curve")},
- {HD_VECT, "VECTOR", 0, N_("Vector"), ""},
- {HD_ALIGN, "ALIGNED", 0, N_("Aligned"), ""},
- {HD_FREE, "FREE_ALIGN", 0, N_("Free"), ""},
- {HD_AUTO_ANIM, "ANIM_CLAMPED", 0, N_("Auto Clamped"), N_("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";
@@ -1504,7 +1521,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", RNA_enum_items_gettexted(graphkeys_handle_type_items), 0, _("Type"), "");
+ ot->prop= RNA_def_enum(ot->srna, "type", RNA_enum_items_gettexted(keyframe_handle_type_items), 0, _("Type"), "");
}
/* ************************************************************************** */
@@ -1550,7 +1567,7 @@ static int graphkeys_euler_filter_exec (bContext *C, wmOperator *op)
*/
/* step 1: extract only the rotation f-curves */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
+ filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
for (ale= anim_data.first; ale; ale= ale->next) {
@@ -1716,7 +1733,7 @@ static int graphkeys_framejump_exec(bContext *C, wmOperator *UNUSED(op))
memset(&ked, 0, sizeof(KeyframeEditData));
/* loop over action data, averaging values */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
+ filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
for (ale= anim_data.first; ale; ale= ale->next) {
@@ -1741,7 +1758,7 @@ static int graphkeys_framejump_exec(bContext *C, wmOperator *UNUSED(op))
/* set the new current frame and cursor values, based on the average time and value */
if (ked.i1) {
- SpaceIpo *sipo= ac.sa->spacedata.first;
+ SpaceIpo *sipo= (SpaceIpo *)ac.sl;
Scene *scene= ac.scene;
/* take the average values, rounding to the nearest int for the current frame */
@@ -1795,7 +1812,7 @@ static void snap_graph_keys(bAnimContext *ac, short mode)
KeyframeEditFunc edit_cb;
/* filter data */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
+ filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* get beztriple editing callbacks */
@@ -1808,7 +1825,7 @@ static void snap_graph_keys(bAnimContext *ac, short mode)
ked.list.last= (ac->markers) ? ac->markers->last : NULL;
}
else if (mode == GRAPHKEYS_SNAP_VALUE) {
- SpaceIpo *sipo= (SpaceIpo *)ac->sa->spacedata.first;
+ SpaceIpo *sipo= (SpaceIpo *)ac->sl;
ked.f1= (sipo) ? sipo->cursorVal : 0.0f;
}
@@ -1922,12 +1939,12 @@ static void mirror_graph_keys(bAnimContext *ac, short mode)
return;
}
else if (mode == GRAPHKEYS_MIRROR_VALUE) {
- SpaceIpo *sipo= (SpaceIpo *)ac->sa->spacedata.first;
+ SpaceIpo *sipo= (SpaceIpo *)ac->sl;
ked.f1= (sipo) ? sipo->cursorVal : 0.0f;
}
/* filter data */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE| ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
+ filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* mirror keyframes */
@@ -2011,7 +2028,7 @@ static int graphkeys_smooth_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_CANCELLED;
/* filter data */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE| ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
+ filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
/* smooth keyframes */
@@ -2102,11 +2119,11 @@ static int graph_fmodifier_add_exec(bContext *C, wmOperator *op)
type= RNA_enum_get(op->ptr, "type");
/* filter data */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
+ filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
if (RNA_boolean_get(op->ptr, "only_active"))
filter |= ANIMFILTER_ACTIVE; // FIXME: enforce in this case only a single channel to get handled?
else
- filter |= (ANIMFILTER_SEL|ANIMFILTER_CURVEVISIBLE);
+ filter |= (ANIMFILTER_SEL|ANIMFILTER_CURVE_VISIBLE);
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
/* add f-modifier to each curve */
@@ -2225,7 +2242,7 @@ static int graph_fmodifier_paste_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
/* filter data */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY);
+ filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT);
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
/* paste modifiers */
@@ -2264,7 +2281,7 @@ void GRAPH_OT_fmodifier_paste (wmOperatorType *ot)
/* api callbacks */
ot->exec= graph_fmodifier_paste_exec;
- ot->poll= graphop_editable_keyframes_poll;
+ ot->poll= graphop_active_fcurve_poll;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
diff --git a/source/blender/editors/space_graph/graph_ops.c b/source/blender/editors/space_graph/graph_ops.c
index 4a5bebb6b91..16ff76f2331 100644
--- a/source/blender/editors/space_graph/graph_ops.c
+++ b/source/blender/editors/space_graph/graph_ops.c
@@ -48,6 +48,7 @@
#include "UI_view2d.h"
#include "ED_anim_api.h"
+#include "ED_markers.h"
#include "ED_screen.h"
#include "ED_transform.h"
@@ -363,7 +364,7 @@ static void graphedit_keymap_keyframes (wmKeyConfig *keyconf, wmKeyMap *keymap)
WM_keymap_add_item(keymap, "GRAPH_OT_handle_type", VKEY, KM_PRESS, 0, 0);
- WM_keymap_add_item(keymap, "GRAPH_OT_interpolation_type", TKEY, KM_PRESS, KM_SHIFT, 0);
+ WM_keymap_add_item(keymap, "GRAPH_OT_interpolation_type", TKEY, KM_PRESS, 0, 0);
/* destructive */
WM_keymap_add_item(keymap, "GRAPH_OT_clean", OKEY, KM_PRESS, 0, 0);
@@ -401,6 +402,9 @@ static void graphedit_keymap_keyframes (wmKeyConfig *keyconf, wmKeyMap *keymap)
/* transform system */
transform_keymap_for_space(keyconf, keymap, SPACE_IPO);
+
+ /* special markers hotkeys for anim editors: see note in definition of this function */
+ ED_marker_keymap_animedit_conflictfree(keymap);
}
/* --------------- */
diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c
index df1932ecf69..5e256e77c0d 100644
--- a/source/blender/editors/space_graph/graph_select.c
+++ b/source/blender/editors/space_graph/graph_select.c
@@ -92,12 +92,12 @@ static void deselect_graph_keys (bAnimContext *ac, short test, short sel)
bAnimListElem *ale;
int filter;
- SpaceIpo *sipo= (SpaceIpo *)ac->sa->spacedata.first;
+ SpaceIpo *sipo= (SpaceIpo *)ac->sl;
KeyframeEditData ked= {{NULL}};
KeyframeEditFunc test_cb, sel_cb;
/* determine type-based settings */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
+ filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_NODUPLIS);
/* filter data */
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
@@ -203,7 +203,7 @@ static void borderselect_graphkeys (bAnimContext *ac, rcti rect, short mode, sho
bAnimListElem *ale;
int filter;
- SpaceIpo *sipo= (SpaceIpo *)ac->sa->spacedata.first;
+ SpaceIpo *sipo= (SpaceIpo *)ac->sl;
KeyframeEditData ked;
KeyframeEditFunc ok_cb, select_cb;
View2D *v2d= &ac->ar->v2d;
@@ -214,7 +214,7 @@ static void borderselect_graphkeys (bAnimContext *ac, rcti rect, short mode, sho
UI_view2d_region_to_view(v2d, rect.xmax, rect.ymax, &rectf.xmax, &rectf.ymax);
/* filter data */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_NODUPLIS);
+ filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* get beztriple editing/validation funcs */
@@ -404,7 +404,7 @@ static void markers_selectkeys_between (bAnimContext *ac)
ked.f2= max;
/* filter data */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
+ filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* select keys in-between */
@@ -444,7 +444,7 @@ static void columnselect_graph_keys (bAnimContext *ac, short mode)
/* build list of columns */
switch (mode) {
case GRAPHKEYS_COLUMNSEL_KEYS: /* list of selected keys */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
+ filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
for (ale= anim_data.first; ale; ale= ale->next)
@@ -476,7 +476,7 @@ static void columnselect_graph_keys (bAnimContext *ac, short mode)
/* loop through all of the keys and select additional keyframes
* based on the keys found to be selected above
*/
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
+ filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
for (ale= anim_data.first; ale; ale= ale->next) {
@@ -560,7 +560,7 @@ static int graphkeys_select_linked_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_CANCELLED;
/* loop through all of the keys and select additional keyframes based on these */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
+ filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
for (ale= anim_data.first; ale; ale= ale->next) {
@@ -615,7 +615,7 @@ static void select_moreless_graph_keys (bAnimContext *ac, short mode)
memset(&ked, 0, sizeof(KeyframeEditData));
/* loop through all of the keys and select additional keyframes based on these */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
+ filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
for (ale= anim_data.first; ale; ale= ale->next) {
@@ -755,7 +755,7 @@ static void graphkeys_select_leftright (bAnimContext *ac, short leftright, short
}
/* filter data */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
+ filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* select keys */
@@ -960,14 +960,14 @@ static void get_nearest_fcurve_verts_list (bAnimContext *ac, const int mval[2],
bAnimListElem *ale;
int filter;
- SpaceIpo *sipo= (SpaceIpo *)ac->sa->spacedata.first;
+ SpaceIpo *sipo= (SpaceIpo *)ac->sl;
View2D *v2d= &ac->ar->v2d;
/* get curves to search through
* - if the option to only show keyframes that belong to selected F-Curves is enabled,
* include the 'only selected' flag...
*/
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
+ filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_NODUPLIS);
if (sipo->flag & SIPO_SELCUVERTSONLY) // FIXME: this should really be check for by the filtering code...
filter |= ANIMFILTER_SEL;
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
@@ -1093,7 +1093,7 @@ static tNearestVertInfo *find_nearest_fcurve_vert (bAnimContext *ac, const int m
/* option 1) select keyframe directly under mouse */
static void mouse_graph_keys (bAnimContext *ac, const int mval[2], short select_mode, short curves_only)
{
- SpaceIpo *sipo= (SpaceIpo *)ac->sa->spacedata.first;
+ SpaceIpo *sipo= (SpaceIpo *)ac->sl;
tNearestVertInfo *nvi;
BezTriple *bezt= NULL;
@@ -1202,7 +1202,7 @@ static void mouse_graph_keys (bAnimContext *ac, const int mval[2], short select_
/* set active F-Curve (NOTE: sync the filter flags with findnearest_fcurve_vert) */
/* needs to be called with (sipo->flag & SIPO_SELCUVERTSONLY) otherwise the active flag won't be set [#26452] */
if (nvi->fcu->flag & FCURVE_SELECTED) {
- int filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
+ int filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_NODUPLIS);
ANIM_set_active_channel(ac, ac->data, ac->datatype, filter, nvi->fcu, ANIMTYPE_FCURVE);
}
@@ -1220,7 +1220,7 @@ static void graphkeys_mselect_column (bAnimContext *ac, const int mval[2], short
bAnimListElem *ale;
int filter;
- SpaceIpo *sipo= (SpaceIpo *)ac->sa->spacedata.first;
+ SpaceIpo *sipo= (SpaceIpo *)ac->sl;
KeyframeEditFunc select_cb, ok_cb;
KeyframeEditData ked;
tNearestVertInfo *nvi;
@@ -1266,7 +1266,7 @@ static void graphkeys_mselect_column (bAnimContext *ac, const int mval[2], short
/* loop through all of the keys and select additional keyframes
* based on the keys found to be selected above
*/
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
+ filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
for (ale= anim_data.first; ale; ale= ale->next) {
diff --git a/source/blender/editors/space_graph/graph_utils.c b/source/blender/editors/space_graph/graph_utils.c
index e4509a29a91..3f2993fd793 100644
--- a/source/blender/editors/space_graph/graph_utils.c
+++ b/source/blender/editors/space_graph/graph_utils.c
@@ -65,12 +65,14 @@
/* Find 'active' F-Curve. It must be editable, since that's the purpose of these buttons (subject to change).
* We return the 'wrapper' since it contains valuable context info (about hierarchy), which will need to be freed
* when the caller is done with it.
+ *
+ * NOTE: curve-visible flag isn't included, otherwise selecting a curve via list to edit is too cumbersome
*/
bAnimListElem *get_active_fcurve_channel (bAnimContext *ac)
{
ListBase anim_data = {NULL, NULL};
- int filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_ACTIVE | ANIMFILTER_CURVESONLY);
- int items = ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
+ int filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_ACTIVE);
+ size_t items = ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* We take the first F-Curve only, since some other ones may have had 'active' flag set
* if they were from linked data.
@@ -99,7 +101,8 @@ int graphop_visible_keyframes_poll (bContext *C)
bAnimListElem *ale;
ListBase anim_data = {NULL, NULL};
ScrArea *sa= CTX_wm_area(C);
- int filter, items;
+ size_t items;
+ int filter;
short found = 0;
/* firstly, check if in Graph Editor */
@@ -114,7 +117,7 @@ int graphop_visible_keyframes_poll (bContext *C)
/* loop over the visible (selection doesn't matter) F-Curves, and see if they're suitable
* stopping on the first successful match
*/
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVESONLY);
+ filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE);
items = ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
if (items == 0)
return 0;
@@ -147,7 +150,8 @@ int graphop_editable_keyframes_poll (bContext *C)
bAnimListElem *ale;
ListBase anim_data = {NULL, NULL};
ScrArea *sa= CTX_wm_area(C);
- int filter, items;
+ size_t items;
+ int filter;
short found = 0;
/* firstly, check if in Graph Editor */
@@ -162,7 +166,7 @@ int graphop_editable_keyframes_poll (bContext *C)
/* loop over the editable F-Curves, and see if they're suitable
* stopping on the first successful match
*/
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY);
+ filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVE_VISIBLE);
items = ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
if (items == 0)
return 0;
@@ -213,7 +217,7 @@ int graphop_active_fcurve_poll (bContext *C)
/* free temp data... */
has_fcurve= ((ale->data) && (ale->type == ANIMTYPE_FCURVE));
- if(has_fcurve) {
+ if (has_fcurve) {
FCurve *fcu= (FCurve *)ale->data;
has_fcurve= (fcu->flag & FCURVE_VISIBLE)!=0;
}
@@ -230,7 +234,8 @@ int graphop_selected_fcurve_poll (bContext *C)
bAnimContext ac;
ListBase anim_data = {NULL, NULL};
ScrArea *sa= CTX_wm_area(C);
- int filter, items;
+ size_t items;
+ int filter;
/* firstly, check if in Graph Editor */
// TODO: also check for region?
@@ -241,8 +246,10 @@ int graphop_selected_fcurve_poll (bContext *C)
if (ANIM_animdata_get_context(C, &ac) == 0)
return 0;
- /* get the editable + selected F-Curves, and as long as we got some, we can return */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY);
+ /* get the editable + selected F-Curves, and as long as we got some, we can return
+ * NOTE: curve-visible flag isn't included, otherwise selecting a curve via list to edit is too cumbersome
+ */
+ filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT);
items = ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
if (items == 0)
return 0;
diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c
index 883b476f372..3cc83b12124 100644
--- a/source/blender/editors/space_graph/space_graph.c
+++ b/source/blender/editors/space_graph/space_graph.c
@@ -110,6 +110,10 @@ static SpaceLink *graph_new(const bContext *C)
sipo->ads= MEM_callocN(sizeof(bDopeSheet), "GraphEdit DopeSheet");
sipo->ads->source= (ID *)scene;
+ /* settings for making it easier by default to just see what you're interested in tweaking */
+ sipo->ads->filterflag |= ADS_FILTER_ONLYSEL;
+ sipo->flag |= SIPO_SELVHANDLESONLY;
+
/* header */
ar= MEM_callocN(sizeof(ARegion), "header for graphedit");
@@ -186,7 +190,7 @@ static void graph_init(struct wmWindowManager *UNUSED(wm), ScrArea *sa)
sipo->ads= MEM_callocN(sizeof(bDopeSheet), "GraphEdit DopeSheet");
sipo->ads->source= (ID *)(G.main->scene.first); // FIXME: this is a really nasty hack here for now...
}
-
+
ED_area_tag_refresh(sa);
}
@@ -464,6 +468,13 @@ static void graph_listener(ScrArea *sa, wmNotifier *wmn)
break;
}
break;
+ case NC_NODE:
+ if (wmn->action == NA_SELECTED) {
+ /* selection changed, so force refresh to flush (needs flag set to do syncing) */
+ sipo->flag |= SIPO_TEMP_NEEDCHANSYNC;
+ ED_area_tag_refresh(sa);
+ }
+ break;
case NC_SPACE:
if(wmn->data == ND_SPACE_GRAPH)
ED_area_tag_redraw(sa);
@@ -513,14 +524,15 @@ static void graph_refresh(const bContext *C, ScrArea *sa)
if (ANIM_animdata_get_context(C, &ac)) {
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
+ size_t items;
int filter;
- int items, i;
+ int i;
/* build list of F-Curves which will be visible as channels in channel-region
* - we don't include ANIMFILTER_CURVEVISIBLE filter, as that will result in a
* mismatch between channel-colors and the drawn curves
*/
- filter= (ANIMFILTER_VISIBLE|ANIMFILTER_CURVESONLY|ANIMFILTER_NODUPLIS);
+ filter= (ANIMFILTER_DATA_VISIBLE|ANIMFILTER_NODUPLIS);
items= ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
/* loop over F-Curves, assigning colors */