[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [34731] trunk/blender: Graph Editor: Added option to turn off AA drawing for performance
Joshua Leung
aligorith at gmail.com
Wed Feb 9 03:09:31 CET 2011
Revision: 34731
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=34731
Author: aligorith
Date: 2011-02-09 02:09:25 +0000 (Wed, 09 Feb 2011)
Log Message:
-----------
Graph Editor: Added option to turn off AA drawing for performance
gains when using really heavy files
Modified Paths:
--------------
trunk/blender/release/scripts/ui/space_graph.py
trunk/blender/source/blender/editors/space_graph/graph_draw.c
trunk/blender/source/blender/makesdna/DNA_space_types.h
trunk/blender/source/blender/makesrna/intern/rna_space.c
Modified: trunk/blender/release/scripts/ui/space_graph.py
===================================================================
--- trunk/blender/release/scripts/ui/space_graph.py 2011-02-09 01:27:46 UTC (rev 34730)
+++ trunk/blender/release/scripts/ui/space_graph.py 2011-02-09 02:09:25 UTC (rev 34731)
@@ -81,6 +81,9 @@
layout.prop(st, "use_auto_merge_keyframes")
layout.separator()
+ layout.prop(st, "use_fancy_drawing")
+
+ layout.separator()
if st.show_handles:
layout.operator("graph.handles_view_toggle", icon='CHECKBOX_HLT', text="Show All Handles")
else:
Modified: trunk/blender/source/blender/editors/space_graph/graph_draw.c
===================================================================
--- trunk/blender/source/blender/editors/space_graph/graph_draw.c 2011-02-09 01:27:46 UTC (rev 34730)
+++ trunk/blender/source/blender/editors/space_graph/graph_draw.c 2011-02-09 02:09:25 UTC (rev 34731)
@@ -138,7 +138,7 @@
/* Points ---------------- */
/* helper func - draw keyframe vertices only for an F-Curve */
-static void draw_fcurve_vertices_keyframes (FCurve *fcu, View2D *v2d, short edit, short sel)
+static void draw_fcurve_vertices_keyframes (FCurve *fcu, SpaceIpo *UNUSED(sipo), View2D *v2d, short edit, short sel)
{
BezTriple *bezt= fcu->bezt;
const float fac= 0.05f * (v2d->cur.xmax - v2d->cur.xmin);
@@ -210,7 +210,7 @@
}
/* helper func - draw handle vertices only for an F-Curve (if it is not protected) */
-static void draw_fcurve_vertices_handles (FCurve *fcu, View2D *v2d, short sel, short sel_handle_only)
+static void draw_fcurve_vertices_handles (FCurve *fcu, SpaceIpo *sipo, View2D *v2d, short sel, short sel_handle_only)
{
BezTriple *bezt= fcu->bezt;
BezTriple *prevbezt = NULL;
@@ -226,7 +226,7 @@
else UI_ThemeColor(TH_HANDLE_VERTEX);
/* anti-aliased lines for more consistent appearance */
- glEnable(GL_LINE_SMOOTH);
+ if ((sipo->flag & SIPO_BEAUTYDRAW_OFF)==0) glEnable(GL_LINE_SMOOTH);
glEnable(GL_BLEND);
for (i=0; i < fcu->totvert; i++, prevbezt=bezt, bezt++) {
@@ -251,7 +251,7 @@
}
}
- glDisable(GL_LINE_SMOOTH);
+ if ((sipo->flag & SIPO_BEAUTYDRAW_OFF)==0) glDisable(GL_LINE_SMOOTH);
glDisable(GL_BLEND);
}
@@ -275,7 +275,7 @@
}
-static void draw_fcurve_vertices (ARegion *ar, FCurve *fcu, short do_handles, short sel_handle_only)
+static void draw_fcurve_vertices (SpaceIpo *sipo, ARegion *ar, FCurve *fcu, short do_handles, short sel_handle_only)
{
View2D *v2d= &ar->v2d;
@@ -292,18 +292,18 @@
if (do_handles)
{
set_fcurve_vertex_color(fcu, 0);
- draw_fcurve_vertices_handles(fcu, v2d, 0, sel_handle_only);
+ draw_fcurve_vertices_handles(fcu, sipo, v2d, 0, sel_handle_only);
set_fcurve_vertex_color(fcu, 1);
- draw_fcurve_vertices_handles(fcu, v2d, 1, sel_handle_only);
+ draw_fcurve_vertices_handles(fcu, sipo, v2d, 1, sel_handle_only);
}
/* draw keyframes over the handles */
set_fcurve_vertex_color(fcu, 0);
- draw_fcurve_vertices_keyframes(fcu, v2d, !(fcu->flag & FCURVE_PROTECTED), 0);
+ draw_fcurve_vertices_keyframes(fcu, sipo, v2d, !(fcu->flag & FCURVE_PROTECTED), 0);
set_fcurve_vertex_color(fcu, 1);
- draw_fcurve_vertices_keyframes(fcu, v2d, !(fcu->flag & FCURVE_PROTECTED), 1);
+ draw_fcurve_vertices_keyframes(fcu, sipo, v2d, !(fcu->flag & FCURVE_PROTECTED), 1);
glPointSize(1.0f);
}
@@ -407,7 +407,7 @@
UI_GetThemeColor3ubv(basecol + bezt->h2, col);
col[3]= drawFCurveFade(fcu) * 255;
glColor4ubv((GLubyte *)col);
-
+
glVertex2fv(fp); glVertex2fv(fp+3);
}
}
@@ -456,7 +456,7 @@
}
/* helper func - draw keyframe vertices only for an F-Curve */
-static void draw_fcurve_samples (ARegion *ar, FCurve *fcu)
+static void draw_fcurve_samples (SpaceIpo *sipo, ARegion *ar, FCurve *fcu)
{
FPoint *first, *last;
float hsize, xscale, yscale;
@@ -476,14 +476,14 @@
/* draw */
if (first && last) {
/* anti-aliased lines for more consistent appearance */
- glEnable(GL_LINE_SMOOTH);
+ if ((sipo->flag & SIPO_BEAUTYDRAW_OFF)==0) glEnable(GL_LINE_SMOOTH);
glEnable(GL_BLEND);
draw_fcurve_sample_control(first->vec[0], first->vec[1], xscale, yscale, hsize);
draw_fcurve_sample_control(last->vec[0], last->vec[1], xscale, yscale, hsize);
glDisable(GL_BLEND);
- glDisable(GL_LINE_SMOOTH);
+ if ((sipo->flag & SIPO_BEAUTYDRAW_OFF)==0) glDisable(GL_LINE_SMOOTH);
}
}
@@ -794,7 +794,7 @@
glLineWidth(3.0f);
/* anti-aliased lines for less jagged appearance */
- glEnable(GL_LINE_SMOOTH);
+ if ((sipo->flag & SIPO_BEAUTYDRAW_OFF)==0) glEnable(GL_LINE_SMOOTH);
glEnable(GL_BLEND);
/* the ghost curves are simply sampled F-Curves stored in sipo->ghostCurves */
@@ -813,7 +813,7 @@
setlinestyle(0);
glLineWidth(1.0f);
- glDisable(GL_LINE_SMOOTH);
+ if ((sipo->flag & SIPO_BEAUTYDRAW_OFF)==0) glDisable(GL_LINE_SMOOTH);
glDisable(GL_BLEND);
}
@@ -871,7 +871,7 @@
}
/* anti-aliased lines for less jagged appearance */
- glEnable(GL_LINE_SMOOTH);
+ if ((sipo->flag & SIPO_BEAUTYDRAW_OFF)==0) glEnable(GL_LINE_SMOOTH);
glEnable(GL_BLEND);
/* draw F-Curve */
@@ -892,7 +892,7 @@
/* restore settings */
setlinestyle(0);
- glDisable(GL_LINE_SMOOTH);
+ if ((sipo->flag & SIPO_BEAUTYDRAW_OFF)==0) glDisable(GL_LINE_SMOOTH);
glDisable(GL_BLEND);
}
@@ -924,11 +924,11 @@
glDisable(GL_BLEND);
}
- draw_fcurve_vertices(ar, fcu, do_handles, sipo->flag&SIPO_SELVHANDLESONLY);
+ draw_fcurve_vertices(sipo, ar, fcu, do_handles, (sipo->flag & SIPO_SELVHANDLESONLY));
}
else {
/* samples: only draw two indicators at either end as indicators */
- draw_fcurve_samples(ar, fcu);
+ draw_fcurve_samples(sipo, ar, fcu);
}
/* unapply unit mapping */
Modified: trunk/blender/source/blender/makesdna/DNA_space_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_space_types.h 2011-02-09 01:27:46 UTC (rev 34730)
+++ trunk/blender/source/blender/makesdna/DNA_space_types.h 2011-02-09 02:09:25 UTC (rev 34731)
@@ -795,6 +795,8 @@
#define SIPO_TEMP_NEEDCHANSYNC (1<<10)
/* don't perform realtime updates */
#define SIPO_NOREALTIMEUPDATES (1<<11)
+ /* don't draw curves with AA ("beauty-draw") for performance */
+#define SIPO_BEAUTYDRAW_OFF (1<<12)
/* SpaceIpo->mode (Graph Editor Mode) */
enum {
Modified: trunk/blender/source/blender/makesrna/intern/rna_space.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_space.c 2011-02-09 01:27:46 UTC (rev 34730)
+++ trunk/blender/source/blender/makesrna/intern/rna_space.c 2011-02-09 02:09:25 UTC (rev 34731)
@@ -1869,6 +1869,11 @@
RNA_def_property_ui_text(prop, "Only Selected Keyframes Handles", "Only show and edit handles of selected keyframes");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_GRAPH, NULL);
+ prop= RNA_def_property(srna, "use_fancy_drawing", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SIPO_BEAUTYDRAW_OFF);
+ RNA_def_property_ui_text(prop, "Use Fancy Drawing", "Draw F-Curves using Anti-Aliasing and other fancy effects. Disable for better performance");
+ RNA_def_property_update(prop, NC_SPACE|ND_SPACE_GRAPH, NULL);
+
/* editing */
prop= RNA_def_property(srna, "use_auto_merge_keyframes", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SIPO_NOTRANSKEYCULL);
More information about the Bf-blender-cvs
mailing list