[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [18006] branches/blender2.5/blender/source /blender/editors: 2.5 - Action Editor Bugfixes

Joshua Leung aligorith at gmail.com
Mon Dec 22 10:43:55 CET 2008


Revision: 18006
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=18006
Author:   aligorith
Date:     2008-12-22 10:43:54 +0100 (Mon, 22 Dec 2008)

Log Message:
-----------
2.5 - Action Editor Bugfixes

* Restored y-position translations needed for gla-stuff, as gla stuff sets viewport + matrices!
* Fixed alpha-problems with icons. The ft-font drawing was turning off GL_BLEND when it was done, which screwed up the icon drawing (previous names were drawn with 'standard' fonts only)
* Removed Context arg from drawing funcs. Passing anim-context instead. 
* Properly initialised new theme settings ported over from animsys2.

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/editors/animation/anim_keyframes_draw.c
    branches/blender2.5/blender/source/blender/editors/include/ED_anim_api.h
    branches/blender2.5/blender/source/blender/editors/interface/resources.c
    branches/blender2.5/blender/source/blender/editors/space_action/action_draw.c
    branches/blender2.5/blender/source/blender/editors/space_action/action_intern.h
    branches/blender2.5/blender/source/blender/editors/space_action/space_action.c

Modified: branches/blender2.5/blender/source/blender/editors/animation/anim_keyframes_draw.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/animation/anim_keyframes_draw.c	2008-12-22 09:43:29 UTC (rev 18005)
+++ branches/blender2.5/blender/source/blender/editors/animation/anim_keyframes_draw.c	2008-12-22 09:43:54 UTC (rev 18006)
@@ -314,19 +314,18 @@
 				totCurves = (startCurves>endCurves)? endCurves: startCurves;
 				
 			if (ab->totcurve >= totCurves) {
-				int sc_xa, sc_xb, sc_y;
+				int sc_xa, sc_xb, sc_ya, sc_yb;
 				
 				/* get co-ordinates of block */
-				// XXX only use x-coordinates... y are dummy ones!
-				gla2DDrawTranslatePt(di, ab->start, ypos, &sc_xa, &sc_y);
-				gla2DDrawTranslatePt(di, ab->end, ypos, &sc_xb, &sc_y);
+				gla2DDrawTranslatePt(di, ab->start, ypos, &sc_xa, &sc_ya);
+				gla2DDrawTranslatePt(di, ab->end, ypos, &sc_xb, &sc_yb);
 				
 				/* draw block */
 				if (ab->sel)
 					UI_ThemeColor4(TH_STRIP_SELECT);
 				else
 					UI_ThemeColor4(TH_STRIP);
-				glRectf((float)sc_xa, (float)ypos-3, (float)sc_xb, (float)ypos+5);
+				glRectf((float)sc_xa, (float)sc_ya-3, (float)sc_xb, (float)sc_yb+5);
 			}
 		}
 	}
@@ -337,12 +336,11 @@
 			int sc_x, sc_y;
 			
 			/* get co-ordinate to draw at */
-			// XXX only use x-coordinates... y are dummy ones!
 			gla2DDrawTranslatePt(di, ak->cfra, ypos, &sc_x, &sc_y);
 			
 			/* draw using icons - old way which is slower but more proven */
-			if (ak->sel & SELECT)UI_icon_draw_aspect((float)sc_x-7, (float)ypos-6, ICON_SPACE2, 1.0f);
-			else UI_icon_draw_aspect((float)sc_x-7, (float)ypos-6, ICON_SPACE3, 1.0f);
+			if (ak->sel & SELECT) UI_icon_draw_aspect((float)sc_x-7, (float)sc_y-6, ICON_SPACE2, 1.0f);
+			else UI_icon_draw_aspect((float)sc_x-7, (float)sc_y-6, ICON_SPACE3, 1.0f);
 			
 			/* draw using OpenGL - slightly uglier but faster */
 			// 	NOTE: disabled for now, as some intel cards seem to have problems with this
@@ -511,6 +509,7 @@
 		return 1;
 		
 	/* if nla-scaling is in effect, apply appropriate scaling adjustments */
+#if 0 // XXX this was from some buggy code... do not port for now
 	if (aki->ob) {
 		float frame= get_action_frame_inv(aki->ob, bezt->vec[1][0]);
 		return IN_RANGE(frame, aki->start, aki->end);
@@ -519,6 +518,8 @@
 		/* check if in range */
 		return IN_RANGE(bezt->vec[1][0], aki->start, aki->end);
 	}
+#endif // XXX this was from some buggy code... do not port for now
+	return 1;
 }
 
 void icu_to_keylist(IpoCurve *icu, ListBase *keys, ListBase *blocks, ActKeysInc *aki)

Modified: branches/blender2.5/blender/source/blender/editors/include/ED_anim_api.h
===================================================================
--- branches/blender2.5/blender/source/blender/editors/include/ED_anim_api.h	2008-12-22 09:43:29 UTC (rev 18005)
+++ branches/blender2.5/blender/source/blender/editors/include/ED_anim_api.h	2008-12-22 09:43:54 UTC (rev 18006)
@@ -209,8 +209,7 @@
 #define ACHANNEL_HEIGHT_HALF	8
 #define	ACHANNEL_SKIP			2
 #define ACHANNEL_STEP			(ACHANNEL_HEIGHT + ACHANNEL_SKIP)
-	// FIXME: needs to be renamed...
-#define NAMEWIDTH				190
+#define ACHANNEL_NAMEWIDTH		200
 
 /* ---------------- API  -------------------- */
 

Modified: branches/blender2.5/blender/source/blender/editors/interface/resources.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/interface/resources.c	2008-12-22 09:43:29 UTC (rev 18005)
+++ branches/blender2.5/blender/source/blender/editors/interface/resources.c	2008-12-22 09:43:54 UTC (rev 18006)
@@ -316,8 +316,24 @@
 			case TH_SEQ_META:
 				cp= ts->meta; break;
 				
+			case TH_HANDLE_VERTEX:
+				cp= ts->handle_vertex;
+				break;
+			case TH_HANDLE_VERTEX_SELECT:
+				cp= ts->handle_vertex_select;
+				break;
+			case TH_HANDLE_VERTEX_SIZE:
+				cp= &ts->handle_vertex_size;
+				break;
+				
+			case TH_DOPESHEET_CHANNELOB:
+				cp= ts->ds_channel;
+				break;
+			case TH_DOPESHEET_CHANNELSUBOB:
+				cp= ts->ds_subchannel;
+				break;	
+				
 			}
-
 		}
 	}
 	

Modified: branches/blender2.5/blender/source/blender/editors/space_action/action_draw.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_action/action_draw.c	2008-12-22 09:43:29 UTC (rev 18005)
+++ branches/blender2.5/blender/source/blender/editors/space_action/action_draw.c	2008-12-22 09:43:54 UTC (rev 18006)
@@ -112,6 +112,10 @@
 	#include "BSE_view.h"
 #endif // XXX old defines for reference only
 
+/* XXX */
+extern void ui_rasterpos_safe(float x, float y, float aspect);
+extern void gl_round_box(int mode, float minx, float miny, float maxx, float maxy, float rad);
+
 /********************************** Slider Stuff **************************** */
 
 #if 0 // XXX all of this slider stuff will need a rethink!
@@ -135,16 +139,16 @@
     sprintf(str, "actionbuttonswin %d", curarea->win);
     block= uiNewBlock (&curarea->uiblocks, str, UI_EMBOSS, UI_HELV, curarea->win);
 
-	x = NAMEWIDTH + 1;
+	x = ACHANNEL_NAMEWIDTH + 1;
     y = 0.0f;
 	
 	uiBlockSetEmboss(block, UI_EMBOSSN);
 
 	if (!(G.saction->flag & SACTION_SLIDERS)) {
-		ACTWIDTH = NAMEWIDTH;
+		ACTWIDTH = ACHANNEL_NAMEWIDTH;
 		but=uiDefIconButBitS(block, TOG, SACTION_SLIDERS, B_REDR, 
 					  ICON_DISCLOSURE_TRI_RIGHT,
-					  NAMEWIDTH - XIC - 5, (short)y + CHANNELHEIGHT,
+					  ACHANNEL_NAMEWIDTH - XIC - 5, (short)y + CHANNELHEIGHT,
 					  XIC,YIC-2,
 					  &(G.saction->flag), 0, 0, 0, 0, 
 					  "Show action window sliders");
@@ -154,19 +158,19 @@
 	else {
 		but= uiDefIconButBitS(block, TOG, SACTION_SLIDERS, B_REDR, 
 					  ICON_DISCLOSURE_TRI_DOWN,
-					  NAMEWIDTH - XIC - 5, (short)y + CHANNELHEIGHT,
+					  ACHANNEL_NAMEWIDTH - XIC - 5, (short)y + CHANNELHEIGHT,
 					  XIC,YIC-2,
 					  &(G.saction->flag), 0, 0, 0, 0, 
 					  "Hide action window sliders");
 		/* no hilite, the winmatrix is not correct later on... */
 		uiButSetFlag(but, UI_NO_HILITE);
 		
-		ACTWIDTH = NAMEWIDTH + SLIDERWIDTH;
+		ACTWIDTH = ACHANNEL_NAMEWIDTH + SLIDERWIDTH;
 		
 		/* sliders are open so draw them */
 		BIF_ThemeColor(TH_FACE); 
 		
-		glRects(NAMEWIDTH,  0,  NAMEWIDTH+SLIDERWIDTH,  curarea->winy);
+		glRects(ACHANNEL_NAMEWIDTH,  0,  ACHANNEL_NAMEWIDTH+SLIDERWIDTH,  curarea->winy);
 		uiBlockSetEmboss(block, UI_EMBOSS);
 		for (i=1; i < key->totkey; i++) {
 			make_rvk_slider(block, ob, i, 
@@ -299,7 +303,7 @@
     block= uiNewBlock (&curarea->uiblocks, str, 
                        UI_EMBOSS, UI_HELV, curarea->win);
 
-	x = (float)NAMEWIDTH + 1;
+	x = (float)ACHANNEL_NAMEWIDTH + 1;
     y = 0.0f;
 	
 	uiBlockSetEmboss(block, UI_EMBOSSN);
@@ -317,7 +321,7 @@
 		
 		/* draw backdrop first */
 		BIF_ThemeColor(TH_FACE); // change this color... it's ugly
-		glRects(NAMEWIDTH,  (short)G.v2d->cur.ymin,  NAMEWIDTH+SLIDERWIDTH,  (short)G.v2d->cur.ymax);
+		glRects(ACHANNEL_NAMEWIDTH,  (short)G.v2d->cur.ymin,  ACHANNEL_NAMEWIDTH+SLIDERWIDTH,  (short)G.v2d->cur.ymax);
 		
 		uiBlockSetEmboss(block, UI_EMBOSS);
 		for (ale= act_data.first; ale; ale= ale->next) {
@@ -389,35 +393,24 @@
 #endif // XXX all of this slider stuff will need a rethink 
 
 
-/********************************** Left-Hand Panel + Generics **************************** */
+/* ************************************************************************* */
+/* Channel List */
 
-// XXX
-extern void gl_round_box(short, float,  float, float, float, short);
-
 /* left hand part */
-void draw_channel_names(const bContext *C, SpaceAction *saction, ARegion *ar) 
+void draw_channel_names(bAnimContext *ac, SpaceAction *saction, ARegion *ar) 
 {
 	ListBase anim_data = {NULL, NULL};
-	bAnimContext ac;
 	bAnimListElem *ale;
 	int filter;
 	View2D *v2d= &ar->v2d;
-	float x= 0.0f, y= (float)(-ACHANNEL_HEIGHT_HALF);
+	float x= 0.0f, y= 0.0f;
 	
-	/* determine what type of data we are operating on */
-	if ((ANIM_animdata_get_context(C, &ac) == 0) || (ac.data == NULL))
-		return;
-	
-	/* set default color back to black */
-	//glColor3ub(0x00, 0x00, 0x00);
-	
 	/* build list of channels to draw */
 	filter= (ANIMFILTER_FORDRAWING|ANIMFILTER_VISIBLE|ANIMFILTER_CHANNELS);
-	ANIM_animdata_filter(&anim_data, filter, ac.data, ac.datatype);
+	ANIM_animdata_filter(&anim_data, filter, ac->data, ac->datatype);
 	
-	/* loop through channels, and set up drawing depending on their type  */
-	glEnable(GL_BLEND);
-	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+	/* loop through channels, and set up drawing depending on their type  */	
+	y= (float)(-ACHANNEL_HEIGHT);
 	
 	for (ale= anim_data.first; ale; ale= ale->next) {
 		const float yminc= (float)(y - ACHANNEL_HEIGHT_HALF);
@@ -740,7 +733,7 @@
 					//if (saction->pin)
 					//	sprintf(name, getname_ipocurve(icu, NULL)); // xxx func to eventually eliminate
 					//else
-					//	sprintf(name, getname_ipocurve(icu, ac.obact)); // xxx func to eventually eliminate
+					//	sprintf(name, getname_ipocurve(icu, ac->obact)); // xxx func to eventually eliminate
 					sprintf(name, "[IPO Curve]"); // FIXME xxx
 				}
 					break;
@@ -906,8 +899,11 @@
 				}
 					break;
 			}	
-
+			
 			/* now, start drawing based on this information */
+			glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+			glEnable(GL_BLEND);
+			
 			/* draw backing strip behind channel name */
 			if (group == 4) {
 				/* only used in dopesheet... */
@@ -915,7 +911,7 @@
 					/* object channel - darker */
 					UI_ThemeColor(TH_DOPESHEET_CHANNELOB);
 					uiSetRoundBox((expand == ICON_TRIA_DOWN)? (1):(1|8));
-					gl_round_box(GL_POLYGON, x+offset,  yminc, (float)NAMEWIDTH, ymaxc, 8);
+					gl_round_box(GL_POLYGON, x+offset,  yminc, (float)ACHANNEL_NAMEWIDTH, ymaxc, 8);
 				}
 				else {
 					/* sub-object folders - lighter */
@@ -925,8 +921,8 @@
 					glBegin(GL_QUADS);
 						glVertex2f(x+offset, yminc);
 						glVertex2f(x+offset, ymaxc);
-						glVertex2f((float)NAMEWIDTH, ymaxc);
-						glVertex2f((float)NAMEWIDTH, yminc);
+						glVertex2f((float)ACHANNEL_NAMEWIDTH, ymaxc);
+						glVertex2f((float)ACHANNEL_NAMEWIDTH, yminc);
 					glEnd();
 					
 					/* clear group value, otherwise we cause errors... */
@@ -937,7 +933,7 @@
 				/* only for gp-data channels */
 				UI_ThemeColorShade(TH_GROUP, 20);
 				uiSetRoundBox((expand == ICON_TRIA_DOWN)? (1):(1|8));
-				gl_round_box(GL_POLYGON, x+offset,  yminc, (float)NAMEWIDTH, ymaxc, 8);

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list