[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [17578] branches/animsys2/source/blender: AnimSys2: Dopesheet now handles NLA-Scaling

Joshua Leung aligorith at gmail.com
Wed Nov 26 07:14:41 CET 2008


Revision: 17578
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=17578
Author:   aligorith
Date:     2008-11-26 07:14:41 +0100 (Wed, 26 Nov 2008)

Log Message:
-----------
AnimSys2: Dopesheet now handles NLA-Scaling

* Added support for NLA scaling throughout most of the Dopesheet functions, although for a few it is still difficult to achieve. (Notably in column-select tools, but also Time-Slide tool)
--> 'Object' summaries still need some corrections to get the 'action' summaries they include to be scaled too...
* Improved the NLA-Editor's display of keyframes from scaled actions

-- 

* Also, bumped up subversion number to 3, as a few defaults were changed:
- Dopesheet is now default view (instead of Action Editor). I may review this again later, but it seems OK.
- Turned on transform-autosnapping for Action/IPO/NLA Editors by default and also for old files
- Tweaked Grease Pencil sensitivity settings again... they were still too crude, as could be seen from trouble people often had when making demo vids. 

Modified Paths:
--------------
    branches/animsys2/source/blender/blenkernel/BKE_blender.h
    branches/animsys2/source/blender/blenloader/intern/readfile.c
    branches/animsys2/source/blender/include/BDR_drawaction.h
    branches/animsys2/source/blender/include/BIF_editaction.h
    branches/animsys2/source/blender/makesdna/DNA_action_types.h
    branches/animsys2/source/blender/src/drawaction.c
    branches/animsys2/source/blender/src/drawnla.c
    branches/animsys2/source/blender/src/editaction.c
    branches/animsys2/source/blender/src/editipo.c
    branches/animsys2/source/blender/src/editipo_mods.c
    branches/animsys2/source/blender/src/header_action.c
    branches/animsys2/source/blender/src/meshtools.c
    branches/animsys2/source/blender/src/space.c
    branches/animsys2/source/blender/src/transform_conversions.c
    branches/animsys2/source/blender/src/usiblender.c

Modified: branches/animsys2/source/blender/blenkernel/BKE_blender.h
===================================================================
--- branches/animsys2/source/blender/blenkernel/BKE_blender.h	2008-11-26 00:47:38 UTC (rev 17577)
+++ branches/animsys2/source/blender/blenkernel/BKE_blender.h	2008-11-26 06:14:41 UTC (rev 17578)
@@ -41,7 +41,7 @@
 struct MemFile;
 
 #define BLENDER_VERSION			248
-#define BLENDER_SUBVERSION		2
+#define BLENDER_SUBVERSION		3
 
 #define BLENDER_MINVERSION		245
 #define BLENDER_MINSUBVERSION	15

Modified: branches/animsys2/source/blender/blenloader/intern/readfile.c
===================================================================
--- branches/animsys2/source/blender/blenloader/intern/readfile.c	2008-11-26 00:47:38 UTC (rev 17577)
+++ branches/animsys2/source/blender/blenloader/intern/readfile.c	2008-11-26 06:14:41 UTC (rev 17578)
@@ -7988,6 +7988,42 @@
 				set_interpolation_ipocurve(icu, icu->ipo);
 		}
 	}
+	if (main->versionfile < 248 || (main->versionfile == 248 && main->subversionfile < 3)) {
+		bScreen *sc;
+		
+		/* adjust default settings for Animation Editors */
+		for (sc= main->screen.first; sc; sc= sc->id.next) {
+			ScrArea *sa;
+			
+			for (sa= sc->areabase.first; sa; sa= sa->next) { 
+				SpaceLink *sl;
+				
+				for (sl= sa->spacedata.first; sl; sl= sl->next) {
+					switch (sl->spacetype) {
+						case SPACE_ACTION:
+						{
+							SpaceAction *sact= (SpaceAction *)sl;
+							sact->mode= SACTCONT_DOPESHEET;
+							sact->autosnap= SACTSNAP_FRAME;
+						}
+							break;
+						case SPACE_IPO:
+						{
+							SpaceIpo *sipo= (SpaceIpo *)sl;
+							sipo->autosnap= SACTSNAP_FRAME;
+						}
+							break;
+						case SPACE_NLA:
+						{
+							SpaceNla *snla= (SpaceNla *)sl;
+							snla->autosnap= SACTSNAP_FRAME;
+						}
+							break;
+					}
+				}
+			}
+		}
+	}
 	
 	/* WATCH IT!!!: pointers from libdata have not been converted yet here! */
 	/* WATCH IT 2!: Userdef struct init has to be in src/usiblender.c! */

Modified: branches/animsys2/source/blender/include/BDR_drawaction.h
===================================================================
--- branches/animsys2/source/blender/include/BDR_drawaction.h	2008-11-26 00:47:38 UTC (rev 17577)
+++ branches/animsys2/source/blender/include/BDR_drawaction.h	2008-11-26 06:14:41 UTC (rev 17578)
@@ -36,6 +36,7 @@
 struct gla2DDrawInfo;
 struct bAction;
 struct bActionGroup;
+struct bActListElem;
 struct Object;
 struct ListBase;
 struct bGPDlayer;
@@ -68,7 +69,10 @@
 
 /* Inclusion-Range Limiting Struct (optional) */
 typedef struct ActKeysInc {
-	struct Object *ob;				/* if present, used to find action-scaled time */
+	struct bDopeSheet *ads;			/* dopesheet data (for dopesheet mode) */
+	struct Object *ob;				/* owner object for NLA-scaling info (if Object channels, is just Object) */
+	short actmode;					/* mode of the Action Editor (-1 is for NLA) */
+	
 	float start, end;				/* frames (global-time) to only consider keys between */
 } ActKeysInc;
 
@@ -79,12 +83,12 @@
 void draw_cfra_action(void);
 
 /* Channel Drawing */
-void draw_icu_channel(struct gla2DDrawInfo *di, struct IpoCurve *icu, float ypos);
-void draw_ipo_channel(struct gla2DDrawInfo *di, struct Ipo *ipo, float ypos);
-void draw_agroup_channel(struct gla2DDrawInfo *di, struct bActionGroup *agrp, float ypos);
-void draw_action_channel(struct gla2DDrawInfo *di, struct bAction *act, float ypos);
-void draw_object_channel(struct gla2DDrawInfo *di, struct Object *ob, float ypos);
-void draw_gpl_channel(struct gla2DDrawInfo *di, struct bGPDlayer *gpl, float ypos);
+void draw_icu_channel(struct gla2DDrawInfo *di, ActKeysInc *aki, struct IpoCurve *icu, float ypos);
+void draw_ipo_channel(struct gla2DDrawInfo *di, ActKeysInc *aki, struct Ipo *ipo, float ypos);
+void draw_agroup_channel(struct gla2DDrawInfo *di, ActKeysInc *aki, struct bActionGroup *agrp, float ypos);
+void draw_action_channel(struct gla2DDrawInfo *di, ActKeysInc *aki, struct bAction *act, float ypos);
+void draw_object_channel(struct gla2DDrawInfo *di, ActKeysInc *aki, struct Object *ob, float ypos);
+void draw_gpl_channel(struct gla2DDrawInfo *di, ActKeysInc *aki, struct bGPDlayer *gpl, float ypos);
 
 /* Keydata Generation */
 void icu_to_keylist(struct IpoCurve *icu, ListBase *keys, ListBase *blocks, ActKeysInc *aki);

Modified: branches/animsys2/source/blender/include/BIF_editaction.h
===================================================================
--- branches/animsys2/source/blender/include/BIF_editaction.h	2008-11-26 00:47:38 UTC (rev 17577)
+++ branches/animsys2/source/blender/include/BIF_editaction.h	2008-11-26 06:14:41 UTC (rev 17578)
@@ -113,6 +113,7 @@
 
 
 #define NLA_ACTION_SCALED (G.saction->mode==SACTCONT_ACTION && G.saction->pin==0 && OBACT && OBACT->action)
+#define NLA_CHAN_SCALED(ale) ( NLA_ACTION_SCALED || (G.saction->mode==SACTCONT_DOPESHEET && ale && ale->id && GS(ale->id->name)==ID_OB && ((Object *)ale->id)->action) )
 #define NLA_IPO_SCALED (OBACT && OBACT->action && G.sipo && G.sipo->pin==0 && G.sipo->actname)
 
 /* constants for setting ipo-interpolation type */

Modified: branches/animsys2/source/blender/makesdna/DNA_action_types.h
===================================================================
--- branches/animsys2/source/blender/makesdna/DNA_action_types.h	2008-11-26 00:47:38 UTC (rev 17577)
+++ branches/animsys2/source/blender/makesdna/DNA_action_types.h	2008-11-26 06:14:41 UTC (rev 17578)
@@ -258,7 +258,11 @@
 	ADS_FILTER_NOCAM			= (1<<10),
 	ADS_FILTER_NOMAT			= (1<<11),
 	ADS_FILTER_NOLAM			= (1<<12),
-	ADS_FILTER_NOCUR			= (1<<14),
+	ADS_FILTER_NOCUR			= (1<<13),
+	
+		/* combination filters (some only used at runtime) */
+	ADS_FILTER_NOOBDATA = (ADS_FILTER_NOCAM|ADS_FILTER_NOMAT|ADS_FILTER_NOLAM|ADS_FILTER_NOCUR),
+	ADS_FILTER_NLADUMMY = (ADS_FILTER_NOACTS|ADS_FILTER_NOSHAPEKEYS|ADS_FILTER_NOOBDATA),
 } DOPESHEET_FILTERFLAG;	
 
 /* DopeSheet general flags */

Modified: branches/animsys2/source/blender/src/drawaction.c
===================================================================
--- branches/animsys2/source/blender/src/drawaction.c	2008-11-26 00:47:38 UTC (rev 17577)
+++ branches/animsys2/source/blender/src/drawaction.c	2008-11-26 06:14:41 UTC (rev 17578)
@@ -67,6 +67,7 @@
 #include "BKE_depsgraph.h"
 #include "BKE_ipo.h"
 #include "BKE_key.h"
+#include "BKE_material.h"
 #include "BKE_object.h"
 #include "BKE_global.h"
 #include "BKE_utildefines.h"
@@ -1169,12 +1170,13 @@
     myortho2(0,	NAMEWIDTH, 0, (float)(ofsy+G.v2d->mask.ymax) - (ofsy+G.v2d->mask.ymin));	//	Scaling
 }
 
-/* sets or clears hidden flags */
+/* sets or clears hidden flags - for actionchannels only */
 void check_action_context(SpaceAction *saction)
 {
 	bActionChannel *achan;
 	
-	if (saction->action==NULL) return;
+	if (saction->mode != SACTCONT_ACTION) return;
+	if (saction->action == NULL) return;
 	
 	for (achan=saction->action->chanbase.first; achan; achan=achan->next)
 		achan->flag &= ~ACHAN_HIDDEN;
@@ -1196,6 +1198,42 @@
 	}
 }
 
+static ActKeysInc *init_aki_data(void *data, short datatype, bActListElem *ale)
+{
+	static ActKeysInc aki;
+	
+	/* no need to set settings if wrong context */
+	if ((data == NULL) || ELEM(datatype, ACTCONT_ACTION, ACTCONT_DOPESHEET)==0)
+		return NULL;
+	
+	/* if strip is mapped, store settings */
+	if (NLA_CHAN_SCALED(ale)) {
+		/* NLA_CHAN_SCALED checks the standard scaling check (for Action Mode), 
+		 * as well as making sure that channel has Object ID-owner 
+		 */
+		if (datatype == ACTCONT_DOPESHEET)
+			aki.ob= (Object *)ale->id; // is more filtering on this needed?
+		else if (datatype == ACTCONT_ACTION)
+			aki.ob= OBACT;
+	}
+	else {
+		aki.ob= NULL;
+	}
+	
+	if (datatype == ACTCONT_DOPESHEET)
+		aki.ads= (bDopeSheet *)data;
+	else
+		aki.ads= NULL;
+	aki.actmode= datatype;
+	
+	/* set start/end frames to use for time-based keyframe culling hacks... */
+	// FIXME: this needs to be a bit better defined...
+	aki.start= G.v2d->cur.xmin - 10;
+	aki.end= G.v2d->cur.xmax + 10;
+	
+	return &aki;
+}
+
 static void draw_channel_strips(void)
 {
 	ListBase act_data = {NULL, NULL};
@@ -1299,24 +1337,38 @@
 			if (ELEM(datatype, ACTCONT_ACTION, ACTCONT_DOPESHEET)) {
 				gla2DDrawTranslatePt(di, G.v2d->cur.xmin, y, &frame1_x, &channel_y);
 				
-				if (ale->type == ACTTYPE_OBJECT) {
-					// FIXME... how do we differentiate between the two modes?
-					if (sel) glColor4ub(col1b[0], col1b[1], col1b[2], 0x45); 
-					else glColor4ub(col1b[0], col1b[1], col1b[2], 0x22); 
+				switch (ale->type) {
+					case ACTTYPE_OBJECT:
+					{
+						if (sel) glColor4ub(col1b[0], col1b[1], col1b[2], 0x45); 
+						else glColor4ub(col1b[0], col1b[1], col1b[2], 0x22); 
+					}
+						break;
+						
+					case ACTTYPE_FILLIPOD:
+					case ACTTYPE_FILLACTD:
+					case ACTTYPE_FILLCOND:
+					case ACTTYPE_DSSKEY:
+					{
+						if (sel) glColor4ub(col2b[0], col2b[1], col2b[2], 0x45); 
+						else glColor4ub(col2b[0], col2b[1], col2b[2], 0x22); 
+					}
+						break;
+					
+					case ALE_GROUP:
+					{
+						if (sel) glColor4ub(col1a[0], col1a[1], col1a[2], 0x22);
+						else glColor4ub(col2a[0], col2a[1], col2a[2], 0x22);
+					}
+						break;
+					
+					default:
+					{
+						if (sel) glColor4ub(col1[0], col1[1], col1[2], 0x22);
+						else glColor4ub(col2[0], col2[1], col2[2], 0x22);
+					}
+						break;
 				}
-				else if (ELEM4(ale->type, ACTTYPE_FILLIPOD, ACTTYPE_FILLACTD, ACTTYPE_FILLCOND, ACTTYPE_DSSKEY)) {
-					// FIXME... how do we differentiate between the two modes?
-					if (sel) glColor4ub(col2b[0], col2b[1], col2b[2], 0x45); 
-					else glColor4ub(col2b[0], col2b[1], col2b[2], 0x22); 
-				}
-				else if (ale->datatype == ALE_GROUP) {
-					if (sel) glColor4ub(col1a[0], col1a[1], col1a[2], 0x22);
-					else glColor4ub(col2a[0], col2a[1], col2a[2], 0x22);
-				}
-				else {
-					if (sel) glColor4ub(col1[0], col1[1], col1[2], 0x22);
-					else glColor4ub(col2[0], col2[1], col2[2], 0x22);
-				}
 				
 				/* draw region twice: firstly backdrop, then the current range */
 				glRectf((float)frame1_x,  (float)channel_y-CHANNELHEIGHT/2,  (float)G.v2d->hor.xmax,  (float)channel_y+CHANNELHEIGHT/2);
@@ -1357,9 +1409,6 @@
 	}		
 	glDisable(GL_BLEND);
 	
-	if (NLA_ACTION_SCALED)
-		map_active_strip(di, OBACT, 0);
-	
 	/* Draw keyframes 
 	 *	1) Only channels that are visible in the Action Editor get drawn/evaluated.
 	 *	   This is to try to optimise this for heavier data sets
@@ -1374,25 +1423,41 @@

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list