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-04-08 05:07:46 +0400
committerJoshua Leung <aligorith@gmail.com>2009-04-08 05:07:46 +0400
commitad2c860baf3708243349d10fe96ecf7c1efc7897 (patch)
tree86e5c2e0bc7eb2c4b6f223d3345b88e9b7acad93 /source/blender/editors/space_graph/graph_draw.c
parentc80133e1bc1afdb8f582fa6b2db3d0a3090841b2 (diff)
Graph Editor: 'Ghost Curves' functionality from Apricot
This feature takes a 'snapshot' of the visible+selected F-Curves, and displays these in the background as 'ghosts curves' in the background. Such curves are drawn semi-transparent, slightly darker, and with dotted lines. To use, simply click the 'curve' button beside the Auto-Snapping selector. To clear, simply click that button again (with a different icon now). These 'ghost curves' are stored per Graph Editor instance, and are not saved to file (i.e. per session only). They are useful to be used as guides when refining the shape of existing curves.
Diffstat (limited to 'source/blender/editors/space_graph/graph_draw.c')
-rw-r--r--source/blender/editors/space_graph/graph_draw.c39
1 files changed, 38 insertions, 1 deletions
diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c
index 46d3f102b89..df1d0133e42 100644
--- a/source/blender/editors/space_graph/graph_draw.c
+++ b/source/blender/editors/space_graph/graph_draw.c
@@ -744,7 +744,43 @@ static void draw_ipokey(SpaceIpo *sipo, ARegion *ar)
/* Public Curve-Drawing API ---------------- */
-void graph_draw_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGrid *grid)
+/* Draw the 'ghost' F-Curves (i.e. snapshots of the curve) */
+void graph_draw_ghost_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGrid *grid)
+{
+ FCurve *fcu;
+
+ /* draw with thick dotted lines */
+ setlinestyle(1);
+ glLineWidth(3.0f);
+
+ /* anti-aliased lines for less jagged appearance */
+ glEnable(GL_LINE_SMOOTH);
+ glEnable(GL_BLEND);
+
+ /* the ghost curves are simply sampled F-Curves stored in sipo->ghostCurves */
+ for (fcu= sipo->ghostCurves.first; fcu; fcu= fcu->next) {
+ /* set whatever color the curve has set
+ * - this is set by the function which creates these
+ * - draw with a fixed opacity of 2
+ */
+ glColor4f(fcu->color[0], fcu->color[1], fcu->color[2], 0.5f);
+
+ /* simply draw the stored samples */
+ draw_fcurve_curve_samples(fcu, &ar->v2d);
+ }
+
+ /* restore settings */
+ setlinestyle(0);
+ glLineWidth(1.0f);
+
+ glDisable(GL_LINE_SMOOTH);
+ glDisable(GL_BLEND);
+}
+
+/* This is called twice from space_graph.c -> graph_main_area_draw()
+ * Unselected then selected F-Curves are drawn so that they do not occlude each other.
+ */
+void graph_draw_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGrid *grid, short sel)
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
@@ -752,6 +788,7 @@ void graph_draw_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGri
/* build list of curves to draw */
filter= (ANIMFILTER_VISIBLE|ANIMFILTER_CURVESONLY|ANIMFILTER_CURVEVISIBLE);
+ filter |= (sel) ? (ANIMFILTER_SEL) : (ANIMFILTER_UNSEL);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* for each curve: