[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [13410] trunk/blender/source/blender/src/ drawaction.c: == Action Editor Drawing - Optimisations (Part 1 out of ?) ==

Joshua Leung aligorith at gmail.com
Sat Jan 26 12:29:45 CET 2008


Revision: 13410
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=13410
Author:   aligorith
Date:     2008-01-26 12:29:44 +0100 (Sat, 26 Jan 2008)

Log Message:
-----------
== Action Editor Drawing - Optimisations (Part 1 out of ?) ==

Now the Action Editor doesn't bother drawing channels which are out of view. This should give some performance improvements when there are many channels with heaps of keyframes, as the keyframes that occur in that channel don't need to be sampled (which is a major performance bottleneck).

Modified Paths:
--------------
    trunk/blender/source/blender/src/drawaction.c

Modified: trunk/blender/source/blender/src/drawaction.c
===================================================================
--- trunk/blender/source/blender/src/drawaction.c	2008-01-26 10:58:31 UTC (rev 13409)
+++ trunk/blender/source/blender/src/drawaction.c	2008-01-26 11:29:44 UTC (rev 13410)
@@ -813,19 +813,32 @@
 	if (NLA_ACTION_SCALED)
 		map_active_strip(di, OBACT, 0);
 	
-	/* draw keyframes */
+	/* Draw keyframes 
+	 *	1) Only channels that are visible in the Action Editor get drawn/evaluated.
+	 *	   This is to try to optimise this for heavier data sets
+	 *	2) Keyframes which are out of view horizontally could be disregarded (probably as
+	 *	   option - 'drop-frames' or so). Todo...
+	 */
 	y = 0.0;
 	for (ale= act_data.first; ale; ale= ale->next) {
-		switch (ale->datatype) {
-			case ALE_GROUP:
-				draw_agroup_channel(di, ale->data, y);
-				break;
-			case ALE_IPO:
-				draw_ipo_channel(di, ale->key_data, y);
-				break;
-			case ALE_ICU:
-				draw_icu_channel(di, ale->key_data, y);
-				break;
+		float yminc= y-CHANNELHEIGHT/2;
+		float ymaxc= y+CHANNELHEIGHT/2;
+		
+		/* check if visible */
+		if ( IN_RANGE(yminc, G.v2d->cur.ymin, G.v2d->cur.ymax) ||
+			 IN_RANGE(ymaxc, G.v2d->cur.ymin, G.v2d->cur.ymax) ) 
+		{
+			switch (ale->datatype) {
+				case ALE_GROUP:
+					draw_agroup_channel(di, ale->data, y);
+					break;
+				case ALE_IPO:
+					draw_ipo_channel(di, ale->key_data, y);
+					break;
+				case ALE_ICU:
+					draw_icu_channel(di, ale->key_data, y);
+					break;
+			}
 		}
 		
 		y-=CHANNELHEIGHT+CHANNELSKIP;





More information about the Bf-blender-cvs mailing list