[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [20496] branches/soc-2009-aligorith/source /blender: NLA SoC: Start of UI Drawing Code for NLA Editor

Joshua Leung aligorith at gmail.com
Fri May 29 14:26:48 CEST 2009


Revision: 20496
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=20496
Author:   aligorith
Date:     2009-05-29 14:26:47 +0200 (Fri, 29 May 2009)

Log Message:
-----------
NLA SoC: Start of UI Drawing Code for NLA Editor 

In this commit, I've only setup the drawing code for the channels list. Only the drawing of the 'active action' dummy-line has been tested so far. 

Modified Paths:
--------------
    branches/soc-2009-aligorith/source/blender/blenloader/intern/readfile.c
    branches/soc-2009-aligorith/source/blender/editors/animation/anim_filter.c
    branches/soc-2009-aligorith/source/blender/editors/animation/keyframes_draw.c
    branches/soc-2009-aligorith/source/blender/editors/include/ED_anim_api.h
    branches/soc-2009-aligorith/source/blender/editors/include/UI_view2d.h
    branches/soc-2009-aligorith/source/blender/editors/interface/resources.c
    branches/soc-2009-aligorith/source/blender/editors/interface/view2d.c
    branches/soc-2009-aligorith/source/blender/editors/space_graph/space_graph.c
    branches/soc-2009-aligorith/source/blender/editors/space_nla/nla_header.c
    branches/soc-2009-aligorith/source/blender/editors/space_nla/nla_intern.h
    branches/soc-2009-aligorith/source/blender/editors/space_nla/space_nla.c
    branches/soc-2009-aligorith/source/blender/makesdna/DNA_action_types.h

Modified: branches/soc-2009-aligorith/source/blender/blenloader/intern/readfile.c
===================================================================
--- branches/soc-2009-aligorith/source/blender/blenloader/intern/readfile.c	2009-05-29 09:53:46 UTC (rev 20495)
+++ branches/soc-2009-aligorith/source/blender/blenloader/intern/readfile.c	2009-05-29 12:26:47 UTC (rev 20496)
@@ -5680,7 +5680,7 @@
 				ar->v2d.scroll = (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL);
 				ar->v2d.scroll |= (V2D_SCROLL_RIGHT);
 				ar->v2d.keepzoom= V2D_LOCKZOOM_Y;
-				ar->v2d.align= V2D_ALIGN_NO_POS_Y;
+				ar->v2d.align= V2D_ALIGN_NO_NEG_Y;
 				ar->v2d.flag = V2D_VIEWSYNC_AREA_VERTICAL;
 				break;
 			}

Modified: branches/soc-2009-aligorith/source/blender/editors/animation/anim_filter.c
===================================================================
--- branches/soc-2009-aligorith/source/blender/editors/animation/anim_filter.c	2009-05-29 09:53:46 UTC (rev 20495)
+++ branches/soc-2009-aligorith/source/blender/editors/animation/anim_filter.c	2009-05-29 12:26:47 UTC (rev 20496)
@@ -244,7 +244,7 @@
 {
 	/* init dopesheet data if non-existant (i.e. for old files) */
 	if (snla->ads == NULL)
-		snla->ads= MEM_callocN(sizeof(bDopeSheet), "GraphEdit DopeSheet");
+		snla->ads= MEM_callocN(sizeof(bDopeSheet), "NlaEdit DopeSheet");
 	
 	/* sync settings with current view status, then return appropriate data */
 	/* update scene-pointer (no need to check for pinning yet, as not implemented) */
@@ -359,6 +359,9 @@
 			if (ANIMDATA_HAS_NLA(id)) {\
 				nlaOk\
 			}\
+			else if (!(ads->filterflag & ADS_FILTER_NLA_NOACT) && ANIMDATA_HAS_KEYS(id)) {\
+				nlaOk\
+			}\
 		}\
 		else if (ads->filterflag & ADS_FILTER_ONLYDRIVERS) {\
 			if (ANIMDATA_HAS_DRIVERS(id)) {\
@@ -566,6 +569,13 @@
 				ale->datatype= ALE_NLASTRIP;
 			}
 				break;
+			case ANIMTYPE_NLAACTION:
+			{
+				/* nothing to include for now... nothing editable from NLA-perspective here */
+				ale->key_data= NULL;
+				ale->datatype= ALE_NONE;
+			}
+				break;
 		}
 	}
 	
@@ -594,7 +604,6 @@
 				if ( ANIMCHANNEL_SELOK(SEL_FCU(fcu)) ) {
 					/* only include if this curve is active */
 					if (!(filter_mode & ANIMFILTER_ACTIVE) || (fcu->flag & FCURVE_ACTIVE)) {
-						/* owner/ownertype will be either object or action-channel, depending if it was dopesheet or part of an action */
 						ale= make_new_animlistelem(fcu, ANIMTYPE_FCURVE, owner, ownertype, owner_id);
 						
 						if (ale) {
@@ -682,10 +691,49 @@
 	return items;
 }
 
-static int animdata_filter_nla (ListBase *anim_data, NlaTrack *first, int filter_mode, void *owner, short ownertype, ID *owner_id)
+static int animdata_filter_nla (ListBase *anim_data, AnimData *adt, int filter_mode, void *owner, short ownertype, ID *owner_id)
 {
-	// FIXME
-	return 0;
+	bAnimListElem *ale;
+	NlaTrack *nlt;
+	int items = 0;
+	
+	/* loop over NLA Tracks - assume that the caller of this has already checked that these should be included */
+	for (nlt= adt->nla_tracks.first; nlt; nlt= nlt->next) {
+		/* only work with this channel and its subchannels if it is editable */
+		if (!(filter_mode & ANIMFILTER_FOREDIT) || EDITABLE_NLT(nlt)) {
+			/* only include this track if selected in a way consistent with the filtering requirements */
+			if ( ANIMCHANNEL_SELOK(SEL_NLT(nlt)) ) {
+				/* only include if this track is active */
+				// XXX keep this?
+				if (!(filter_mode & ANIMFILTER_ACTIVE) || (nlt->flag & NLATRACK_ACTIVE)) {
+					ale= make_new_animlistelem(nlt, ANIMTYPE_NLATRACK, owner, ownertype, owner_id);
+						
+					if (ale) {
+						BLI_addtail(anim_data, ale);
+						items++;
+					}
+				}
+			}
+		}
+	}
+	
+	/* if showing channels, include active action */
+	if (filter_mode & ANIMFILTER_CHANNELS) {
+		/* there isn't really anything editable here, so skip if need editable */
+		// TODO: currently, selection isn't checked since it doesn't matter
+		if ((filter_mode & ANIMFILTER_FOREDIT) == 0) { 
+			/* just add the action track now */
+			ale= make_new_animlistelem(adt->action, ANIMTYPE_NLAACTION, owner, ownertype, owner_id);
+				
+			if (ale) {
+				BLI_addtail(anim_data, ale);
+				items++;
+			}
+		}
+	}
+	
+	/* return the number of items added to the list */
+	return items;
 }
 
 static int animdata_filter_shapekey (ListBase *anim_data, Key *key, int filter_mode, void *owner, short ownertype, ID *owner_id)
@@ -881,7 +929,7 @@
 			/* add material's animation data */
 			if (FILTER_MAT_OBJD(ma) || (filter_mode & ANIMFILTER_CURVESONLY)) {
 				ANIMDATA_FILTER_CASES(ma, 
-					items += animdata_filter_nla(anim_data, ma->adt->nla_tracks.first, filter_mode, ma, ANIMTYPE_DSMAT, (ID *)ma);, 
+					items += animdata_filter_nla(anim_data, ma->adt, filter_mode, ma, ANIMTYPE_DSMAT, (ID *)ma);, 
 					items += animdata_filter_fcurves(anim_data, ma->adt->drivers.first, NULL, ma, ANIMTYPE_DSMAT, filter_mode, (ID *)ma);, 
 					items += animdata_filter_action(anim_data, ma->adt->action, filter_mode, ma, ANIMTYPE_DSMAT, (ID *)ma);)
 			}
@@ -946,7 +994,7 @@
 	if ((expanded) || (filter_mode & ANIMFILTER_CURVESONLY)) {
 		/* filtering for channels - nla, drivers, keyframes */
 		ANIMDATA_FILTER_CASES(iat, 
-			items+= animdata_filter_nla(anim_data, iat->adt->nla_tracks.first, filter_mode, iat, type, (ID *)iat);,
+			items+= animdata_filter_nla(anim_data, iat->adt, filter_mode, iat, type, (ID *)iat);,
 			items+= animdata_filter_fcurves(anim_data, adt->drivers.first, NULL, iat, type, filter_mode, (ID *)iat);, 
 			items += animdata_filter_action(anim_data, iat->adt->action, filter_mode, iat, type, (ID *)iat);)
 	}
@@ -997,8 +1045,7 @@
 #endif
 				
 				/* add NLA tracks */
-				if (/*EXPANDED_NLTD(adt) ||*/ !(filter_mode & ANIMFILTER_CHANNELS))
-					items += animdata_filter_nla(anim_data, adt->nla_tracks.first, filter_mode, ob, ANIMTYPE_OBJECT, (ID *)ob);
+				items += animdata_filter_nla(anim_data, adt, filter_mode, ob, ANIMTYPE_OBJECT, (ID *)ob);
 			},
 			{ /* drivers */
 				/* include drivers-expand widget? */
@@ -1053,8 +1100,7 @@
 #endif
 				
 				/* add NLA tracks */
-				if (/*EXPANDED_NLTD(adt) ||*/ !(filter_mode & ANIMFILTER_CHANNELS))
-					items += animdata_filter_nla(anim_data, adt->nla_tracks.first, filter_mode, ob, ANIMTYPE_OBJECT, (ID *)ob);
+				items += animdata_filter_nla(anim_data, adt, filter_mode, ob, ANIMTYPE_OBJECT, (ID *)ob);
 			},
 			{ /* drivers */
 				/* include shapekey-expand widget? */
@@ -1179,8 +1225,7 @@
 #endif
 				
 				/* add NLA tracks */
-				if (/*EXPANDED_NLTD(adt) ||*/ !(filter_mode & ANIMFILTER_CHANNELS))
-					items += animdata_filter_nla(anim_data, adt->nla_tracks.first, filter_mode, sce, ANIMTYPE_SCENE, (ID *)sce);
+				items += animdata_filter_nla(anim_data, adt, filter_mode, sce, ANIMTYPE_SCENE, (ID *)sce);
 			},
 			{ /* drivers */
 				/* include drivers-expand widget? */
@@ -1233,8 +1278,7 @@
 #endif
 				
 				/* add NLA tracks */
-				if (/*EXPANDED_NLTD(adt) ||*/ !(filter_mode & ANIMFILTER_CHANNELS))
-					items += animdata_filter_nla(anim_data, adt->nla_tracks.first, filter_mode, wo, ANIMTYPE_DSWOR, (ID *)wo);
+				items += animdata_filter_nla(anim_data, adt, filter_mode, wo, ANIMTYPE_DSWOR, (ID *)wo);
 			},
 			{ /* drivers */
 				/* include world-expand widget? */
@@ -1508,6 +1552,7 @@
 			case ANIMCONT_DOPESHEET:
 			case ANIMCONT_FCURVES:
 			case ANIMCONT_DRIVERS:
+			case ANIMCONT_NLA:
 				items= animdata_filter_dopesheet(anim_data, data, filter_mode);
 				break;
 		}

Modified: branches/soc-2009-aligorith/source/blender/editors/animation/keyframes_draw.c
===================================================================
--- branches/soc-2009-aligorith/source/blender/editors/animation/keyframes_draw.c	2009-05-29 09:53:46 UTC (rev 20495)
+++ branches/soc-2009-aligorith/source/blender/editors/animation/keyframes_draw.c	2009-05-29 12:26:47 UTC (rev 20496)
@@ -412,8 +412,6 @@
 		/* get filterflag */
 		if (ads)
 			filterflag= ads->filterflag;
-		else if ((aki) && (aki->actmode == -1)) /* only set like this by NLA */
-			filterflag= ADS_FILTER_NLADUMMY;
 		else
 			filterflag= 0;
 			

Modified: branches/soc-2009-aligorith/source/blender/editors/include/ED_anim_api.h
===================================================================
--- branches/soc-2009-aligorith/source/blender/editors/include/ED_anim_api.h	2009-05-29 09:53:46 UTC (rev 20495)
+++ branches/soc-2009-aligorith/source/blender/editors/include/ED_anim_api.h	2009-05-29 12:26:47 UTC (rev 20496)
@@ -131,6 +131,7 @@
 	ANIMTYPE_GPLAYER,
 	
 	ANIMTYPE_NLATRACK,
+	ANIMTYPE_NLAACTION,
 } eAnim_ChannelType;
 
 /* types of keyframe data in bAnimListElem */

Modified: branches/soc-2009-aligorith/source/blender/editors/include/UI_view2d.h
===================================================================
--- branches/soc-2009-aligorith/source/blender/editors/include/UI_view2d.h	2009-05-29 09:53:46 UTC (rev 20495)
+++ branches/soc-2009-aligorith/source/blender/editors/include/UI_view2d.h	2009-05-29 12:26:47 UTC (rev 20496)
@@ -52,6 +52,8 @@
 	V2D_COMMONVIEW_STANDARD,
 		/* listview (i.e. Outliner) */
 	V2D_COMMONVIEW_LIST,
+		/* stackview (this is basically a list where new items are added at the top) */
+	V2D_COMMONVIEW_STACK,
 		/* headers (this is basically the same as listview, but no y-panning) */
 	V2D_COMMONVIEW_HEADER,
 		/* ui region containing panels */

Modified: branches/soc-2009-aligorith/source/blender/editors/interface/resources.c
===================================================================
--- branches/soc-2009-aligorith/source/blender/editors/interface/resources.c	2009-05-29 09:53:46 UTC (rev 20495)
+++ branches/soc-2009-aligorith/source/blender/editors/interface/resources.c	2009-05-29 12:26:47 UTC (rev 20496)
@@ -501,7 +501,10 @@
 	btheme->tact= btheme->tipo;
 	SETCOL(btheme->tact.strip, 			12, 10, 10, 128); 
 	SETCOL(btheme->tact.strip_select, 	255, 140, 0, 255); 
-
+	
+	/* space nla */
+	btheme->tnla= btheme->tact;
+	
 	/* space file */
 	/* to have something initialized */
 	btheme->tfile= btheme->tv3d;
@@ -518,20 +521,6 @@
 	SETCOL(btheme->tfile.scene,	250, 250, 250, 255);
 
 	
-	
-
-	/* space nla */
-	btheme->tnla= btheme->tv3d;
-	SETCOL(btheme->tnla.back, 	116, 116, 116, 255);
-	SETCOL(btheme->tnla.text, 	0, 0, 0, 255);
-	SETCOL(btheme->tnla.text_hi, 255, 255, 255, 255);
-	SETCOL(btheme->tnla.grid,  94, 94, 94, 255);	
-	SETCOL(btheme->tnla.shade1,  172, 172, 172, 255);		// sliders
-	SETCOL(btheme->tnla.shade2,  84, 44, 31, 100);	// bar

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list