[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [22490] branches/blender2.5/blender/source /blender/editors: Animation Editors: Code Cleanups (for Channel Lists) Part 2

Joshua Leung aligorith at gmail.com
Sun Aug 16 04:21:47 CEST 2009


Revision: 22490
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=22490
Author:   aligorith
Date:     2009-08-16 04:21:43 +0200 (Sun, 16 Aug 2009)

Log Message:
-----------
Animation Editors: Code Cleanups (for Channel Lists) Part 2

Now the mute/protect/expand/etc. toggles are drawn using UI widgets. This means that special event handling code to determine when they were clicked on is no longer needed, and also means that there can now be tooltips for these items too. 

Also, added visibility toggles for ID-block expanders, which will cause all the F-Curves in the linked datablock to not get drawn. The backend filtering code to make this work will come later...

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/editors/animation/anim_channels_defines.c
    branches/blender2.5/blender/source/blender/editors/animation/anim_channels_edit.c
    branches/blender2.5/blender/source/blender/editors/include/ED_anim_api.h
    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
    branches/blender2.5/blender/source/blender/editors/space_graph/graph_draw.c
    branches/blender2.5/blender/source/blender/editors/space_graph/graph_intern.h
    branches/blender2.5/blender/source/blender/editors/space_graph/space_graph.c
    branches/blender2.5/blender/source/blender/editors/space_nla/nla_channels.c
    branches/blender2.5/blender/source/blender/editors/space_nla/nla_draw.c
    branches/blender2.5/blender/source/blender/editors/space_nla/nla_edit.c
    branches/blender2.5/blender/source/blender/editors/space_nla/nla_intern.h
    branches/blender2.5/blender/source/blender/editors/space_nla/space_nla.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-16 01:25:53 UTC (rev 22489)
+++ branches/blender2.5/blender/source/blender/editors/animation/anim_channels_defines.c	2009-08-16 02:21:43 UTC (rev 22490)
@@ -287,6 +287,10 @@
 		case ACHANNEL_SETTING_EXPAND:
 			return 1;
 			
+		 /* visible - only available in Graph Editor */
+		case ACHANNEL_SETTING_VISIBLE: 
+			return ((ac) && (ac->spacetype == SPACE_IPO));
+			
 		default:
 			return 0;
 	}
@@ -345,6 +349,10 @@
 		/* muted only in NLA */
 		case ACHANNEL_SETTING_MUTE: 
 			return ((ac) && (ac->spacetype == SPACE_NLA));
+			
+		/* visible only in Graph Editor */
+		case ACHANNEL_SETTING_VISIBLE: 
+			return ((ac) && (ac->spacetype == SPACE_IPO));
 		
 		/* only select and expand supported otherwise */
 		case ACHANNEL_SETTING_SELECT:
@@ -373,6 +381,10 @@
 		case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
 			return ADT_NLA_EVAL_OFF;
 			
+		case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
+			*neg= 1;
+			return ADT_CURVES_NOT_VISIBLE;
+			
 		default: /* unsupported */
 			return 0;
 	}
@@ -394,6 +406,7 @@
 			GET_ACF_FLAG_PTR(scene->flag);
 			
 		case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
+		case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
 			if (scene->adt)
 				GET_ACF_FLAG_PTR(scene->adt->flag)
 			else
@@ -451,6 +464,10 @@
 		/* muted only in NLA */
 		case ACHANNEL_SETTING_MUTE: 
 			return ((ac) && (ac->spacetype == SPACE_NLA));
+			
+		/* visible only in Graph Editor */
+		case ACHANNEL_SETTING_VISIBLE: 
+			return ((ac) && (ac->spacetype == SPACE_IPO));
 		
 		/* only select and expand supported otherwise */
 		case ACHANNEL_SETTING_SELECT:
@@ -479,6 +496,10 @@
 		case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
 			return ADT_NLA_EVAL_OFF;
 			
+		case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
+			*neg= 1;
+			return ADT_CURVES_NOT_VISIBLE;
+			
 		default: /* unsupported */
 			return 0;
 	}
@@ -501,6 +522,7 @@
 			GET_ACF_FLAG_PTR(ob->nlaflag); // xxx
 			
 		case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
+		case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
 			if (ob->adt)
 				GET_ACF_FLAG_PTR(ob->adt->flag)
 			else
@@ -560,8 +582,14 @@
 /* check if some setting exists for this channel */
 static short acf_group_setting_valid(bAnimContext *ac, bAnimListElem *ale, int setting)
 {
-	/* for now, all settings are supported */
-	return 1;
+	/* for now, all settings are supported, though some are only conditionally */
+	switch (setting) {
+		case ACHANNEL_SETTING_VISIBLE: /* Only available in Graph Editor */
+			return ((ac->sa) && (ac->sa->spacetype==SPACE_IPO));
+			
+		default: /* always supported */
+			return 1;
+	}
 }
 
 /* get the appropriate flag(s) for the setting when it is valid  */
@@ -641,6 +669,9 @@
 				return 1;
 			else
 				return 0; // NOTE: in this special case, we need to draw ICON_ZOOMOUT
+				
+		case ACHANNEL_SETTING_VISIBLE: /* Only available in Graph Editor */
+			return ((ac->sa) && (ac->sa->spacetype==SPACE_IPO));
 			
 		/* always available */
 		default:
@@ -962,6 +993,10 @@
 			
 		case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
 			return ADT_NLA_EVAL_OFF;
+			
+		case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
+			*neg= 1;
+			return ADT_CURVES_NOT_VISIBLE;
 		
 		default: /* unsupported */
 			return 0;
@@ -981,10 +1016,11 @@
 			GET_ACF_FLAG_PTR(ma->flag);
 			
 		case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
+		case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
 			if (ma->adt)
 				GET_ACF_FLAG_PTR(ma->adt->flag)
 			else
-				return NULL;
+				return NULL;	
 		
 		default: /* unsupported */
 			return NULL;
@@ -1026,6 +1062,10 @@
 			
 		case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
 			return ADT_NLA_EVAL_OFF;
+			
+		case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
+			*neg= 1;
+			return ADT_CURVES_NOT_VISIBLE;
 		
 		default: /* unsupported */
 			return 0;
@@ -1045,10 +1085,11 @@
 			GET_ACF_FLAG_PTR(la->flag);
 			
 		case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
+		case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
 			if (la->adt)
 				GET_ACF_FLAG_PTR(la->adt->flag)
 			else
-				return NULL;
+				return NULL;	
 		
 		default: /* unsupported */
 			return NULL;
@@ -1090,6 +1131,10 @@
 			
 		case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
 			return ADT_NLA_EVAL_OFF;
+			
+		case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
+			*neg= 1;
+			return ADT_CURVES_NOT_VISIBLE;
 		
 		default: /* unsupported */
 			return 0;
@@ -1109,6 +1154,7 @@
 			GET_ACF_FLAG_PTR(ca->flag);
 			
 		case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
+		case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
 			if (ca->adt)
 				GET_ACF_FLAG_PTR(ca->adt->flag)
 			else
@@ -1154,6 +1200,10 @@
 			
 		case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
 			return ADT_NLA_EVAL_OFF;
+			
+		case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
+			*neg= 1;
+			return ADT_CURVES_NOT_VISIBLE;
 		
 		default: /* unsupported */
 			return 0;
@@ -1173,6 +1223,7 @@
 			GET_ACF_FLAG_PTR(cu->flag);
 			
 		case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
+		case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
 			if (cu->adt)
 				GET_ACF_FLAG_PTR(cu->adt->flag)
 			else
@@ -1218,6 +1269,10 @@
 			
 		case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
 			return ADT_NLA_EVAL_OFF;
+			
+		case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
+			*neg= 1;
+			return ADT_CURVES_NOT_VISIBLE;
 		
 		default: /* unsupported */
 			return 0;
@@ -1237,6 +1292,7 @@
 			GET_ACF_FLAG_PTR(key->flag);
 			
 		case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
+		case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
 			if (key->adt)
 				GET_ACF_FLAG_PTR(key->adt->flag)
 			else
@@ -1282,6 +1338,10 @@
 			
 		case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
 			return ADT_NLA_EVAL_OFF;
+			
+		case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
+			*neg= 1;
+			return ADT_CURVES_NOT_VISIBLE;
 		
 		default: /* unsupported */
 			return 0;
@@ -1301,6 +1361,7 @@
 			GET_ACF_FLAG_PTR(wo->flag);
 			
 		case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
+		case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
 			if (wo->adt)
 				GET_ACF_FLAG_PTR(wo->adt->flag)
 			else
@@ -1346,6 +1407,10 @@
 			
 		case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
 			return ADT_NLA_EVAL_OFF;
+			
+		case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
+			*neg= 1;
+			return ADT_CURVES_NOT_VISIBLE;
 		
 		default: /* unsupported */
 			return 0;
@@ -1365,6 +1430,7 @@
 			GET_ACF_FLAG_PTR(part->flag);
 			
 		case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
+		case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
 			if (part->adt)
 				GET_ACF_FLAG_PTR(part->adt->flag)
 			else
@@ -1410,6 +1476,10 @@
 			
 		case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
 			return ADT_NLA_EVAL_OFF;
+			
+		case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
+			*neg= 1;
+			return ADT_CURVES_NOT_VISIBLE;
 		
 		default: /* unsupported */
 			return 0;
@@ -1429,6 +1499,7 @@
 			GET_ACF_FLAG_PTR(mb->flag);
 			
 		case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
+		case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
 			if (mb->adt)
 				GET_ACF_FLAG_PTR(mb->adt->flag)
 			else
@@ -1805,7 +1876,7 @@
 {
 	bAnimChannelType *acf= ANIM_channel_get_typeinfo(ale);
 	View2D *v2d= &ac->ar->v2d;
-	short selected, offset, enabled;
+	short selected, offset;
 	float y, ymid, ytext;
 	
 	/* sanity checks - don't draw anything */
@@ -1815,8 +1886,6 @@
 	/* get initial offset */
 	if (acf->get_offset)
 		offset= acf->get_offset(ac, ale);
-	else if (acf->get_indent_level)
-		offset= acf->get_indent_level(ac, ale) * INDENT_STEP_SIZE;
 	else
 		offset= 0;
 		
@@ -1844,9 +1913,7 @@
 		
 	/* step 2) draw expand widget ....................................... */
 	if (acf->has_setting(ac, ale, ACHANNEL_SETTING_EXPAND)) {
-		enabled= ANIM_channel_setting_get(ac, ale, ACHANNEL_SETTING_EXPAND);
-		
-		UI_icon_draw(offset, ymid, ((enabled)? ICON_TRIA_DOWN : ICON_TRIA_RIGHT));
+		/* just skip - drawn as widget now */
 		offset += ICON_WIDTH; 
 	}
 		
@@ -1862,8 +1929,6 @@
 	 */
 	if (ac->sa) {
 		if ((ac->spacetype == SPACE_IPO) && acf->has_setting(ac, ale, ACHANNEL_SETTING_VISIBLE)) {
-			enabled= ANIM_channel_setting_get(ac, ale, ACHANNEL_SETTING_VISIBLE);
-			
 			/* for F-Curves, draw color-preview of curve behind checkbox */
 			if (ale->type == ANIMTYPE_FCURVE) {
 				FCurve *fcu= (FCurve *)ale->data;
@@ -1880,16 +1945,11 @@
 				glRectf(offset, yminc, offset+17, ymaxc);
 			}
 			
-			/* finally the icon itself */
-			UI_icon_draw(offset, ymid, ((enabled)? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT));
+			/* icon is drawn as widget now... */
 			offset += ICON_WIDTH; 
 		}
 		else if ((ac->spacetype == SPACE_NLA) && acf->has_setting(ac, ale, ACHANNEL_SETTING_SOLO)) {
-			/* simply draw glowing dot in NLA for whether the track is enabled or not... */
-			// NOTE: assumed to be for NLA track only for now...
-			enabled= ANIM_channel_setting_get(ac, ale, ACHANNEL_SETTING_SOLO);
-			
-			UI_icon_draw(offset, ymid, ((enabled)? ICON_LAYER_ACTIVE : ICON_LAYER_USED));
+			/* just skip - drawn as widget now */
 			offset += ICON_WIDTH; 
 		}
 	}
@@ -1927,21 +1987,198 @@
 		
 		/* protect... */
 		if (acf->has_setting(ac, ale, ACHANNEL_SETTING_PROTECT)) {
-			enabled= ANIM_channel_setting_get(ac, ale, ACHANNEL_SETTING_PROTECT);
-			
+			/* just skip - drawn as widget now */
 			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));
+			/* just skip - drawn as widget now */
+			offset += ICON_WIDTH;
 		}
 		
 		glDisable(GL_BLEND); /* End of blending with background */
 	}
 }
 

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list