[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11144] trunk/blender/source/blender: == Action Editor ==

Joshua Leung aligorith at gmail.com
Mon Jul 2 14:04:23 CEST 2007


Revision: 11144
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11144
Author:   aligorith
Date:     2007-07-02 14:04:22 +0200 (Mon, 02 Jul 2007)

Log Message:
-----------
== Action Editor ==

Some cleanups of the Action Editor drawing methods. These now make use of the filtering stuff I added for the backend cleanup.

Unfortuantely I still cannot get Blender's ui widgets to really work properly, so that toggle icons can have tooltips. There were some severe scaling issues.

Modified Paths:
--------------
    trunk/blender/source/blender/include/BIF_editaction.h
    trunk/blender/source/blender/include/BSE_editaction_types.h
    trunk/blender/source/blender/src/drawaction.c
    trunk/blender/source/blender/src/editaction.c

Modified: trunk/blender/source/blender/include/BIF_editaction.h
===================================================================
--- trunk/blender/source/blender/include/BIF_editaction.h	2007-07-02 11:32:15 UTC (rev 11143)
+++ trunk/blender/source/blender/include/BIF_editaction.h	2007-07-02 12:04:22 UTC (rev 11144)
@@ -64,7 +64,7 @@
 #define EDITABLE_ICU(icu) ((icu->flag & IPO_PROTECT)==0)
 #define SEL_ICU(icu) (icu->flag & IPO_SELECT)
 
-#define NLA_ACTION_SCALED (G.saction->pin==0 && OBACT)
+#define NLA_ACTION_SCALED (G.saction->pin==0 && OBACT && OBACT->action)
 #define NLA_IPO_SCALED (OBACT && OBACT->action && G.sipo->pin==0 && G.sipo->actname)
 
 /* constants for setting ipo-interpolation type */

Modified: trunk/blender/source/blender/include/BSE_editaction_types.h
===================================================================
--- trunk/blender/source/blender/include/BSE_editaction_types.h	2007-07-02 11:32:15 UTC (rev 11143)
+++ trunk/blender/source/blender/include/BSE_editaction_types.h	2007-07-02 12:04:22 UTC (rev 11144)
@@ -48,6 +48,7 @@
 	void 	*data;		/* source data this elem represents */
 	int 	type;		/* one of the ACTTYPE_* values */
 	int		flag;		/* copy of elem's flags for quick access */
+	int 	index;		/* copy of adrcode where applicable */
 	
 	void	*key_data;	/* motion data - ipo or ipo-curve */
 	short	datatype;	/* type of motion data to expect */
@@ -66,6 +67,7 @@
 #define ACTFILTER_CHANNELS		0x008	/* do we only care that it is a channel */
 #define ACTFILTER_IPOKEYS		0x010	/* only channels referencing ipo's */
 #define ACTFILTER_ONLYICU		0x020	/* only reference ipo-curves */
+#define ACTFILTER_FORDRAWING	0x040	/* make list for interface drawing */
 
 /* Action Editor - Main Data types */
 #define ACTCONT_NONE		0

Modified: trunk/blender/source/blender/src/drawaction.c
===================================================================
--- trunk/blender/source/blender/src/drawaction.c	2007-07-02 11:32:15 UTC (rev 11143)
+++ trunk/blender/source/blender/src/drawaction.c	2007-07-02 12:04:22 UTC (rev 11144)
@@ -83,6 +83,7 @@
 
 #include "BSE_drawnla.h"
 #include "BSE_drawipo.h"
+#include "BSE_editaction_types.h"
 #include "BSE_editipo.h"
 #include "BSE_time.h"
 #include "BSE_view.h"
@@ -92,6 +93,8 @@
 #include "blendef.h"
 #include "mydevice.h"
 
+/********************************** Slider Stuff **************************** */
+
 /* sliders for shapekeys */
 static void meshactionbuts(SpaceAction *saction, Object *ob, Key *key)
 {
@@ -336,7 +339,9 @@
 	uiDrawBlock(block);
 }
 
-void draw_cfra_action(void)
+/********************************** Current Frame **************************** */
+
+void draw_cfra_action (void)
 {
 	Object *ob;
 	float vec[2];
@@ -370,231 +375,23 @@
 	glLineWidth(1.0);
 }
 
-/* left hand */
-static void draw_action_channel_names(bAction *act) 
-{
-    bActionChannel *achan;
-    bConstraintChannel *conchan;
-	IpoCurve *icu;
-    float	x, y;
+/********************************** Left-Hand Panel + Generics **************************** */
 
-    x = 0.0;
-	y = 0.0f;
-
-	for (achan=act->chanbase.first; achan; achan= achan->next) {
-		if(VISIBLE_ACHAN(achan)) {
-			glEnable(GL_BLEND);
-			glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) ;
-			
-			/* draw backing strip behind action channel name */
-			BIF_ThemeColorShade(TH_HEADER, 20);
-			glRectf(x,  y-CHANNELHEIGHT/2,  (float)NAMEWIDTH,  y+CHANNELHEIGHT/2);
-			
-			/* draw expand/collapse triangle for action-channel */
-			if (EXPANDED_ACHAN(achan))
-				BIF_icon_draw(x+1, y-CHANNELHEIGHT/2, ICON_TRIA_DOWN);
-			else
-				BIF_icon_draw(x+1, y-CHANNELHEIGHT/2, ICON_TRIA_RIGHT);
-			
-			/* draw name of action channel */
-			if (SEL_ACHAN(achan))
-				BIF_ThemeColor(TH_TEXT_HI);
-			else
-				BIF_ThemeColor(TH_TEXT);
-			glRasterPos2f(x+18,  y-4);
-			BMF_DrawString(G.font, achan->name);
-			
-			/* draw 'eye' indicating whether channel's ipo is muted */
-			if (achan->ipo) {
-				if (achan->ipo->muteipo) 
-					BIF_icon_draw(NAMEWIDTH-32, y-CHANNELHEIGHT/2, ICON_RESTRICT_VIEW_ON);
-				else 
-					BIF_icon_draw(NAMEWIDTH-32, y-CHANNELHEIGHT/2, ICON_RESTRICT_VIEW_OFF);
-			}
-			
-			/* draw 'lock' indicating whether channel is protected */
-			if (EDITABLE_ACHAN(achan)==0) 
-				BIF_icon_draw(NAMEWIDTH-16, y-CHANNELHEIGHT/2, ICON_LOCKED);
-			else 
-				BIF_icon_draw(NAMEWIDTH-16, y-CHANNELHEIGHT/2, ICON_UNLOCKED);
-			y-=CHANNELHEIGHT+CHANNELSKIP;
-			
-			if (EXPANDED_ACHAN(achan)) {
-				/* Draw IPO-curves show/hide widget */
-				if (achan->ipo) {					
-					/* draw backing strip behind */
-					BIF_ThemeColorShade(TH_HEADER, -20);
-					glRectf(x+7,  y-CHANNELHEIGHT/2,  (float)NAMEWIDTH,  y+CHANNELHEIGHT/2);
-					
-					/* draw expand/collapse triangle for showing sub-channels  */
-					if (FILTER_IPO_ACHAN(achan))
-						BIF_icon_draw(x+8, y-CHANNELHEIGHT/2, ICON_TRIA_DOWN);
-					else
-						BIF_icon_draw(x+8, y-CHANNELHEIGHT/2, ICON_TRIA_RIGHT);
-					
-					/* draw icon showing type of ipo-block */
-					BIF_icon_draw(x+24, y-CHANNELHEIGHT/2, geticon_ipo_blocktype(achan->ipo->blocktype));
-					
-					/* draw name of ipo-block */
-					if (SEL_ACHAN(achan))
-						BIF_ThemeColor(TH_TEXT_HI);
-					else
-						BIF_ThemeColor(TH_TEXT);
-					glRasterPos2f(x+40,  y-4);
-					BMF_DrawString(G.font, "IPO Curves"); // TODO: make proper naming scheme
-				
-					y-=CHANNELHEIGHT+CHANNELSKIP;
-				
-					/* Draw IPO-curve-channels? */
-					if (FILTER_IPO_ACHAN(achan)) {
-						for (icu=achan->ipo->curve.first; icu; icu=icu->next) {
-							char *icu_name= getname_ipocurve(icu);
-							
-							/* draw backing strip behind ipo-curve channel*/
-							BIF_ThemeColorShade(TH_HEADER, -40);
-							glRectf(x+14,  y-CHANNELHEIGHT/2,  (float)NAMEWIDTH,  y+CHANNELHEIGHT/2);
-							
-							/* draw name of ipo-curve channel */
-							if (SEL_ICU(icu))
-								BIF_ThemeColor(TH_TEXT_HI);
-							else
-								BIF_ThemeColor(TH_TEXT);
-							glRasterPos2f(x+24,  y-4);
-							BMF_DrawString(G.font, icu_name);
-							
-							/* draw 'eye' indicating whether channel's ipo curve is muted */
-							if (icu->flag & IPO_MUTE) 
-								BIF_icon_draw(NAMEWIDTH-16, y-CHANNELHEIGHT/2, ICON_RESTRICT_VIEW_ON);
-							else 
-								BIF_icon_draw(NAMEWIDTH-16, y-CHANNELHEIGHT/2, ICON_RESTRICT_VIEW_OFF);
-							
-#if 0 /* tempolarily disabled until all ipo-code can support this option */
-							/* draw 'lock' to indicate if ipo-curve channel is protected */
-							if (EDITABLE_ICU(icu)==0) 
-								BIF_icon_draw(NAMEWIDTH-16, y-CHANNELHEIGHT/2, ICON_LOCKED);
-							else 
-								BIF_icon_draw(NAMEWIDTH-16, y-CHANNELHEIGHT/2, ICON_UNLOCKED);	
-#endif
-							y-=CHANNELHEIGHT+CHANNELSKIP;
-						}
-					}
-				}
-
-				/* Draw constraints show/hide widget */
-				if (achan->constraintChannels.first) {
-					/* draw backing strip behind */
-					BIF_ThemeColorShade(TH_HEADER, -20);
-					glRectf(x+7,  y-CHANNELHEIGHT/2,  (float)NAMEWIDTH,  y+CHANNELHEIGHT/2);
-					
-					/* draw expand/collapse triangle for showing sub-channels  */
-					if (FILTER_CON_ACHAN(achan))
-						BIF_icon_draw(x+8, y-CHANNELHEIGHT/2, ICON_TRIA_DOWN);
-					else
-						BIF_icon_draw(x+8, y-CHANNELHEIGHT/2, ICON_TRIA_RIGHT);
-					
-					/* draw constraint icon */
-					BIF_icon_draw(x+24, y-CHANNELHEIGHT/2, ICON_CONSTRAINT);
-					
-					/* draw name of widget */
-					if (SEL_ACHAN(achan))
-						BIF_ThemeColor(TH_TEXT_HI);
-					else
-						BIF_ThemeColor(TH_TEXT);
-					glRasterPos2f(x+40,  y-4);
-					BMF_DrawString(G.font, "Constraints");
-				
-					y-=CHANNELHEIGHT+CHANNELSKIP;
-				
-					/* Draw constraint channels?  */
-					if (FILTER_CON_ACHAN(achan)) {
-						for (conchan=achan->constraintChannels.first; conchan; conchan=conchan->next) {
-							/* draw backing strip behind constraint channel*/
-							BIF_ThemeColorShade(TH_HEADER, -40);
-							glRectf(x+14,  y-CHANNELHEIGHT/2,  (float)NAMEWIDTH,  y+CHANNELHEIGHT/2);
-							
-							/* draw name of constraint channel */
-							if (SEL_CONCHAN(conchan))
-								BIF_ThemeColor(TH_TEXT_HI);
-							else
-								BIF_ThemeColor(TH_TEXT);
-							glRasterPos2f(x+25,  y-4);
-							BMF_DrawString(G.font, conchan->name);
-							
-							/* draw 'eye' indicating whether channel's ipo is muted */
-							if (conchan->ipo) {
-								if (conchan->ipo->muteipo) 
-									BIF_icon_draw(NAMEWIDTH-32, y-CHANNELHEIGHT/2, ICON_RESTRICT_VIEW_ON);
-								else 
-									BIF_icon_draw(NAMEWIDTH-32, y-CHANNELHEIGHT/2, ICON_RESTRICT_VIEW_OFF);
-							}
-							
-							/* draw 'lock' to indicate if constraint channel is protected */
-							if (EDITABLE_CONCHAN(conchan)==0) 
-								BIF_icon_draw(NAMEWIDTH-16, y-CHANNELHEIGHT/2, ICON_LOCKED);
-							else 
-								BIF_icon_draw(NAMEWIDTH-16, y-CHANNELHEIGHT/2, ICON_UNLOCKED);	
-							y-=CHANNELHEIGHT+CHANNELSKIP;
-						}
-					}
-				}
-			}
-			
-			glDisable(GL_BLEND);
-		}
-	}
-}
-
-
-static void draw_action_mesh_names(Key *key) 
-{
-	/* draws the names of the rvk keys in the
-	 * left side of the action window
-	 */
-	int	     i;
-	char     keyname[32];
-	float    x, y;
-	KeyBlock *kb;
-
-	x = 0.0;
-	y= 0.0;
-
-	kb= key->block.first;
-
-	for (i=1 ; i < key->totkey ; ++ i) {
-		glColor3ub(0xAA, 0xAA, 0xAA);
-		glRectf(x,	y-CHANNELHEIGHT/2,	(float)NAMEWIDTH,  y+CHANNELHEIGHT/2);
-
-		glColor3ub(0, 0, 0);
-
-		glRasterPos2f(x+8,	y-4);
-		kb = kb->next;
-		/* Blender now has support for named
-		 * key blocks. If a name hasn't
-		 * been set for an key block then
-		 * just display the key number -- 
-		 * otherwise display the name stored
-		 * in the keyblock.
-		 */
-		if (kb->name[0] == '\0') {
-		  sprintf(keyname, "Key %d", i);
-		  BMF_DrawString(G.font, keyname);
-		}
-		else {
-		  BMF_DrawString(G.font, kb->name);
-		}
-
-		y-=CHANNELHEIGHT+CHANNELSKIP;
-
-	}
-}
-
 /* left hand part */
 static void draw_channel_names(void) 
 {
-	short ofsx, ofsy = 0; 
-	bAction	*act;
-	Key *key;
-
+	ListBase act_data = {NULL, NULL};
+	bActListElem *ale;
+	int filter;
+	void *data;
+	short datatype;
+	short ofsx = 0, ofsy = 0; 
+	float x= 0.0f, y= 0.0f;
+	
+	/* determine what type of data we are operating on */
+	data = get_action_context(&datatype);
+	if (data == NULL) return;
+	
 	/* Clip to the scrollable area */
 	if(curarea->winx>SCROLLB+10 && curarea->winy>SCROLLH+10) {
 		if(G.v2d->scroll) {	
@@ -609,57 +406,213 @@
 		}
 	}
 	
-	myortho2(0,	NAMEWIDTH, G.v2d->cur.ymin, G.v2d->cur.ymax);	//	Scaling
+	/* prepare scaling for LHS panel */

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list