diff options
Diffstat (limited to 'source/blender/editors/space_graph/graph_draw.c')
-rw-r--r-- | source/blender/editors/space_graph/graph_draw.c | 45 |
1 files changed, 19 insertions, 26 deletions
diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c index 91e11ac4b1e..3ac90200aea 100644 --- a/source/blender/editors/space_graph/graph_draw.c +++ b/source/blender/editors/space_graph/graph_draw.c @@ -85,6 +85,7 @@ static void draw_fcurve_modifier_controls_envelope(FModifier *fcm, View2D *v2d) /* draw two black lines showing the standard reference levels */ glColor3f(0.0f, 0.0f, 0.0f); + glLineWidth(1); setlinestyle(5); glBegin(GL_LINES); @@ -93,7 +94,7 @@ static void draw_fcurve_modifier_controls_envelope(FModifier *fcm, View2D *v2d) glVertex2f(v2d->cur.xmin, env->midval + env->max); glVertex2f(v2d->cur.xmax, env->midval + env->max); - glEnd(); /* GL_LINES */ + glEnd(); setlinestyle(0); /* set size of vertices (non-adjustable for now) */ @@ -102,10 +103,7 @@ static void draw_fcurve_modifier_controls_envelope(FModifier *fcm, View2D *v2d) /* for now, point color is fixed, and is white */ glColor3f(1.0f, 1.0f, 1.0f); - /* we use bgl points not standard gl points, to workaround vertex - * drawing bugs that some drivers have (probably legacy ones only though) - */ - bglBegin(GL_POINTS); + glBegin(GL_POINTS); for (i = 0, fed = env->data; i < env->totvert; i++, fed++) { /* only draw if visible * - min/max here are fixed, not relative @@ -115,9 +113,7 @@ static void draw_fcurve_modifier_controls_envelope(FModifier *fcm, View2D *v2d) glVertex2f(fed->time, fed->max); } } - bglEnd(); /* GL_POINTS */ - - glPointSize(1.0f); + glEnd(); } /* *************************** */ @@ -132,10 +128,7 @@ static void draw_fcurve_vertices_keyframes(FCurve *fcu, SpaceIpo *UNUSED(sipo), const float fac = 0.05f * BLI_rctf_size_x(&v2d->cur); int i; - /* we use bgl points not standard gl points, to workaround vertex - * drawing bugs that some drivers have (probably legacy ones only though) - */ - bglBegin(GL_POINTS); + glBegin(GL_POINTS); for (i = 0; i < fcu->totvert; i++, bezt++) { /* as an optimization step, only draw those in view @@ -148,17 +141,17 @@ static void draw_fcurve_vertices_keyframes(FCurve *fcu, SpaceIpo *UNUSED(sipo), * - */ if ((bezt->f2 & SELECT) == sel) - bglVertex3fv(bezt->vec[1]); + glVertex3fv(bezt->vec[1]); } else { /* no check for selection here, as curve is not editable... */ /* XXX perhaps we don't want to even draw points? maybe add an option for that later */ - bglVertex3fv(bezt->vec[1]); + glVertex3fv(bezt->vec[1]); } } } - bglEnd(); /* GL_POINTS */ + glEnd(); } @@ -294,8 +287,6 @@ static void draw_fcurve_vertices(SpaceIpo *sipo, ARegion *ar, FCurve *fcu, short set_fcurve_vertex_color(fcu, 1); draw_fcurve_vertices_keyframes(fcu, sipo, v2d, !(fcu->flag & FCURVE_PROTECTED), 1); - - glPointSize(1.0f); } /* Handles ---------------- */ @@ -862,7 +853,6 @@ static void graph_draw_driver_debug(bAnimContext *ac, ID *id, FCurve *fcu) /* cleanup line drawing */ setlinestyle(0); - glLineWidth(1.0f); } /* draw driver only if actually functional */ @@ -921,8 +911,6 @@ static void graph_draw_driver_debug(bAnimContext *ac, ID *id, FCurve *fcu) glBegin(GL_POINTS); glVertex2f(x, y); glEnd(); - - glPointSize(1.0f); } } } @@ -958,13 +946,12 @@ void graph_draw_ghost_curves(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar) /* restore settings */ setlinestyle(0); - glLineWidth(1.0f); if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) glDisable(GL_LINE_SMOOTH); glDisable(GL_BLEND); } -/* This is called twice from space_graph.c -> graph_main_area_draw() +/* This is called twice from space_graph.c -> graph_main_region_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) @@ -1021,6 +1008,9 @@ void graph_draw_curves(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGrid if (fcu->flag & FCURVE_ACTIVE) { glLineWidth(2.0); } + else { + glLineWidth(1.0); + } /* anti-aliased lines for less jagged appearance */ if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) glEnable(GL_LINE_SMOOTH); @@ -1048,7 +1038,6 @@ void graph_draw_curves(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGrid /* restore settings */ setlinestyle(0); - glLineWidth(1.0); if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) glDisable(GL_LINE_SMOOTH); glDisable(GL_BLEND); @@ -1072,11 +1061,15 @@ void graph_draw_curves(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGrid short mapping_flag = ANIM_get_normalization_flags(ac); float offset; float unit_scale = ANIM_unit_mapping_get_factor(ac->scene, ale->id, fcu, mapping_flag, &offset); - + + /* apply unit-scaling to all values via OpenGL */ glPushMatrix(); glScalef(1.0f, unit_scale, 1.0f); glTranslatef(0.0f, offset, 0.0f); - + + /* set this once and for all - all handles and handle-verts should use the same thickness */ + glLineWidth(1.0); + if (fcu->bezt) { bool do_handles = draw_fcurve_handles_check(sipo, fcu); @@ -1093,7 +1086,7 @@ void graph_draw_curves(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGrid /* samples: only draw two indicators at either end as indicators */ draw_fcurve_samples(sipo, ar, fcu); } - + glPopMatrix(); } } |