[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [17347] branches/animsys2/source/blender: AnimSys2: Initial commit of DopeSheet

Joshua Leung aligorith at gmail.com
Thu Nov 6 12:05:54 CET 2008


Revision: 17347
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=17347
Author:   aligorith
Date:     2008-11-06 12:05:54 +0100 (Thu, 06 Nov 2008)

Log Message:
-----------
AnimSys2: Initial commit of DopeSheet

This commit introduces the 'DopeSheet' mode in the Action Editor. It shows the animation data of multiple objects divided into the relevant categories (IPO, Action, Constraints), and allows the editing of that animation data. 

A picture says a thousand words:
http://aligorith.googlepages.com/dopesheet_03.png

Most parts of this new editor should work OK, however, there are some tools (most notably channel-related ones) that still require attention before they are usable here. Also, please be aware that there may still be many bugs in this which I have not yet unconvered during testing.

Additional Notes - Further work:
* Although this may sound very similar to what the NLA Editor currently does, it is necessary as the NLA Editor doesn't show the animation data in sufficient detail (and with fewer and less well maintained tools) as that's not what it was meant to do. In the not-too-distant future, the NLA Editor will be refreshed to refocus on its core purpose, so this functionality needs to be moved here first.

* Currently, colour of Object/Sub-object channels are hardcoded defaults which will be turned into themeable colours soon.

* Keyframe 'Summaries' for Object/Sub-object channels should probably get a different coloured backdrop (like for groups) to help indicate the difference between them and standard channels 

* Sub-object channels are currently collapsed by default. Feedback would be welcome as to whether these should be unfolded instead.

Modified Paths:
--------------
    branches/animsys2/source/blender/blenloader/intern/readfile.c
    branches/animsys2/source/blender/include/BIF_editaction.h
    branches/animsys2/source/blender/include/BSE_editaction_types.h
    branches/animsys2/source/blender/makesdna/DNA_action_types.h
    branches/animsys2/source/blender/makesdna/DNA_object_types.h
    branches/animsys2/source/blender/src/drawaction.c
    branches/animsys2/source/blender/src/editaction.c
    branches/animsys2/source/blender/src/editarmature.c
    branches/animsys2/source/blender/src/header_action.c
    branches/animsys2/source/blender/src/headerbuttons.c
    branches/animsys2/source/blender/src/outliner.c

Modified: branches/animsys2/source/blender/blenloader/intern/readfile.c
===================================================================
--- branches/animsys2/source/blender/blenloader/intern/readfile.c	2008-11-06 08:01:11 UTC (rev 17346)
+++ branches/animsys2/source/blender/blenloader/intern/readfile.c	2008-11-06 11:05:54 UTC (rev 17347)
@@ -3851,6 +3851,7 @@
 					else if(sl->spacetype==SPACE_ACTION) {
 						SpaceAction *saction= (SpaceAction *)sl;
 						saction->action = newlibadr(fd, sc->id.lib, saction->action);
+						saction->ads.source= newlibadr(fd, sc->id.lib, saction->ads.source);
 					}
 					else if(sl->spacetype==SPACE_IMAGE) {
 						SpaceImage *sima= (SpaceImage *)sl;

Modified: branches/animsys2/source/blender/include/BIF_editaction.h
===================================================================
--- branches/animsys2/source/blender/include/BIF_editaction.h	2008-11-06 08:01:11 UTC (rev 17346)
+++ branches/animsys2/source/blender/include/BIF_editaction.h	2008-11-06 11:05:54 UTC (rev 17347)
@@ -33,28 +33,47 @@
 /* some interface related sizes*/
 #define	CHANNELHEIGHT	16
 #define	CHANNELSKIP		2
-#define NAMEWIDTH      	164
+#define NAMEWIDTH      	( ((G.saction) && (G.saction->mode==SACTCONT_DOPESHEET))? (188): (164) )
 #define SLIDERWIDTH    	125
 #define ACTWIDTH 		(G.saction->actwidth)
 
-/* Some types for easier type-testing */
+/* Some types for easier type-testing 
+ *	Note: unlike other enums, this is flexible as it 
+ */
 enum {
 	ACTTYPE_NONE= 0,
+	ACTTYPE_SPECIALDATA,
+	
+	ACTTYPE_OBJECT,
 	ACTTYPE_GROUP,
+	
+	ACTTYPE_FILLIPO,
+	ACTTYPE_FILLCON,
+	
+	ACTTYPE_FILLACTD,
+	ACTTYPE_FILLIPOD,
+	ACTTYPE_FILLCOND,
+	
 	ACTTYPE_ACHAN,
 	ACTTYPE_CONCHAN,
 	ACTTYPE_CONCHAN2,
 	ACTTYPE_ICU,
-	ACTTYPE_FILLIPO,
-	ACTTYPE_FILLCON,
 	ACTTYPE_IPO,
+	
 	ACTTYPE_SHAPEKEY,
 	ACTTYPE_GPDATABLOCK,
 	ACTTYPE_GPLAYER,
-	ACTTYPE_SPECIALDATA
 };
 
 /* Macros for easier/more consistant state testing */
+#define SEL_OBJC(base) ((base->flag & SELECT))
+#define EXPANDED_OBJC(ob) ((ob->nlaflag & OB_ADS_COLLAPSED)==0)
+#define FILTER_IPO_OBJC(ob) ((ob->nlaflag & OB_ADS_SHOWIPO))
+#define FILTER_CON_OBJC(ob) ((ob->nlaflag & OB_ADS_SHOWCONS)) 
+#define SEL_ACTC(actc) ((actc->flag & ACTC_SELECTED))
+#define EXPANDED_ACTC(actc) ((actc->flag & ACTC_EXPANDED))
+
+
 #define EDITABLE_AGRP(agrp) ((agrp->flag & AGRP_PROTECTED)==0)
 #define EXPANDED_AGRP(agrp) (agrp->flag & AGRP_EXPANDED)
 #define SEL_AGRP(agrp) ((agrp->flag & AGRP_SELECTED) || (agrp->flag & AGRP_ACTIVE))
@@ -77,6 +96,7 @@
 #define EDITABLE_GPL(gpl) ((gpl->flag & GP_LAYER_LOCKED)==0)
 #define SEL_GPL(gpl) ((gpl->flag & GP_LAYER_ACTIVE) || (gpl->flag & GP_LAYER_SELECT))
 
+
 #define NLA_ACTION_SCALED (G.saction->mode==SACTCONT_ACTION && G.saction->pin==0 && OBACT && OBACT->action)
 #define NLA_IPO_SCALED (OBACT && OBACT->action && G.sipo && G.sipo->pin==0 && G.sipo->actname)
 
@@ -174,7 +194,7 @@
 void borderselect_actionchannels(void);
 void deselect_action_keys(short test, short sel);
 void deselect_action_channels(short mode);
-void deselect_actionchannels(struct bAction *act, short mode);
+void deselect_actionchannels(void *data, short datatype, short mode);
 int select_channel(struct bAction *act, struct bActionChannel *achan, int selectmode);
 void select_actionchannel_by_name(struct bAction *act, char *name, int select);
 void select_action_group_channels(struct bAction *act, struct bActionGroup *agrp);

Modified: branches/animsys2/source/blender/include/BSE_editaction_types.h
===================================================================
--- branches/animsys2/source/blender/include/BSE_editaction_types.h	2008-11-06 08:01:11 UTC (rev 17346)
+++ branches/animsys2/source/blender/include/BSE_editaction_types.h	2008-11-06 11:05:54 UTC (rev 17347)
@@ -38,6 +38,8 @@
 	ALE_NONE = 0,
 	ALE_IPO,	
 	ALE_ICU,
+	ALE_OB,
+	ALE_ACT,
 	ALE_GROUP,
 	ALE_GPFRAME,
 } ALE_KEYTYPE;
@@ -54,6 +56,7 @@
 	void	*key_data;	/* motion data - ipo or ipo-curve */
 	short	datatype;	/* type of motion data to expect */
 	
+	struct ID *id;				/* ID block (ID_SC, ID_SCE, or ID_OB) that owns the channel */
 	struct bActionGroup *grp;	/* action group that owns the channel */
 	
 	void 	*owner;		/* will either be an action channel or fake ipo-channel (for keys) */
@@ -80,7 +83,8 @@
 	ACTCONT_NONE = 0,
 	ACTCONT_ACTION,
 	ACTCONT_SHAPEKEY,
-	ACTCONT_GPENCIL
+	ACTCONT_GPENCIL,
+	ACTCONT_DOPESHEET
 } ACTCONT_TYPES;
 
 #endif

Modified: branches/animsys2/source/blender/makesdna/DNA_action_types.h
===================================================================
--- branches/animsys2/source/blender/makesdna/DNA_action_types.h	2008-11-06 08:01:11 UTC (rev 17346)
+++ branches/animsys2/source/blender/makesdna/DNA_action_types.h	2008-11-06 11:05:54 UTC (rev 17347)
@@ -171,12 +171,21 @@
 	ListBase 		markers;	/* TimeMarkers local to this Action for labelling 'poses' */
 	
 	int active_marker;			/* Index of active-marker (first marker = 1) */
-	int pad;
+	int flag;					/* flags for this action */
 } bAction;
 
 
 /* ------------- Action Editor --------------------- */
 
+/* Storage for Dopesheet/Grease-Pencil Editor data */
+typedef struct bDopeSheet {
+	ID 		*source;		/* currently ID_SCE (for Dopesheet), and ID_SC (for Grease Pencil) */
+	ListBase chanbase;		/* cache for channels (only initialised when pinned) */
+	
+	int filterflag;			/* flags to use for filtering data */
+	int flag;				/* standard flags */
+} bDopeSheet;
+
 /* Action Editor Space. This is defined here instead of in DNA_space_types.h */
 typedef struct SpaceAction {
 	struct SpaceLink *next, *prev;
@@ -189,6 +198,7 @@
 	View2D v2d;	
 	
 	bAction		*action;		/* the currently active action */
+	bDopeSheet 	ads;			/* the currently active context (when not showing action) */
 	
 	char  mode, autosnap;		/* mode: editing context; autosnap: automatic keyframe snapping mode   */
 	short flag, actnr; 			/* flag: bitmapped settings; */
@@ -224,6 +234,30 @@
 	AGRP_MOVED 		= (1<<31)
 } AGRP_FLAG;
 
+
+/* 'Action' Channel flags */
+typedef enum ACT_FLAG {
+	ACTC_SELECTED	= (1<<0),
+	ACTC_EXPANDED	= (1<<1),
+} ACT_FLAG;
+
+/* ------------ DopeSheet Flags ------------------ */
+
+/* DopeSheet filter-flag */
+typedef enum DOPESHEET_FILTERFLAG {
+		/* general filtering */
+	ADS_FILTER_ONLYSEL	= (1<<0),
+	
+		/* datatype-based filtering */
+	ADS_FILTER_OBONLY	= (1<<10),
+	ADS_FILTER_ARMONLY	= (1<<11),
+} DOPESHEET_FILTERFLAG;	
+
+/* DopeSheet general flags */
+//typedef enum DOPESHEET_FLAG {
+	
+//} DOPESHEET_FLAG;
+
 /* ------------ Action Editor Flags -------------- */
 
 /* SpaceAction flag */
@@ -254,7 +288,7 @@
 	SACTCONT_SHAPEKEY,
 		/* editing of gpencil data */
 	SACTCONT_GPENCIL,
-		/* dopesheet (unimplemented... future idea?) */
+		/* dopesheet */
 	SACTCONT_DOPESHEET
 } SACTCONTEXT_MODES;
 

Modified: branches/animsys2/source/blender/makesdna/DNA_object_types.h
===================================================================
--- branches/animsys2/source/blender/makesdna/DNA_object_types.h	2008-11-06 08:01:11 UTC (rev 17346)
+++ branches/animsys2/source/blender/makesdna/DNA_object_types.h	2008-11-06 11:05:54 UTC (rev 17347)
@@ -474,9 +474,13 @@
 #define OB_SHAPE_TEMPLOCK	2
 
 /* ob->nlaflag */
-#define OB_NLA_OVERRIDE		1
-#define OB_NLA_COLLAPSED	2
+#define OB_NLA_OVERRIDE		(1<<0)
+#define OB_NLA_COLLAPSED	(1<<1)
 
+#define OB_ADS_COLLAPSED	(1<<10)
+#define OB_ADS_SHOWIPO		(1<<11)
+#define OB_ADS_SHOWCONS		(1<<12)
+
 /* ob->protectflag */
 #define OB_LOCK_LOCX	1
 #define OB_LOCK_LOCY	2

Modified: branches/animsys2/source/blender/src/drawaction.c
===================================================================
--- branches/animsys2/source/blender/src/drawaction.c	2008-11-06 08:01:11 UTC (rev 17346)
+++ branches/animsys2/source/blender/src/drawaction.c	2008-11-06 11:05:54 UTC (rev 17347)
@@ -467,12 +467,89 @@
 			 IN_RANGE(ymaxc, G.v2d->cur.ymin, G.v2d->cur.ymax) ) 
 		{
 			bActionGroup *grp = NULL;
-			short indent= 0, offset= 0, sel= 0, group=0;
+			short indent= 0, offset= 0, sel= 0, group= 0;
 			int expand= -1, protect = -1, special= -1, mute = -1;
 			char name[64];
 			
 			/* determine what needs to be drawn */
 			switch (ale->type) {
+				case ACTTYPE_OBJECT: /* object */
+				{
+					Base *base= (Base *)ale->data;
+					Object *ob= base->object;
+					
+					group= 4;
+					indent= 0;
+					
+					/* icon depends on object-type */
+					if (ob->type == OB_ARMATURE)
+						special= ICON_ARMATURE;
+					else	
+						special= ICON_OBJECT;
+						
+					/* only show expand if there are any channels */
+					if (EXPANDED_OBJC(ob))
+						expand= ICON_TRIA_DOWN;
+					else
+						expand= ICON_TRIA_RIGHT;
+					
+					sel = SEL_OBJC(base);
+					sprintf(name, ob->id.name+2);
+				}
+					break;
+				case ACTTYPE_FILLACTD: /* action widget */
+				{
+					bAction *act= (bAction *)ale->data;
+					
+					group = 4;
+					indent= 1;
+					special= ICON_ACTION;
+					
+					if (EXPANDED_ACTC(act))
+						expand= ICON_TRIA_DOWN;
+					else
+						expand= ICON_TRIA_RIGHT;
+					
+					sel = SEL_ACTC(act);
+					sprintf(name, "Action");
+				}
+					break;
+				case ACTTYPE_FILLIPOD: /* ipo (dopesheet) expand widget */
+				{
+					Object *ob = (Object *)ale->data;
+					
+					group = 4;
+					indent = 1;
+					special = ICON_IPO;
+					
+					if (FILTER_IPO_OBJC(ob))	
+						expand = ICON_TRIA_DOWN;
+					else
+						expand = ICON_TRIA_RIGHT;
+					
+					//sel = SEL_OBJC(base);
+					sprintf(name, "IPO Curves");
+				}
+					break;
+				case ACTTYPE_FILLCOND: /* constraint channels (dopesheet) expand widget */
+				{
+					Object *ob = (Object *)ale->data;
+					
+					group = 4;
+					indent = 1;
+					special = ICON_CONSTRAINT;
+					
+					if (FILTER_CON_OBJC(ob))	
+						expand = ICON_TRIA_DOWN;
+					else
+						expand = ICON_TRIA_RIGHT;
+						
+					//sel = SEL_OBJC(base);
+					sprintf(name, "Constraints");
+				}
+					break;
+					
+				
 				case ACTTYPE_GROUP: /* action group */
 				{
 					bActionGroup *agrp= (bActionGroup *)ale->data;
@@ -481,6 +558,8 @@
 					indent= 0;
 					special= -1;
 					
+					offset= (ale->id) ? 21 : 0;
+					
 					/* only show expand if there are any channels */
 					if (agrp->channels.first) {
 						if (EXPANDED_AGRP(agrp))
@@ -488,7 +567,7 @@
 						else
 							expand = ICON_TRIA_RIGHT;
 					}
-						
+					
 					if (EDITABLE_AGRP(agrp))
 						protect = ICON_UNLOCKED;
 					else
@@ -508,6 +587,8 @@
 					indent = 0;
 					special = -1;
 					
+					offset= (ale->id) ? 21 : 0;
+					
 					if (EXPANDED_ACHAN(achan))

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list