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>2011-07-26 17:09:10 +0400
committerJoshua Leung <aligorith@gmail.com>2011-07-26 17:09:10 +0400
commit785e634c231542b5eb481946c93a3f8c65ad73a1 (patch)
tree95ab060d9e612585854f43c7877bc60a469baacb /source/blender/editors/space_graph
parent77e906cbd43accb3de89d0ac922d72e1c154aee9 (diff)
F-Curve Drawing - Smoother curves
Bezier curves are now drawn smoother (i.e. less segmented), especially for curve segments where there is a very large vertical displacement over a short period of time (i.e. 120 degrees rotation over 1 frame) and/or often when zoomed in a bit too. - Made the resolution calculation take the vertical distance into account too, instead of just the horizontal distance. - Segment multiplier changed from 3 to 5, as this seems to give better zoomed-in performance.
Diffstat (limited to 'source/blender/editors/space_graph')
-rw-r--r--source/blender/editors/space_graph/graph_draw.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c
index ac0455392cc..a1b8cf0df91 100644
--- a/source/blender/editors/space_graph/graph_draw.c
+++ b/source/blender/editors/space_graph/graph_draw.c
@@ -706,12 +706,11 @@ static void draw_fcurve_curve_bezts (bAnimContext *ac, ID *id, FCurve *fcu, View
* - resol determines number of points to sample in between keyframes
*/
- /* resol not depending on horizontal resolution anymore, drivers for example... */
- // TODO: would be nice to make this depend on the scale of the graph too...
+ /* resol depends on distance between points (not just horizontal) OR is a fixed high res */
if (fcu->driver)
resol= 32;
else
- resol= (int)(3.0*sqrt(bezt->vec[1][0] - prevbezt->vec[1][0]));
+ resol= (int)(5.0*len_v2v2(bezt->vec[1], prevbezt->vec[1]));
if (resol < 2) {
/* only draw one */
@@ -721,6 +720,7 @@ static void draw_fcurve_curve_bezts (bAnimContext *ac, ID *id, FCurve *fcu, View
}
else {
/* clamp resolution to max of 32 */
+ // NOTE: higher values will crash
if (resol > 32) resol= 32;
v1[0]= prevbezt->vec[1][0];