~siretart/ubuntu/utopic/blender/libav10

« back to all changes in this revision

Viewing changes to source/blender/editors/space_graph/graph_draw.c

  • Committer: Package Import Robot
  • Author(s): Matteo F. Vescovi
  • Date: 2012-07-23 08:54:18 UTC
  • mfrom: (14.2.16 sid)
  • mto: (14.2.19 sid)
  • mto: This revision was merged to the branch mainline in revision 42.
  • Revision ID: package-import@ubuntu.com-20120723085418-9foz30v6afaf5ffs
Tags: 2.63a-2
* debian/: Cycles support added (Closes: #658075)
  For now, this top feature has been enabled only
  on [any-amd64 any-i386] architectures because
  of OpenImageIO failing on all others
* debian/: scripts installation path changed
  from /usr/lib to /usr/share:
  + debian/patches/: patchset re-worked for path changing
  + debian/control: "Breaks" field added on yafaray-exporter

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/**
2
 
 * $Id: graph_draw.c 28731 2010-05-11 21:46:20Z campbellbarton $
3
 
 *
 
1
/*
4
2
 * ***** BEGIN GPL LICENSE BLOCK *****
5
3
 *
6
4
 * This program is free software; you can redistribute it and/or
24
22
 * ***** END GPL LICENSE BLOCK *****
25
23
 */
26
24
 
 
25
/** \file blender/editors/space_graph/graph_draw.c
 
26
 *  \ingroup spgraph
 
27
 */
 
28
 
 
29
 
27
30
#include <stdio.h>
28
31
#include <math.h>
29
32
#include <string.h>
35
38
#include <io.h>
36
39
#endif
37
40
 
38
 
#include "MEM_guardedalloc.h"
39
41
 
40
42
#include "BLI_blenlib.h"
41
43
#include "BLI_math.h"
 
44
#include "BLI_utildefines.h"
42
45
 
43
46
#include "DNA_anim_types.h"
44
47
#include "DNA_object_types.h"
45
48
#include "DNA_screen_types.h"
46
49
#include "DNA_space_types.h"
47
50
#include "DNA_windowmanager_types.h"
 
51
#include "DNA_userdef_types.h"
48
52
 
49
 
#include "BKE_animsys.h"
50
53
#include "BKE_context.h"
51
54
#include "BKE_curve.h"
52
 
#include "BKE_depsgraph.h"
53
55
#include "BKE_fcurve.h"
54
 
#include "BKE_global.h"
55
 
#include "BKE_key.h"
56
 
#include "BKE_object.h"
57
 
#include "BKE_screen.h"
58
 
#include "BKE_utildefines.h"
 
56
 
59
57
 
60
58
#include "BIF_gl.h"
61
59
#include "BIF_glutil.h"
75
73
 * drawing components for some F-Curve (fcu)
76
74
 *      - selected F-Curves should be more visible than partially visible ones
77
75
 */
78
 
#define drawFCurveFade(fcu) ( ((fcu)->flag & FCURVE_SELECTED)? 1.0f : 0.25f )
79
 
 
80
 
/* set the colour for some point from some value given packed into an int 
81
 
 *      - intV: integer value containing color info packed into an int
82
 
 *      - alpha: float value describing the 
83
 
 */
84
 
#define cpackA(intVC, alpha) \
85
 
        { \
86
 
                float _cpackCol[3]; \
87
 
                cpack_to_rgb(intVC, &_cpackCol[0], &_cpackCol[1], &_cpackCol[2]); \
88
 
                glColor4f(_cpackCol[0], _cpackCol[1], _cpackCol[2], alpha); \
89
 
        }
 
76
static float fcurve_display_alpha(FCurve *fcu)
 
77
{
 
78
        return (fcu->flag & FCURVE_SELECTED) ? 1.0f : U.fcu_inactive_alpha;
 
79
}
90
80
 
91
81
/* *************************** */
92
82
/* F-Curve Modifier Drawing */
94
84
/* Envelope -------------- */
95
85
 
96
86
// TODO: draw a shaded poly showing the region of influence too!!!
97
 
static void draw_fcurve_modifier_controls_envelope (FCurve *fcu, FModifier *fcm, View2D *v2d)
 
87
static void draw_fcurve_modifier_controls_envelope (FModifier *fcm, View2D *v2d)
98
88
{
99
89
        FMod_Envelope *env= (FMod_Envelope *)fcm->data;
100
90
        FCM_EnvelopeData *fed;
128
118
                /* only draw if visible
129
119
                 *      - min/max here are fixed, not relative
130
120
                 */
131
 
                if IN_RANGE(fed->time, (v2d->cur.xmin - fac), (v2d->cur.xmax + fac)) {
 
121
                if (IN_RANGE(fed->time, (v2d->cur.xmin - fac), (v2d->cur.xmax + fac))) {
132
122
                        glVertex2f(fed->time, fed->min);
133
123
                        glVertex2f(fed->time, fed->max);
134
124
                }
144
134
/* Points ---------------- */
145
135
 
146
136
/* helper func - draw keyframe vertices only for an F-Curve */
147
 
static void draw_fcurve_vertices_keyframes (bAnimContext *ac, FCurve *fcu, View2D *v2d, short edit, short sel)
 
137
static void draw_fcurve_vertices_keyframes (FCurve *fcu, SpaceIpo *UNUSED(sipo), View2D *v2d, short edit, short sel)
148
138
{
149
139
        BezTriple *bezt= fcu->bezt;
150
140
        const float fac= 0.05f * (v2d->cur.xmax - v2d->cur.xmin);
156
146
        bglBegin(GL_POINTS);
157
147
        
158
148
        for (i = 0; i < fcu->totvert; i++, bezt++) {
159
 
                /* as an optimisation step, only draw those in view 
 
149
                /* as an optimization step, only draw those in view 
160
150
                 *      - we apply a correction factor to ensure that points don't pop in/out due to slight twitches of view size
161
151
                 */
162
 
                if IN_RANGE(bezt->vec[1][0], (v2d->cur.xmin - fac), (v2d->cur.xmax + fac)) {
 
152
                if (IN_RANGE(bezt->vec[1][0], (v2d->cur.xmin - fac), (v2d->cur.xmax + fac))) {
163
153
                        if (edit) {
164
154
                                /* 'Keyframe' vertex only, as handle lines and handles have already been drawn
165
155
                                 *      - only draw those with correct selection state for the current drawing color
188
178
{
189
179
        static GLuint displist=0;
190
180
        
191
 
        /* initialise round circle shape */
 
181
        /* initialize round circle shape */
192
182
        if (displist == 0) {
193
183
                GLUquadricObj *qobj;
194
184
                
216
206
}
217
207
 
218
208
/* helper func - draw handle vertices only for an F-Curve (if it is not protected) */
219
 
static void draw_fcurve_vertices_handles (bAnimContext *ac, SpaceIpo *sipo, FCurve *fcu, View2D *v2d, short sel)
 
209
static void draw_fcurve_vertices_handles (FCurve *fcu, SpaceIpo *sipo, View2D *v2d, short sel, short sel_handle_only)
220
210
{
221
211
        BezTriple *bezt= fcu->bezt;
222
212
        BezTriple *prevbezt = NULL;
232
222
        else UI_ThemeColor(TH_HANDLE_VERTEX);
233
223
        
234
224
        /* anti-aliased lines for more consistent appearance */
235
 
        glEnable(GL_LINE_SMOOTH);
 
225
        if ((sipo->flag & SIPO_BEAUTYDRAW_OFF)==0) glEnable(GL_LINE_SMOOTH);
236
226
        glEnable(GL_BLEND);
237
227
        
238
228
        for (i=0; i < fcu->totvert; i++, prevbezt=bezt, bezt++) {
244
234
                 * Also, need to take into account whether the keyframe was selected
245
235
                 * if a Graph Editor option to only show handles of selected keys is on.
246
236
                 */
247
 
                if ( !(sipo->flag & SIPO_SELVHANDLESONLY) || BEZSELECTED(bezt) ) {
 
237
                if ( !sel_handle_only || BEZSELECTED(bezt) ) {
248
238
                        if ( (!prevbezt && (bezt->ipo==BEZT_IPO_BEZ)) || (prevbezt && (prevbezt->ipo==BEZT_IPO_BEZ)) ) {
249
239
                                if ((bezt->f1 & SELECT) == sel)/* && v2d->cur.xmin < bezt->vec[0][0] < v2d->cur.xmax)*/
250
240
                                        draw_fcurve_handle_control(bezt->vec[0][0], bezt->vec[0][1], xscale, yscale, hsize);
257
247
                }
258
248
        }
259
249
        
260
 
        glDisable(GL_LINE_SMOOTH);
 
250
        if ((sipo->flag & SIPO_BEAUTYDRAW_OFF)==0) glDisable(GL_LINE_SMOOTH);
261
251
        glDisable(GL_BLEND);
262
252
}
263
253
 
264
254
/* helper func - set color to draw F-Curve data with */
265
 
static void set_fcurve_vertex_color (SpaceIpo *sipo, FCurve *fcu, short sel)
 
255
static void set_fcurve_vertex_color (FCurve *fcu, short sel)
266
256
{
267
257
        /* Fade the 'intensity' of the vertices based on the selection of the curves too */
268
 
        int alphaOffset= (int)((drawFCurveFade(fcu) - 1.0f) * 255);
 
258
        int alphaOffset= (int)((fcurve_display_alpha(fcu) - 1.0f) * 255);
269
259
        
270
260
        /* Set color of curve vertex based on state of curve (i.e. 'Edit' Mode) */
271
261
        if ((fcu->flag & FCURVE_PROTECTED)==0) {
281
271
}
282
272
 
283
273
 
284
 
static void draw_fcurve_vertices (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, FCurve *fcu, int do_handles)
 
274
static void draw_fcurve_vertices (SpaceIpo *sipo, ARegion *ar, FCurve *fcu, short do_handles, short sel_handle_only)
285
275
{
286
276
        View2D *v2d= &ar->v2d;
287
277
        
295
285
        glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE));
296
286
        
297
287
        /* draw the two handles first (if they're shown, the curve doesn't have just a single keyframe, and the curve is being edited) */
298
 
        if (do_handles)
299
 
        {
300
 
                set_fcurve_vertex_color(sipo, fcu, 0);
301
 
                draw_fcurve_vertices_handles(ac, sipo, fcu, v2d, 0);
 
288
        if (do_handles) {
 
289
                set_fcurve_vertex_color(fcu, 0);
 
290
                draw_fcurve_vertices_handles(fcu, sipo, v2d, 0, sel_handle_only);
302
291
                
303
 
                set_fcurve_vertex_color(sipo, fcu, 1);
304
 
                draw_fcurve_vertices_handles(ac, sipo, fcu, v2d, 1);
 
292
                set_fcurve_vertex_color(fcu, 1);
 
293
                draw_fcurve_vertices_handles(fcu, sipo, v2d, 1, sel_handle_only);
305
294
        }
306
295
                
307
296
        /* draw keyframes over the handles */
308
 
        set_fcurve_vertex_color(sipo, fcu, 0);
309
 
        draw_fcurve_vertices_keyframes(ac, fcu, v2d, !(fcu->flag & FCURVE_PROTECTED), 0);
 
297
        set_fcurve_vertex_color(fcu, 0);
 
298
        draw_fcurve_vertices_keyframes(fcu, sipo, v2d, !(fcu->flag & FCURVE_PROTECTED), 0);
310
299
        
311
 
        set_fcurve_vertex_color(sipo, fcu, 1);
312
 
        draw_fcurve_vertices_keyframes(ac, fcu, v2d, !(fcu->flag & FCURVE_PROTECTED), 1);
 
300
        set_fcurve_vertex_color(fcu, 1);
 
301
        draw_fcurve_vertices_keyframes(fcu, sipo, v2d, !(fcu->flag & FCURVE_PROTECTED), 1);
313
302
        
314
303
        glPointSize(1.0f);
315
304
}
321
310
        /* don't draw handle lines if handles are not to be shown */
322
311
        if (    (sipo->flag & SIPO_NOHANDLES) || /* handles shouldn't be shown anywhere */
323
312
                        (fcu->flag & FCURVE_PROTECTED) || /* keyframes aren't editable */
 
313
#if 0           /* handles can still be selected and handle types set, better draw - campbell */
324
314
                        (fcu->flag & FCURVE_INT_VALUES) || /* editing the handles here will cause weird/incorrect interpolation issues */
 
315
#endif
325
316
                        ((fcu->grp) && (fcu->grp->flag & AGRP_PROTECTED)) || /* group that curve belongs to is not editable */
326
317
                        (fcu->totvert <= 1) /* do not show handles if there is only 1 keyframe, otherwise they all clump together in an ugly ball */
327
318
                ) 
328
319
        {
329
320
                return 0;
330
321
        } 
331
 
        else 
332
 
        {
 
322
        else {
333
323
                return 1;
334
324
        }
335
325
}
336
326
 
337
327
/* draw lines for F-Curve handles only (this is only done in EditMode)
338
328
 * note: draw_fcurve_handles_check must be checked before running this. */
339
 
static void draw_fcurve_handles (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, FCurve *fcu)
 
329
static void draw_fcurve_handles (SpaceIpo *sipo, FCurve *fcu)
340
330
{
341
331
        int sel, b;
342
332
        
343
333
        /* a single call to GL_LINES here around these calls should be sufficient to still
344
 
         * get separate line segments, but which aren't wrapped with GL_LINE_STRIP everytime we
 
334
         * get separate line segments, but which aren't wrapped with GL_LINE_STRIP every time we
345
335
         * want a single line
346
336
         */
347
337
        glBegin(GL_LINES);
353
343
                BezTriple *bezt=fcu->bezt, *prevbezt=NULL;
354
344
                int basecol= (sel)? TH_HANDLE_SEL_FREE : TH_HANDLE_FREE;
355
345
                float *fp;
356
 
                char col[4];
357
 
                
358
 
                /* if only selected keyframes have handles shown, skip the first round */
359
 
                if ((sel == 0) && (sipo->flag & SIPO_SELVHANDLESONLY))
360
 
                        continue;
 
346
                unsigned char col[4];
361
347
                
362
348
                for (b= 0; b < fcu->totvert; b++, prevbezt=bezt, bezt++) {
363
349
                        /* if only selected keyframes can get their handles shown, 
371
357
                        /* draw handle with appropriate set of colors if selection is ok */
372
358
                        if ((bezt->f2 & SELECT)==sel) {
373
359
                                fp= bezt->vec[0];
374
 
 
 
360
                                
375
361
                                /* only draw first handle if previous segment had handles */
376
 
                                if ( (!prevbezt && (bezt->ipo==BEZT_IPO_BEZ)) || (prevbezt && (prevbezt->ipo==BEZT_IPO_BEZ)) ) 
377
 
                                {
 
362
                                if ((!prevbezt && (bezt->ipo==BEZT_IPO_BEZ)) || (prevbezt && (prevbezt->ipo==BEZT_IPO_BEZ))) {
378
363
                                        UI_GetThemeColor3ubv(basecol + bezt->h1, col);
379
 
                                        col[3]= drawFCurveFade(fcu) * 255;
 
364
                                        col[3]= fcurve_display_alpha(fcu) * 255;
380
365
                                        glColor4ubv((GLubyte *)col);
381
366
                                        
382
367
                                        glVertex2fv(fp); glVertex2fv(fp+3); 
383
368
                                }
384
 
 
 
369
                                
385
370
                                /* only draw second handle if this segment is bezier */
386
 
                                if (bezt->ipo == BEZT_IPO_BEZ) 
387
 
                                {
 
371
                                if (bezt->ipo == BEZT_IPO_BEZ) {
388
372
                                        UI_GetThemeColor3ubv(basecol + bezt->h2, col);
389
 
                                        col[3]= drawFCurveFade(fcu) * 255;
 
373
                                        col[3]= fcurve_display_alpha(fcu) * 255;
390
374
                                        glColor4ubv((GLubyte *)col);
391
 
 
 
375
                                        
392
376
                                        glVertex2fv(fp+3); glVertex2fv(fp+6); 
393
377
                                }
394
378
                        }
399
383
                                {
400
384
                                        fp= bezt->vec[0];
401
385
                                        UI_GetThemeColor3ubv(basecol + bezt->h1, col);
402
 
                                        col[3]= drawFCurveFade(fcu) * 255;
 
386
                                        col[3]= fcurve_display_alpha(fcu) * 255;
403
387
                                        glColor4ubv((GLubyte *)col);
404
 
 
 
388
                                        
405
389
                                        glVertex2fv(fp); glVertex2fv(fp+3); 
406
390
                                }
407
391
                                
411
395
                                {
412
396
                                        fp= bezt->vec[1];
413
397
                                        UI_GetThemeColor3ubv(basecol + bezt->h2, col);
414
 
                                        col[3]= drawFCurveFade(fcu) * 255;
 
398
                                        col[3]= fcurve_display_alpha(fcu) * 255;
415
399
                                        glColor4ubv((GLubyte *)col);
416
 
 
 
400
                                        
417
401
                                        glVertex2fv(fp); glVertex2fv(fp+3); 
418
402
                                }
419
403
                        }
433
417
{
434
418
        static GLuint displist=0;
435
419
        
436
 
        /* initialise X shape */
 
420
        /* initialize X shape */
437
421
        if (displist == 0) {
438
422
                displist= glGenLists(1);
439
423
                glNewList(displist, GL_COMPILE);
462
446
}
463
447
 
464
448
/* helper func - draw keyframe vertices only for an F-Curve */
465
 
static void draw_fcurve_samples (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, FCurve *fcu)
 
449
static void draw_fcurve_samples (SpaceIpo *sipo, ARegion *ar, FCurve *fcu)
466
450
{
467
451
        FPoint *first, *last;
468
452
        float hsize, xscale, yscale;
482
466
        /* draw */
483
467
        if (first && last) {
484
468
                /* anti-aliased lines for more consistent appearance */
485
 
                glEnable(GL_LINE_SMOOTH);
 
469
                if ((sipo->flag & SIPO_BEAUTYDRAW_OFF)==0) glEnable(GL_LINE_SMOOTH);
486
470
                glEnable(GL_BLEND);
487
471
                
488
472
                draw_fcurve_sample_control(first->vec[0], first->vec[1], xscale, yscale, hsize);
489
473
                draw_fcurve_sample_control(last->vec[0], last->vec[1], xscale, yscale, hsize);
490
474
                
491
475
                glDisable(GL_BLEND);
492
 
                glDisable(GL_LINE_SMOOTH);
 
476
                if ((sipo->flag & SIPO_BEAUTYDRAW_OFF)==0) glDisable(GL_LINE_SMOOTH);
493
477
        }
494
478
}
495
479
 
496
480
/* Curve ---------------- */
497
481
 
498
482
/* helper func - just draw the F-Curve by sampling the visible region (for drawing curves with modifiers) */
499
 
static void draw_fcurve_curve (bAnimContext *ac, ID *id, FCurve *fcu, SpaceIpo *sipo, View2D *v2d, View2DGrid *grid)
 
483
static void draw_fcurve_curve (bAnimContext *ac, ID *id, FCurve *fcu, View2D *v2d, View2DGrid *grid)
500
484
{
501
485
        ChannelDriver *driver;
502
486
        float samplefreq, ctime;
507
491
        /* when opening a blend file on a different sized screen or while dragging the toolbar this can happen
508
492
         * best just bail out in this case */
509
493
        UI_view2d_grid_size(grid, &dx, &dy);
510
 
        if(dx <= 0.0f)
 
494
        if (dx <= 0.0f)
511
495
                return;
512
496
 
513
497
 
634
618
}
635
619
 
636
620
/* helper func - draw one repeat of an F-Curve */
637
 
static void draw_fcurve_curve_bezts (bAnimContext *ac, ID *id, FCurve *fcu, View2D *v2d, View2DGrid *grid)
 
621
static void draw_fcurve_curve_bezts (bAnimContext *ac, ID *id, FCurve *fcu, View2D *v2d)
638
622
{
639
623
        BezTriple *prevbezt= fcu->bezt;
640
624
        BezTriple *bezt= prevbezt+1;
683
667
        }
684
668
        
685
669
        /* draw curve between first and last keyframe (if there are enough to do so) */
 
670
        // TODO: optimize this to not have to calc stuff out of view too?
686
671
        while (b--) {
687
672
                if (prevbezt->ipo==BEZT_IPO_CONST) {
688
673
                        /* Constant-Interpolation: draw segment between previous keyframe and next, but holding same value */
705
690
                         *      - resol determines number of points to sample in between keyframes
706
691
                         */
707
692
                        
708
 
                        /* resol not depending on horizontal resolution anymore, drivers for example... */
709
 
                        // TODO: would be nice to make this depend on the scale of the graph too...
 
693
                        /* resol depends on distance between points (not just horizontal) OR is a fixed high res */
 
694
                        // TODO: view scale should factor into this someday too...
710
695
                        if (fcu->driver) 
711
696
                                resol= 32;
712
697
                        else 
713
 
                                resol= (int)(3.0*sqrt(bezt->vec[1][0] - prevbezt->vec[1][0]));
 
698
                                resol= (int)(5.0f*len_v2v2(bezt->vec[1], prevbezt->vec[1]));
714
699
                        
715
700
                        if (resol < 2) {
716
701
                                /* only draw one */
720
705
                        }
721
706
                        else {
722
707
                                /* clamp resolution to max of 32 */
 
708
                                // NOTE: higher values will crash
723
709
                                if (resol > 32) resol= 32;
724
710
                                
725
711
                                v1[0]= prevbezt->vec[1][0];
791
777
/* Draw the 'ghost' F-Curves (i.e. snapshots of the curve) 
792
778
 * NOTE: unit mapping has already been applied to the values, so do not try and apply again
793
779
 */
794
 
void graph_draw_ghost_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGrid *grid)
 
780
void graph_draw_ghost_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar)
795
781
{
796
782
        FCurve *fcu;
797
783
        
800
786
        glLineWidth(3.0f);
801
787
        
802
788
        /* anti-aliased lines for less jagged appearance */
803
 
        glEnable(GL_LINE_SMOOTH);
 
789
        if ((sipo->flag & SIPO_BEAUTYDRAW_OFF)==0) glEnable(GL_LINE_SMOOTH);
804
790
        glEnable(GL_BLEND);
805
791
        
806
792
        /* the ghost curves are simply sampled F-Curves stored in sipo->ghostCurves */
819
805
        setlinestyle(0);
820
806
        glLineWidth(1.0f);
821
807
        
822
 
        glDisable(GL_LINE_SMOOTH);
 
808
        if ((sipo->flag & SIPO_BEAUTYDRAW_OFF)==0) glDisable(GL_LINE_SMOOTH);
823
809
        glDisable(GL_BLEND);
824
810
}
825
811
 
833
819
        int filter;
834
820
        
835
821
        /* build list of curves to draw */
836
 
        filter= (ANIMFILTER_VISIBLE|ANIMFILTER_CURVESONLY|ANIMFILTER_CURVEVISIBLE);
 
822
        filter= (ANIMFILTER_DATA_VISIBLE|ANIMFILTER_CURVE_VISIBLE);
837
823
        filter |= ((sel) ? (ANIMFILTER_SEL) : (ANIMFILTER_UNSEL));
838
824
        ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
839
825
                
853
839
                /* draw curve:
854
840
                 *      - curve line may be result of one or more destructive modifiers or just the raw data,
855
841
                 *        so we need to check which method should be used
856
 
                 *      - controls from active modifier take precidence over keyframes
 
842
                 *      - controls from active modifier take precedence over keyframes
857
843
                 *        (XXX! editing tools need to take this into account!)
858
844
                 */
859
845
                 
873
859
                                /* set whatever color the curve has set 
874
860
                                 *      - unselected curves draw less opaque to help distinguish the selected ones
875
861
                                 */
876
 
                                glColor4f(fcu->color[0], fcu->color[1], fcu->color[2], drawFCurveFade(fcu));
 
862
                                glColor4f(fcu->color[0], fcu->color[1], fcu->color[2], fcurve_display_alpha(fcu));
 
863
                        }
 
864
                        
 
865
                        /* draw active F-Curve thicker than the rest to make it stand out */
 
866
                        if (fcu->flag & FCURVE_ACTIVE) {
 
867
                                glLineWidth(2.0);
877
868
                        }
878
869
                        
879
870
                        /* anti-aliased lines for less jagged appearance */
880
 
                        glEnable(GL_LINE_SMOOTH);
 
871
                        if ((sipo->flag & SIPO_BEAUTYDRAW_OFF)==0) glEnable(GL_LINE_SMOOTH);
881
872
                        glEnable(GL_BLEND);
882
873
                        
883
874
                        /* draw F-Curve */
885
876
                                /* draw a curve affected by modifiers or only allowed to have integer values 
886
877
                                 * by sampling it at various small-intervals over the visible region 
887
878
                                 */
888
 
                                draw_fcurve_curve(ac, ale->id, fcu, sipo, &ar->v2d, grid);
 
879
                                draw_fcurve_curve(ac, ale->id, fcu, &ar->v2d, grid);
889
880
                        }
890
881
                        else if ( ((fcu->bezt) || (fcu->fpt)) && (fcu->totvert) ) { 
891
882
                                /* just draw curve based on defined data (i.e. no modifiers) */
892
883
                                if (fcu->bezt)
893
 
                                        draw_fcurve_curve_bezts(ac, ale->id, fcu, &ar->v2d, grid);
 
884
                                        draw_fcurve_curve_bezts(ac, ale->id, fcu, &ar->v2d);
894
885
                                else if (fcu->fpt)
895
886
                                        draw_fcurve_curve_samples(ac, ale->id, fcu, &ar->v2d);
896
887
                        }
897
888
                        
898
889
                        /* restore settings */
899
890
                        setlinestyle(0);
 
891
                        glLineWidth(1.0);
900
892
                        
901
 
                        glDisable(GL_LINE_SMOOTH);
 
893
                        if ((sipo->flag & SIPO_BEAUTYDRAW_OFF)==0) glDisable(GL_LINE_SMOOTH);
902
894
                        glDisable(GL_BLEND);
903
895
                }
904
896
                
906
898
                 *      - if the option to only show controls if the F-Curve is selected is enabled, we must obey this
907
899
                 */
908
900
                if (!(sipo->flag & SIPO_SELCUVERTSONLY) || (fcu->flag & FCURVE_SELECTED)) {
909
 
                        if (fcurve_needs_draw_fmodifier_controls(fcu, fcm)) {
 
901
                        if (fcurve_are_keyframes_usable(fcu) == 0) {
910
902
                                /* only draw controls if this is the active modifier */
911
903
                                if ((fcu->flag & FCURVE_ACTIVE) && (fcm)) {
912
904
                                        switch (fcm->type) {
913
905
                                                case FMODIFIER_TYPE_ENVELOPE: /* envelope */
914
 
                                                        draw_fcurve_modifier_controls_envelope(fcu, fcm, &ar->v2d);
 
906
                                                        draw_fcurve_modifier_controls_envelope(fcm, &ar->v2d);
915
907
                                                        break;
916
908
                                        }
917
909
                                }
926
918
                                        if (do_handles) {
927
919
                                                /* only draw handles/vertices on keyframes */
928
920
                                                glEnable(GL_BLEND);
929
 
                                                draw_fcurve_handles(ac, sipo, ar, fcu);
 
921
                                                draw_fcurve_handles(sipo, fcu);
930
922
                                                glDisable(GL_BLEND);
931
923
                                        }
932
924
                                        
933
 
                                        draw_fcurve_vertices(ac, sipo, ar, fcu, do_handles);
 
925
                                        draw_fcurve_vertices(sipo, ar, fcu, do_handles, (sipo->flag & SIPO_SELVHANDLESONLY));
934
926
                                }
935
927
                                else {
936
928
                                        /* samples: only draw two indicators at either end as indicators */
937
 
                                        draw_fcurve_samples(ac, sipo, ar, fcu);
 
929
                                        draw_fcurve_samples(sipo, ar, fcu);
938
930
                                }
939
931
                                
940
932
                                /* unapply unit mapping */
955
947
/* Channel List */
956
948
 
957
949
/* left hand part */
958
 
void graph_draw_channel_names(bContext *C, bAnimContext *ac, SpaceIpo *sipo, ARegion *ar) 
 
950
void graph_draw_channel_names(bContext *C, bAnimContext *ac, ARegion *ar) 
959
951
{
960
952
        ListBase anim_data = {NULL, NULL};
961
953
        bAnimListElem *ale;
963
955
        
964
956
        View2D *v2d= &ar->v2d;
965
957
        float y= 0.0f, height;
966
 
        int items, i=0;
 
958
        size_t items;
 
959
        int i=0;
967
960
        
968
961
        /* build list of channels to draw */
969
 
        filter= (ANIMFILTER_VISIBLE|ANIMFILTER_CHANNELS);
 
962
        filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_LIST_CHANNELS);
970
963
        items= ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
971
964
        
972
965
        /* Update max-extent of channels here (taking into account scrollers):
999
992
                }
1000
993
        }
1001
994
        {       /* second pass: widgets */
1002
 
                uiBlock *block= uiBeginBlock(C, ar, "graph channel buttons", UI_EMBOSS);
 
995
                uiBlock *block= uiBeginBlock(C, ar, __func__, UI_EMBOSS);
 
996
                size_t channel_index = 0;
1003
997
                
1004
998
                y= (float)ACHANNEL_FIRST;
1005
999
                
1016
1010
                                 IN_RANGE(ymaxc, v2d->cur.ymin, v2d->cur.ymax) ) 
1017
1011
                        {
1018
1012
                                /* draw all channels using standard channel-drawing API */
1019
 
                                ANIM_channel_draw_widgets(ac, ale, block, yminc, ymaxc);
 
1013
                                ANIM_channel_draw_widgets(C, ac, ale, block, yminc, ymaxc, channel_index);
1020
1014
                        }
1021
1015
                        
1022
1016
                        /* adjust y-position for next one */
1023
1017
                        y -= ACHANNEL_STEP;
 
1018
                        channel_index++;
1024
1019
                }
1025
1020
                
1026
1021
                uiEndBlock(C, block);