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>2012-05-24 17:52:25 +0400
committerJoshua Leung <aligorith@gmail.com>2012-05-24 17:52:25 +0400
commit240babf07423d5efcb85edbe8e8d2571e8e163b8 (patch)
tree79b4a5c932b9eb3e9f3ebf34267f377310bacf82 /source/blender/editors
parent9abd6e76515006214c0bd8d0d412c89baf88a8b1 (diff)
Graph Editor - View All/Selected now includes handles for calculating extents of
F-Curves It is possible to get the old behaviour (handles excluded) by bringing up the Operator Properties (F6) while in the Graph Editor (this doesn't work elsewhere due to the context requirements of this stuff).
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/space_graph/graph_edit.c34
-rw-r--r--source/blender/editors/space_graph/graph_intern.h3
-rw-r--r--source/blender/editors/space_graph/space_graph.c2
3 files changed, 28 insertions, 11 deletions
diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c
index 2d9a7baa213..4b5f4f5cc2e 100644
--- a/source/blender/editors/space_graph/graph_edit.c
+++ b/source/blender/editors/space_graph/graph_edit.c
@@ -83,7 +83,8 @@
/* Get the min/max keyframes*/
/* note: it should return total boundbox, filter for selection only can be argument... */
-void get_graph_keyframe_extents(bAnimContext *ac, float *xmin, float *xmax, float *ymin, float *ymax, const short selOnly)
+void get_graph_keyframe_extents(bAnimContext *ac, float *xmin, float *xmax, float *ymin, float *ymax,
+ const short do_sel_only, const short include_handles)
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
@@ -109,7 +110,7 @@ void get_graph_keyframe_extents(bAnimContext *ac, float *xmin, float *xmax, floa
float unitFac;
/* get range */
- calc_fcurve_bounds(fcu, &txmin, &txmax, &tymin, &tymax, selOnly);
+ calc_fcurve_bounds(fcu, &txmin, &txmax, &tymin, &tymax, do_sel_only, include_handles);
/* apply NLA scaling */
if (adt) {
@@ -169,7 +170,7 @@ static int graphkeys_previewrange_exec(bContext *C, wmOperator *UNUSED(op))
scene = ac.scene;
/* set the range directly */
- get_graph_keyframe_extents(&ac, &min, &max, NULL, NULL, FALSE);
+ get_graph_keyframe_extents(&ac, &min, &max, NULL, NULL, FALSE, FALSE);
scene->r.flag |= SCER_PRV_RANGE;
scene->r.psfra = (int)floor(min + 0.5f);
scene->r.pefra = (int)floor(max + 0.5f);
@@ -198,7 +199,7 @@ void GRAPH_OT_previewrange_set(wmOperatorType *ot)
/* ****************** View-All Operator ****************** */
-static int graphkeys_viewall(bContext *C, const short selOnly)
+static int graphkeys_viewall(bContext *C, const short do_sel_only, const short include_handles)
{
bAnimContext ac;
View2D *v2d;
@@ -210,7 +211,10 @@ static int graphkeys_viewall(bContext *C, const short selOnly)
v2d = &ac.ar->v2d;
/* set the horizontal range, with an extra offset so that the extreme keys will be in view */
- get_graph_keyframe_extents(&ac, &v2d->cur.xmin, &v2d->cur.xmax, &v2d->cur.ymin, &v2d->cur.ymax, selOnly);
+ get_graph_keyframe_extents(&ac,
+ &v2d->cur.xmin, &v2d->cur.xmax,
+ &v2d->cur.ymin, &v2d->cur.ymax,
+ do_sel_only, include_handles);
extra = 0.1f * (v2d->cur.xmax - v2d->cur.xmin);
v2d->cur.xmin -= extra;
@@ -231,16 +235,20 @@ static int graphkeys_viewall(bContext *C, const short selOnly)
/* ......... */
-static int graphkeys_viewall_exec(bContext *C, wmOperator *UNUSED(op))
+static int graphkeys_viewall_exec(bContext *C, wmOperator *op)
{
+ short include_handles = RNA_boolean_get(op->ptr, "include_handles");
+
/* whole range */
- return graphkeys_viewall(C, FALSE);
+ return graphkeys_viewall(C, FALSE, include_handles);
}
-static int graphkeys_view_selected_exec(bContext *C, wmOperator *UNUSED(op))
+static int graphkeys_view_selected_exec(bContext *C, wmOperator *op)
{
+ short include_handles = RNA_boolean_get(op->ptr, "include_handles");
+
/* only selected */
- return graphkeys_viewall(C, TRUE);
+ return graphkeys_viewall(C, TRUE, include_handles);
}
void GRAPH_OT_view_all(wmOperatorType *ot)
@@ -256,6 +264,10 @@ void GRAPH_OT_view_all(wmOperatorType *ot)
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+
+ /* props */
+ ot->prop = RNA_def_boolean(ot->srna, "include_handles", TRUE, "Include Handles",
+ "Include handles of keyframes when calculating extents");
}
void GRAPH_OT_view_selected(wmOperatorType *ot)
@@ -271,6 +283,10 @@ void GRAPH_OT_view_selected(wmOperatorType *ot)
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+
+ /* props */
+ ot->prop = RNA_def_boolean(ot->srna, "include_handles", TRUE, "Include Handles",
+ "Include handles of keyframes when calculating extents");
}
/* ******************** Create Ghost-Curves Operator *********************** */
diff --git a/source/blender/editors/space_graph/graph_intern.h b/source/blender/editors/space_graph/graph_intern.h
index 47b55ae90ab..eb657169970 100644
--- a/source/blender/editors/space_graph/graph_intern.h
+++ b/source/blender/editors/space_graph/graph_intern.h
@@ -86,7 +86,8 @@ enum {
/* ***************************************** */
/* graph_edit.c */
-void get_graph_keyframe_extents(struct bAnimContext *ac, float *xmin, float *xmax, float *ymin, float *ymax, const short do_selected);
+void get_graph_keyframe_extents(struct bAnimContext *ac, float *xmin, float *xmax, float *ymin, float *ymax,
+ const short do_selected, const short include_handles);
void GRAPH_OT_previewrange_set(struct wmOperatorType *ot);
void GRAPH_OT_view_all(struct wmOperatorType *ot);
diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c
index ffff86df4eb..756e6997fc8 100644
--- a/source/blender/editors/space_graph/space_graph.c
+++ b/source/blender/editors/space_graph/space_graph.c
@@ -250,7 +250,7 @@ static void graph_main_area_draw(const bContext *C, ARegion *ar)
graph_draw_curves(&ac, sipo, ar, grid, 1);
/* XXX the slow way to set tot rect... but for nice sliders needed (ton) */
- get_graph_keyframe_extents(&ac, &v2d->tot.xmin, &v2d->tot.xmax, &v2d->tot.ymin, &v2d->tot.ymax, FALSE);
+ get_graph_keyframe_extents(&ac, &v2d->tot.xmin, &v2d->tot.xmax, &v2d->tot.ymin, &v2d->tot.ymax, FALSE, TRUE);
/* extra offset so that these items are visible */
v2d->tot.xmin -= 10.0f;
v2d->tot.xmax += 10.0f;