[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [13447] trunk/blender/source/blender/src/ drawaction.c: Bugfix for Action Editor keys clipping:

Joshua Leung aligorith at gmail.com
Tue Jan 29 09:57:42 CET 2008


Revision: 13447
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=13447
Author:   aligorith
Date:     2008-01-29 09:57:41 +0100 (Tue, 29 Jan 2008)

Log Message:
-----------
Bugfix for Action Editor keys clipping: 

Keyframes in the NLA Editor could mysteriously disappear sometimes when manipulating the view in the NLA-editor, when an Action Editor was open beside it.

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-29 02:38:26 UTC (rev 13446)
+++ trunk/blender/source/blender/src/drawaction.c	2008-01-29 08:57:41 UTC (rev 13447)
@@ -1240,15 +1240,36 @@
 	glDisable(GL_BLEND);
 }
 
-#define INIT_AKI_DATA {((G.saction && NLA_ACTION_SCALED)? OBACT : NULL), G.v2d->cur.xmin - 10, G.v2d->cur.xmax + 10}
 
+static ActKeysInc *init_aki_data()
+{
+	static ActKeysInc aki;
+	
+	/* init data of static struct here */
+	if ((curarea->spacetype == SPACE_ACTION) && NLA_ACTION_SCALED)
+		aki.ob= OBACT;
+	else if (curarea->spacetype == SPACE_NLA)
+		aki.ob= NULL; // FIXME
+	else
+		aki.ob= NULL;
+		
+	aki.start= G.v2d->cur.xmin - 10;
+	aki.end= G.v2d->cur.xmax + 10;
+	
+	/* only pass pointer for Action Editor (for now) */
+	if (curarea->spacetype == SPACE_ACTION)
+		return &aki;
+	else	
+		return NULL;
+}
+
 void draw_object_channel(gla2DDrawInfo *di, Object *ob, float ypos)
 {
 	ListBase keys = {0, 0};
 	ListBase blocks = {0, 0};
-	ActKeysInc aki = INIT_AKI_DATA;
+	ActKeysInc *aki = init_aki_data();
 
-	ob_to_keylist(ob, &keys, &blocks, &aki);
+	ob_to_keylist(ob, &keys, &blocks, aki);
 	draw_keylist(di, &keys, &blocks, ypos);
 	
 	BLI_freelistN(&keys);
@@ -1259,9 +1280,9 @@
 {
 	ListBase keys = {0, 0};
 	ListBase blocks = {0, 0};
-	ActKeysInc aki = INIT_AKI_DATA;
+	ActKeysInc *aki = init_aki_data();
 
-	ipo_to_keylist(ipo, &keys, &blocks, &aki);
+	ipo_to_keylist(ipo, &keys, &blocks, aki);
 	draw_keylist(di, &keys, &blocks, ypos);
 	
 	BLI_freelistN(&keys);
@@ -1272,9 +1293,9 @@
 {
 	ListBase keys = {0, 0};
 	ListBase blocks = {0, 0};
-	ActKeysInc aki = INIT_AKI_DATA;
+	ActKeysInc *aki = init_aki_data();
 
-	icu_to_keylist(icu, &keys, &blocks, &aki);
+	icu_to_keylist(icu, &keys, &blocks, aki);
 	draw_keylist(di, &keys, &blocks, ypos);
 	
 	BLI_freelistN(&keys);
@@ -1285,9 +1306,9 @@
 {
 	ListBase keys = {0, 0};
 	ListBase blocks = {0, 0};
-	ActKeysInc aki = INIT_AKI_DATA;
+	ActKeysInc *aki = init_aki_data();
 
-	agroup_to_keylist(agrp, &keys, &blocks, &aki);
+	agroup_to_keylist(agrp, &keys, &blocks, aki);
 	draw_keylist(di, &keys, &blocks, ypos);
 	BLI_freelistN(&keys);
 	BLI_freelistN(&blocks);
@@ -1296,9 +1317,9 @@
 void draw_action_channel(gla2DDrawInfo *di, bAction *act, float ypos)
 {
 	ListBase keys = {0, 0};
-	ActKeysInc aki = INIT_AKI_DATA;
+	ActKeysInc *aki = init_aki_data();
 
-	action_to_keylist(act, &keys, NULL, &aki);
+	action_to_keylist(act, &keys, NULL, aki);
 	draw_keylist(di, &keys, NULL, ypos);
 	BLI_freelistN(&keys);
 }





More information about the Bf-blender-cvs mailing list