[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [17437] branches/animsys2/source/blender: AnimSys2: Dopesheet - Filtering Options

Joshua Leung aligorith at gmail.com
Thu Nov 13 04:44:56 CET 2008


Revision: 17437
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=17437
Author:   aligorith
Date:     2008-11-13 04:44:14 +0100 (Thu, 13 Nov 2008)

Log Message:
-----------
AnimSys2: Dopesheet - Filtering Options

Added a few basic options for filtering what gets displayed in the Dopesheet - Selected, Non-Armature Objects, Armatures, Shapekeys, IPO blocks, Action blocks, Constraint Channels.

There are still a few things that will need corrections before everything works with this; namely, the keyframe summary for Object channels.

Modified Paths:
--------------
    branches/animsys2/source/blender/makesdna/DNA_action_types.h
    branches/animsys2/source/blender/src/drawaction.c
    branches/animsys2/source/blender/src/editaction.c
    branches/animsys2/source/blender/src/header_action.c

Modified: branches/animsys2/source/blender/makesdna/DNA_action_types.h
===================================================================
--- branches/animsys2/source/blender/makesdna/DNA_action_types.h	2008-11-13 02:18:35 UTC (rev 17436)
+++ branches/animsys2/source/blender/makesdna/DNA_action_types.h	2008-11-13 03:44:14 UTC (rev 17437)
@@ -246,11 +246,15 @@
 /* DopeSheet filter-flag */
 typedef enum DOPESHEET_FILTERFLAG {
 		/* general filtering */
-	ADS_FILTER_ONLYSEL	= (1<<0),
+	ADS_FILTER_ONLYSEL			= (1<<0),
 	
 		/* datatype-based filtering */
-	ADS_FILTER_OBONLY	= (1<<10),
-	ADS_FILTER_ARMONLY	= (1<<11),
+	ADS_FILTER_NOOBJ			= (1<<4),
+	ADS_FILTER_NOARM			= (1<<5),
+	ADS_FILTER_NOSHAPEKEYS 		= (1<<6),
+	ADS_FILTER_NOIPOS			= (1<<7),
+	ADS_FILTER_NOACTS			= (1<<8),
+	ADS_FILTER_NOCONSTRAINTS	= (1<<9),
 } DOPESHEET_FILTERFLAG;	
 
 /* DopeSheet general flags */

Modified: branches/animsys2/source/blender/src/drawaction.c
===================================================================
--- branches/animsys2/source/blender/src/drawaction.c	2008-11-13 02:18:35 UTC (rev 17436)
+++ branches/animsys2/source/blender/src/drawaction.c	2008-11-13 03:44:14 UTC (rev 17437)
@@ -1855,6 +1855,8 @@
 {
 	static ActKeysInc aki;
 	
+	// FIXME: include special checks for dopesheet channels here... (dopesheet filtering could be added here too)
+	
 	/* init data of static struct here */
 	if ((curarea->spacetype == SPACE_ACTION) && NLA_ACTION_SCALED &&
 		(G.saction->mode == SACTCONT_ACTION))

Modified: branches/animsys2/source/blender/src/editaction.c
===================================================================
--- branches/animsys2/source/blender/src/editaction.c	2008-11-13 02:18:35 UTC (rev 17436)
+++ branches/animsys2/source/blender/src/editaction.c	2008-11-13 03:44:14 UTC (rev 17437)
@@ -682,7 +682,7 @@
 		return;
 	
 	/* IPO? */
-	if (ob->ipo) {
+	if ((ob->ipo) && !(ads->filterflag & ADS_FILTER_NOIPOS)) {
 		IpoCurve *icu;
 		
 		/* include ipo-expand widget? */
@@ -707,7 +707,7 @@
 	}
 	
 	/* Action? */
-	if (ob->action) {
+	if ((ob->action) && !(ads->filterflag & ADS_FILTER_NOACTS)) {
 		/* include action-expand widget? */
 		if ((filter_mode & ACTFILTER_CHANNELS) && !(filter_mode & (ACTFILTER_IPOKEYS|ACTFILTER_ONLYICU))) {
 			ale= make_new_actlistelem(ob->action, ACTTYPE_FILLACTD, base, ACTTYPE_OBJECT);
@@ -722,7 +722,7 @@
 	}
 	
 	/* ShapeKeys? */
-	if (key) {
+	if ((key) && !(ads->filterflag & ADS_FILTER_NOSHAPEKEYS)) {
 		/* include shapekey-expand widget? */
 		if ((filter_mode & ACTFILTER_CHANNELS) && !(filter_mode & (ACTFILTER_IPOKEYS|ACTFILTER_ONLYICU))) {
 			ale= make_new_actlistelem(key, ACTTYPE_FILLSKED, base, ACTTYPE_OBJECT);
@@ -736,7 +736,7 @@
 	}
 	
 	/* Constraint Channels? */
-	if (ob->constraintChannels.first) {
+	if ((ob->constraintChannels.first) && !(ads->filterflag & ADS_FILTER_NOCONSTRAINTS)) {
 		bConstraintChannel *conchan;
 		
 		/* include constraint-expand widget? */
@@ -807,6 +807,42 @@
 				continue;
 			}
 			
+			/* additionally, dopesheet filtering also affects what objects to consider */
+			if (ads->filterflag) {
+				if ( (ads->filterflag & ADS_FILTER_ONLYSEL) && !((base->flag & SELECT) || (base == sce->basact)) )  {
+					/* only selected should be shown */
+					continue;
+				}
+				if ((ads->filterflag & ADS_FILTER_NOARM) && (ob->type == OB_ARMATURE)) {
+					/* not showing armatures  */
+					continue;
+				}
+				if ((ads->filterflag & ADS_FILTER_NOOBJ) && (ob->type != OB_ARMATURE)) {
+					/* not showing objects that aren't armatures */
+					continue;
+				}
+				if (!(ob->action) && !(ob->constraintChannels.first) && !(key)) {
+					/* this object is only included for it's ipo, but those aren't being shown */
+					if ((ob->ipo) && (ads->filterflag & ADS_FILTER_NOIPOS))
+						continue;
+				}
+				if (!(ob->ipo) && !(ob->constraintChannels.first) && !(key)) {
+					/* this object is only included for it's action, but those aren't being shown */
+					if ((ob->action) && (ads->filterflag & ADS_FILTER_NOACTS))
+						continue;
+				}
+				if (!(ob->ipo) && !(ob->action) && !(key)) {
+					/* this object is only included for it's action, but those aren't being shown */
+					if ((ob->constraintChannels.first) && (ads->filterflag & ADS_FILTER_NOCONSTRAINTS))
+						continue;
+				}
+				if (!(ob->ipo) && !(ob->action) && !(ob->constraintChannels.first)) {
+					/* this object is only included for it's shapekeys, but those aren't being shown */
+					if ((key) && (ads->filterflag & ADS_FILTER_NOSHAPEKEYS))
+						continue;
+				}
+			}
+			
 			/* since we're still here, this object should be usable */
 			actdata_filter_dopesheet_ob(act_data, ads, base, filter_mode);
 		}

Modified: branches/animsys2/source/blender/src/header_action.c
===================================================================
--- branches/animsys2/source/blender/src/header_action.c	2008-11-13 02:18:35 UTC (rev 17436)
+++ branches/animsys2/source/blender/src/header_action.c	2008-11-13 03:44:14 UTC (rev 17437)
@@ -1744,7 +1744,27 @@
 	
 	/* MODE-DEPENDENT DRAWING */
 	if (G.saction->mode == SACTCONT_DOPESHEET) {
-		// TODO: maybe we need pinning/refresh cache at some point, but not yet!
+		/* FILTERING OPTIONS */
+		xco -= 10;
+		
+		//uiBlockBeginAlign(block);
+			uiDefIconButBitI(block, TOG, ADS_FILTER_ONLYSEL, B_REDR, ICON_RESTRICT_SELECT_OFF,	(short)(xco+=XIC),0,XIC,YIC, &(G.saction->ads.filterflag), 0, 0, 0, 0, "Only display selected Objects");
+		//uiBlockEndAlign(block);
+		xco += 5;
+		
+		uiBlockBeginAlign(block);
+			uiDefIconButBitI(block, TOGN, ADS_FILTER_NOOBJ, B_REDR, ICON_OBJECT,	(short)(xco+=XIC),0,XIC,YIC, &(G.saction->ads.filterflag), 0, 0, 0, 0, "Display Non-Armature Objects");
+			uiDefIconButBitI(block, TOGN, ADS_FILTER_NOARM, B_REDR, ICON_ARMATURE,	(short)(xco+=XIC),0,XIC,YIC, &(G.saction->ads.filterflag), 0, 0, 0, 0, "Display Armature Objects");
+			uiDefIconButBitI(block, TOGN, ADS_FILTER_NOSHAPEKEYS, B_REDR, ICON_EDIT,	(short)(xco+=XIC),0,XIC,YIC, &(G.saction->ads.filterflag), 0, 0, 0, 0, "Display ShapeKeys");
+		uiBlockEndAlign(block);
+		xco += 5;
+		
+		uiBlockBeginAlign(block);		
+			uiDefIconButBitI(block, TOGN, ADS_FILTER_NOIPOS, B_REDR, ICON_IPO,	(short)(xco+=XIC),0,XIC,YIC, &(G.saction->ads.filterflag), 0, 0, 0, 0, "Display IPO's");
+			uiDefIconButBitI(block, TOGN, ADS_FILTER_NOACTS, B_REDR, ICON_ACTION,	(short)(xco+=XIC),0,XIC,YIC, &(G.saction->ads.filterflag), 0, 0, 0, 0, "Display Actions");
+			uiDefIconButBitI(block, TOGN, ADS_FILTER_NOCONSTRAINTS, B_REDR, ICON_CONSTRAINT,	(short)(xco+=XIC),0,XIC,YIC, &(G.saction->ads.filterflag), 0, 0, 0, 0, "Display Constraints");
+		uiBlockEndAlign(block);
+		xco += 30;
 	}
 	else if (G.saction->mode == SACTCONT_ACTION) { // not too appropriate for shapekeys atm...
 		/* NAME ETC */
@@ -1761,7 +1781,6 @@
 		xco += 8;
 	}
 	
-	
 	/* COPY PASTE */
 	uiBlockBeginAlign(block);
 	if (curarea->headertype==HEADERTOP) {
@@ -1775,9 +1794,8 @@
 	uiBlockEndAlign(block);
 	xco += (XIC + 8);
 	
-	
+	/* draw AUTOSNAP */
 	if (G.saction->mode != SACTCONT_GPENCIL) {
-		/* draw AUTOSNAP */
 		if (G.saction->flag & SACTION_DRAWTIME) {
 			uiDefButC(block, MENU, B_REDR,
 					"Auto-Snap Keyframes %t|No Snap %x0|Second Step %x1|Nearest Second %x2|Nearest Marker %x3", 





More information about the Bf-blender-cvs mailing list