[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [22450] branches/blender2.5/blender/source /blender/editors: 2.5 - Assorted Animation UI Tweaks

Joshua Leung aligorith at gmail.com
Fri Aug 14 13:09:20 CEST 2009


Revision: 22450
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=22450
Author:   aligorith
Date:     2009-08-14 13:09:19 +0200 (Fri, 14 Aug 2009)

Log Message:
-----------
2.5 - Assorted Animation UI Tweaks 

* Fixed padding for Graph Editor visibility toggles
* Reverted many of the tweaks to Timeline UI for now (for the reasons outlined in earlier mail)
* NLA Editor now (mostly) uses the new channel-drawing API

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/editors/animation/anim_channels_defines.c
    branches/blender2.5/blender/source/blender/editors/include/ED_anim_api.h
    branches/blender2.5/blender/source/blender/editors/space_graph/graph_buttons.c
    branches/blender2.5/blender/source/blender/editors/space_graph/graph_draw.c
    branches/blender2.5/blender/source/blender/editors/space_nla/nla_draw.c
    branches/blender2.5/blender/source/blender/editors/space_time/time_header.c

Modified: branches/blender2.5/blender/source/blender/editors/animation/anim_channels_defines.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/animation/anim_channels_defines.c	2009-08-14 04:45:29 UTC (rev 22449)
+++ branches/blender2.5/blender/source/blender/editors/animation/anim_channels_defines.c	2009-08-14 11:09:19 UTC (rev 22450)
@@ -1874,10 +1874,10 @@
 				glColor3fv(fcu->color);
 				
 				/* just a solid color rect
-				 * 	hardcoded 18 pixels width is slightly wider than icon width, so that 
+				 * 	hardcoded 17 pixels width is slightly wider than icon width, so that 
 				 *	there's a slight border around it 
 				 */
-				glRectf(offset, yminc, offset+18, ymaxc);
+				glRectf(offset, yminc, offset+17, ymaxc);
 			}
 			
 			/* finally the icon itself */
@@ -1913,34 +1913,35 @@
 		UI_DrawString(offset, ytext, name);
 	}
 	
-	/* step 6) draw mute+protection toggles ............................. */
+	/* step 6) draw mute+protection toggles + (sliders) ....................... */
 	/* reset offset - now goes from RHS of panel */
 	offset = 0;
 	
 	// TODO: we need a mechanism of drawing over (and hiding) stuff from here...
+	// TODO: when drawing sliders, make those draw instead of these toggles if not enough space
 	
-	/* set blending again, as text drawing may clear it */
-	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-	glEnable(GL_BLEND);
-	
-	/* protect... */
-	// XXX v2d might not be valid
-	if (acf->has_setting(ac, ale, ACHANNEL_SETTING_PROTECT)) {
-		enabled= ANIM_channel_setting_get(ac, ale, ACHANNEL_SETTING_PROTECT);
+	if (v2d) {
+		/* set blending again, as text drawing may clear it */
+		glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+		glEnable(GL_BLEND);
 		
-		offset += ICON_WIDTH;
-		UI_icon_draw(v2d->cur.xmax-(float)offset, ymid, ((enabled)? ICON_LOCKED : ICON_UNLOCKED));
-	}
-	/* mute... */
-	// XXX v2d might not be valid
-	if (acf->has_setting(ac, ale, ACHANNEL_SETTING_MUTE)) {
-		enabled= ANIM_channel_setting_get(ac, ale, ACHANNEL_SETTING_MUTE);
+		/* protect... */
+		if (acf->has_setting(ac, ale, ACHANNEL_SETTING_PROTECT)) {
+			enabled= ANIM_channel_setting_get(ac, ale, ACHANNEL_SETTING_PROTECT);
+			
+			offset += ICON_WIDTH;
+			UI_icon_draw(v2d->cur.xmax-(float)offset, ymid, ((enabled)? ICON_LOCKED : ICON_UNLOCKED));
+		}
+		/* mute... */
+		if (acf->has_setting(ac, ale, ACHANNEL_SETTING_MUTE)) {
+			enabled= ANIM_channel_setting_get(ac, ale, ACHANNEL_SETTING_MUTE);
+			
+			offset += ICON_WIDTH; 
+			UI_icon_draw(v2d->cur.xmax-(float)offset, ymid, ((enabled)? ICON_MUTE_IPO_ON : ICON_MUTE_IPO_OFF));
+		}
 		
-		offset += ICON_WIDTH; 
-		UI_icon_draw(v2d->cur.xmax-(float)offset, ymid, ((enabled)? ICON_MUTE_IPO_ON : ICON_MUTE_IPO_OFF));
+		glDisable(GL_BLEND); /* End of blending with background */
 	}
-	
-	glDisable(GL_BLEND); /* End of blending with background */
 }
 
 /* *********************************************** */

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	2009-08-14 04:45:29 UTC (rev 22449)
+++ branches/blender2.5/blender/source/blender/editors/include/ED_anim_api.h	2009-08-14 11:09:19 UTC (rev 22450)
@@ -402,14 +402,16 @@
 /* ------------ Animation F-Curves <-> Icons/Names Mapping ------------ */
 /* anim_ipo_utils.c */
 
+/* Get icon for type of setting F-Curve is for */
+// XXX include this in the getname() method via RNA?
 int geticon_anim_blocktype(short blocktype);
 
+/* Get name for channel-list displays for F-Curve */
 void getname_anim_fcurve(char *name, struct ID *id, struct FCurve *fcu);
 
-
+/* Automatically determine a color for the nth F-Curve */
 void ipo_rainbow(int cur, int tot, float *out);
 
-
 /* ------------- NLA-Mapping ----------------------- */
 /* anim_draw.c */
 

Modified: branches/blender2.5/blender/source/blender/editors/space_graph/graph_buttons.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_graph/graph_buttons.c	2009-08-14 04:45:29 UTC (rev 22449)
+++ branches/blender2.5/blender/source/blender/editors/space_graph/graph_buttons.c	2009-08-14 11:09:19 UTC (rev 22450)
@@ -160,7 +160,7 @@
 	}
 	
 	getname_anim_fcurve(name, ale->id, fcu);
-	uiDefBut(block, LABEL, 1, name,	30, 180, 300, 19, NULL, 0.0, 0.0, 0, 0, "Name of Active F-Curve");
+	uiDefBut(block, LABEL, 1, name,	40, 180, 300, 19, NULL, 0.0, 0.0, 0, 0, "Name of Active F-Curve");
 	
 	/* TODO: the following settings could be added here
 	 *	- F-Curve coloring mode - mode selector + color selector

Modified: branches/blender2.5/blender/source/blender/editors/space_graph/graph_draw.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_graph/graph_draw.c	2009-08-14 04:45:29 UTC (rev 22449)
+++ branches/blender2.5/blender/source/blender/editors/space_graph/graph_draw.c	2009-08-14 11:09:19 UTC (rev 22450)
@@ -877,10 +877,6 @@
 /* ************************************************************************* */
 /* Channel List */
 
-// XXX quite a few of these need to be kept in sync with their counterparts in Action Editor
-// as they're the same. We have 2 separate copies of this for now to make it easier to develop
-// the diffences between the two editors, but one day these should be merged!
-
 /* left hand part */
 void graph_draw_channel_names(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar) 
 {
@@ -903,17 +899,6 @@
 	 *	  start of list offset, and the second is as a correction for the scrollers.
 	 */
 	height= (float)((items*ACHANNEL_STEP) + (ACHANNEL_HEIGHT*2));
-	
-#if 0
-	if (height > (v2d->mask.ymax - v2d->mask.ymin)) {
-		/* don't use totrect set, as the width stays the same 
-		 * (NOTE: this is ok here, the configuration is pretty straightforward) 
-		 */
-		v2d->tot.ymin= (float)(-height);
-	}
-	
-	/* XXX I would call the below line! (ton) */
-#endif
 	UI_view2d_totRect_set(v2d, ar->winx, height);
 	
 	/* loop through channels, and set up drawing depending on their type  */	

Modified: branches/blender2.5/blender/source/blender/editors/space_nla/nla_draw.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_nla/nla_draw.c	2009-08-14 04:45:29 UTC (rev 22449)
+++ branches/blender2.5/blender/source/blender/editors/space_nla/nla_draw.c	2009-08-14 11:09:19 UTC (rev 22450)
@@ -633,308 +633,10 @@
 			short indent= 0, offset= 0, sel= 0, group= 0;
 			int expand= -1, protect = -1, special= -1, mute = -1;
 			char name[128];
+			short doDraw=0;
 			
 			/* determine what needs to be drawn */
 			switch (ale->type) {
-				case ANIMTYPE_SCENE: /* scene */
-				{
-					Scene *sce= (Scene *)ale->data;
-					AnimData *adt= ale->adt;
-					
-					group= 4;
-					indent= 0;
-					
-					special= ICON_SCENE_DATA;
-					
-					/* only show expand if there are any channels */
-					if (EXPANDED_SCEC(sce))
-						expand= ICON_TRIA_DOWN;
-					else
-						expand= ICON_TRIA_RIGHT;
-						
-					/* NLA evaluation on/off button */
-					if (adt) {
-						if (adt->flag & ADT_NLA_EVAL_OFF)
-							mute = ICON_MUTE_IPO_ON;
-						else	
-							mute = ICON_MUTE_IPO_OFF;
-					}
-					
-					sel = SEL_SCEC(sce);
-					strcpy(name, sce->id.name+2);
-				}
-					break;
-				case ANIMTYPE_OBJECT: /* object */
-				{
-					Base *base= (Base *)ale->data;
-					Object *ob= base->object;
-					AnimData *adt= ale->adt;
-					
-					group= 4;
-					indent= 0;
-					
-					/* icon depends on object-type */
-					if (ob->type == OB_ARMATURE)
-						special= ICON_ARMATURE_DATA;
-					else	
-						special= ICON_OBJECT_DATA;
-						
-					/* only show expand if there are any channels */
-					if (EXPANDED_OBJC(ob))
-						expand= ICON_TRIA_DOWN;
-					else
-						expand= ICON_TRIA_RIGHT;
-					
-					/* NLA evaluation on/off button */
-					if (adt) {
-						if (adt->flag & ADT_NLA_EVAL_OFF)
-							mute = ICON_MUTE_IPO_ON;
-						else	
-							mute = ICON_MUTE_IPO_OFF;
-					}
-					
-					sel = SEL_OBJC(base);
-					strcpy(name, ob->id.name+2);
-				}
-					break;
-				case ANIMTYPE_FILLMATD: /* object materials (dopesheet) expand widget */
-				{
-					Object *ob = (Object *)ale->data;
-					
-					group = 4;
-					indent = 1;
-					special = ICON_MATERIAL_DATA;
-					
-					if (FILTER_MAT_OBJC(ob))
-						expand = ICON_TRIA_DOWN;
-					else
-						expand = ICON_TRIA_RIGHT;
-						
-					strcpy(name, "Materials");
-				}
-					break;
-				case ANIMTYPE_FILLPARTD: /* object particles (dopesheet) expand widget */
-				{
-					Object *ob = (Object *)ale->data;
-					
-					group = 4;
-					indent = 1;
-					special = ICON_PARTICLE_DATA;
-					
-					if (FILTER_PART_OBJC(ob))
-						expand = ICON_TRIA_DOWN;
-					else
-						expand = ICON_TRIA_RIGHT;
-					
-					strcpy(name, "Particles");
-				}
-					break;
-				
-				
-				case ANIMTYPE_DSMAT: /* single material (dopesheet) expand widget */
-				{
-					Material *ma = (Material *)ale->data;
-					AnimData *adt= ale->adt;
-					
-					group = 0;
-					indent = 0;
-					special = ICON_MATERIAL_DATA;
-					offset = 21;
-					
-					if (FILTER_MAT_OBJD(ma))
-						expand = ICON_TRIA_DOWN;
-					else
-						expand = ICON_TRIA_RIGHT;
-						
-					/* NLA evaluation on/off button */
-					if (adt) {
-						if (adt->flag & ADT_NLA_EVAL_OFF)
-							mute = ICON_MUTE_IPO_ON;
-						else	
-							mute = ICON_MUTE_IPO_OFF;
-					}
-					
-					strcpy(name, ma->id.name+2);
-				}
-					break;
-				case ANIMTYPE_DSLAM: /* lamp (dopesheet) expand widget */
-				{
-					Lamp *la = (Lamp *)ale->data;
-					AnimData *adt= ale->adt;
-					
-					group = 4;
-					indent = 1;
-					special = ICON_LAMP_DATA;
-					
-					if (FILTER_LAM_OBJD(la))
-						expand = ICON_TRIA_DOWN;
-					else
-						expand = ICON_TRIA_RIGHT;
-						
-					/* NLA evaluation on/off button */
-					if (adt) {
-						if (adt->flag & ADT_NLA_EVAL_OFF)
-							mute = ICON_MUTE_IPO_ON;
-						else	
-							mute = ICON_MUTE_IPO_OFF;
-					}
-					
-					strcpy(name, la->id.name+2);
-				}
-					break;
-				case ANIMTYPE_DSCAM: /* camera (dopesheet) expand widget */
-				{
-					Camera *ca = (Camera *)ale->data;
-					AnimData *adt= ale->adt;
-					
-					group = 4;
-					indent = 1;
-					special = ICON_CAMERA_DATA;
-					
-					if (FILTER_CAM_OBJD(ca))

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list