[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [38726] branches/soc-2011-pepper/source/ blender/editors/space_graph/graph_draw.c: F-Curve Drawing - Smoother curves

Joshua Leung aligorith at gmail.com
Tue Jul 26 15:09:10 CEST 2011


Revision: 38726
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38726
Author:   aligorith
Date:     2011-07-26 13:09:10 +0000 (Tue, 26 Jul 2011)
Log Message:
-----------
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.

Modified Paths:
--------------
    branches/soc-2011-pepper/source/blender/editors/space_graph/graph_draw.c

Modified: branches/soc-2011-pepper/source/blender/editors/space_graph/graph_draw.c
===================================================================
--- branches/soc-2011-pepper/source/blender/editors/space_graph/graph_draw.c	2011-07-26 13:05:22 UTC (rev 38725)
+++ branches/soc-2011-pepper/source/blender/editors/space_graph/graph_draw.c	2011-07-26 13:09:10 UTC (rev 38726)
@@ -706,12 +706,11 @@
 			 *	- 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 @@
 			}
 			else {
 				/* clamp resolution to max of 32 */
+				// NOTE: higher values will crash
 				if (resol > 32) resol= 32;
 				
 				v1[0]= prevbezt->vec[1][0];




More information about the Bf-blender-cvs mailing list