[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [38134] branches/soc-2011-pepper/source/ blender/editors: NLA Drawing - When "Show Control Curves" option in View menu is

Joshua Leung aligorith at gmail.com
Wed Jul 6 03:34:11 CEST 2011


Revision: 38134
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38134
Author:   aligorith
Date:     2011-07-06 01:34:10 +0000 (Wed, 06 Jul 2011)
Log Message:
-----------
NLA Drawing - When "Show Control Curves" option in View menu is
disabled, the strips are drawn so that they take up less vertical
space.

Originally, the primary reason why these were taller than those in the
other animation editors was really so that these control curves could
be visualised adequately. So, when these aren't shown, we can afford
to collapse the strips vertically.

This should make it possible to fit more strips on screen to retime
them. in some staggered fashion.

Modified Paths:
--------------
    branches/soc-2011-pepper/source/blender/editors/animation/anim_channels_edit.c
    branches/soc-2011-pepper/source/blender/editors/include/ED_anim_api.h
    branches/soc-2011-pepper/source/blender/editors/space_nla/nla_channels.c
    branches/soc-2011-pepper/source/blender/editors/space_nla/nla_draw.c
    branches/soc-2011-pepper/source/blender/editors/space_nla/nla_select.c
    branches/soc-2011-pepper/source/blender/editors/transform/transform_conversions.c
    branches/soc-2011-pepper/source/blender/editors/transform/transform_generics.c

Modified: branches/soc-2011-pepper/source/blender/editors/animation/anim_channels_edit.c
===================================================================
--- branches/soc-2011-pepper/source/blender/editors/animation/anim_channels_edit.c	2011-07-05 23:27:57 UTC (rev 38133)
+++ branches/soc-2011-pepper/source/blender/editors/animation/anim_channels_edit.c	2011-07-06 01:34:10 UTC (rev 38134)
@@ -1825,13 +1825,14 @@
 	bAnimListElem *ale;
 	int filter;
 	
+	SpaceNla *snla = (SpaceNla *)ac->sl;
 	View2D *v2d= &ac->ar->v2d;
 	rctf rectf;
 	float ymin, ymax;
 	
 	/* set initial y extents */
 	if (ac->datatype == ANIMCONT_NLA) {
-		ymin = (float)(-NLACHANNEL_HEIGHT);
+		ymin = (float)(-NLACHANNEL_HEIGHT(snla));
 		ymax = 0.0f;
 	}
 	else {
@@ -1850,7 +1851,7 @@
 	/* loop over data, doing border select */
 	for (ale= anim_data.first; ale; ale= ale->next) {
 		if (ac->datatype == ANIMCONT_NLA)
-			ymin= ymax - NLACHANNEL_STEP;
+			ymin= ymax - NLACHANNEL_STEP(snla);
 		else
 			ymin= ymax - ACHANNEL_STEP;
 		

Modified: branches/soc-2011-pepper/source/blender/editors/include/ED_anim_api.h
===================================================================
--- branches/soc-2011-pepper/source/blender/editors/include/ED_anim_api.h	2011-07-05 23:27:57 UTC (rev 38133)
+++ branches/soc-2011-pepper/source/blender/editors/include/ED_anim_api.h	2011-07-06 01:34:10 UTC (rev 38134)
@@ -299,11 +299,12 @@
 /* -------------- NLA Channel Defines -------------- */
 
 /* NLA channel heights */
-#define NLACHANNEL_FIRST			-16
-#define	NLACHANNEL_HEIGHT			24
-#define NLACHANNEL_HEIGHT_HALF	12
-#define	NLACHANNEL_SKIP			2
-#define NLACHANNEL_STEP			(NLACHANNEL_HEIGHT + NLACHANNEL_SKIP)
+// XXX: NLACHANNEL_FIRST isn't used?
+#define NLACHANNEL_FIRST			    -16
+#define	NLACHANNEL_HEIGHT(snla)	        ((snla && (snla->flag & SNLA_NOSTRIPCURVES)) ? 16 : 24)
+#define NLACHANNEL_HEIGHT_HALF(snla)	((snla && (snla->flag & SNLA_NOSTRIPCURVES)) ?  8 : 12)
+#define	NLACHANNEL_SKIP	                2
+#define NLACHANNEL_STEP(snla)           (NLACHANNEL_HEIGHT(snla) + NLACHANNEL_SKIP)
 
 /* channel widths */
 #define NLACHANNEL_NAMEWIDTH		200

Modified: branches/soc-2011-pepper/source/blender/editors/space_nla/nla_channels.c
===================================================================
--- branches/soc-2011-pepper/source/blender/editors/space_nla/nla_channels.c	2011-07-05 23:27:57 UTC (rev 38133)
+++ branches/soc-2011-pepper/source/blender/editors/space_nla/nla_channels.c	2011-07-06 01:34:10 UTC (rev 38134)
@@ -302,6 +302,7 @@
 static int nlachannels_mouseclick_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
 	bAnimContext ac;
+	SpaceNla *snla;
 	ARegion *ar;
 	View2D *v2d;
 	int channel_index;
@@ -314,6 +315,7 @@
 		return OPERATOR_CANCELLED;
 		
 	/* get useful pointers from animation context data */
+	snla= (SpaceNla *)ac.sl;
 	ar= ac.ar;
 	v2d= &ar->v2d;
 	
@@ -329,7 +331,7 @@
 	 *		NLACHANNEL_HEIGHT_HALF.
 	 */
 	UI_view2d_region_to_view(v2d, event->mval[0], event->mval[1], &x, &y);
-	UI_view2d_listview_view_to_cell(v2d, NLACHANNEL_NAMEWIDTH, NLACHANNEL_STEP, 0, (float)NLACHANNEL_HEIGHT_HALF, x, y, NULL, &channel_index);
+	UI_view2d_listview_view_to_cell(v2d, NLACHANNEL_NAMEWIDTH, NLACHANNEL_STEP(snla), 0, (float)NLACHANNEL_HEIGHT_HALF(snla), x, y, NULL, &channel_index);
 	
 	/* handle mouse-click in the relevant channel then */
 	notifierFlags= mouse_nla_channels(&ac, x, channel_index, selectmode);

Modified: branches/soc-2011-pepper/source/blender/editors/space_nla/nla_draw.c
===================================================================
--- branches/soc-2011-pepper/source/blender/editors/space_nla/nla_draw.c	2011-07-05 23:27:57 UTC (rev 38133)
+++ branches/soc-2011-pepper/source/blender/editors/space_nla/nla_draw.c	2011-07-06 01:34:10 UTC (rev 38134)
@@ -514,18 +514,18 @@
 	 *	- offset of NLACHANNEL_HEIGHT*2 is added to the height of the channels, as first is for 
 	 *	  start of list offset, and the second is as a correction for the scrollers.
 	 */
-	height= ((items*NLACHANNEL_STEP) + (NLACHANNEL_HEIGHT*2));
+	height= ((items*NLACHANNEL_STEP(snla)) + (NLACHANNEL_HEIGHT(snla)*2));
 	/* don't use totrect set, as the width stays the same 
 	 * (NOTE: this is ok here, the configuration is pretty straightforward) 
 	 */
 	v2d->tot.ymin= (float)(-height);
 	
 	/* loop through channels, and set up drawing depending on their type  */	
-	y= (float)(-NLACHANNEL_HEIGHT);
+	y= (float)(-NLACHANNEL_HEIGHT(snla));
 	
 	for (ale= anim_data.first; ale; ale= ale->next) {
-		const float yminc= (float)(y - NLACHANNEL_HEIGHT_HALF);
-		const float ymaxc= (float)(y + NLACHANNEL_HEIGHT_HALF);
+		const float yminc= (float)(y - NLACHANNEL_HEIGHT_HALF(snla));
+		const float ymaxc= (float)(y + NLACHANNEL_HEIGHT_HALF(snla));
 		
 		/* check if visible */
 		if ( IN_RANGE(yminc, v2d->cur.ymin, v2d->cur.ymax) ||
@@ -602,7 +602,7 @@
 		}
 		
 		/* adjust y-position for next one */
-		y -= NLACHANNEL_STEP;
+		y -= NLACHANNEL_STEP(snla);
 	}
 	
 	/* free tempolary channels */
@@ -616,13 +616,14 @@
 // TODO: depreceate this code...
 static void draw_nla_channel_list_gl (bAnimContext *ac, ListBase *anim_data, View2D *v2d, float y)
 {
+	SpaceNla *snla = (SpaceNla *)ac->sl;
 	bAnimListElem *ale;
 	float x = 0.0f;
 	
 	/* loop through channels, and set up drawing depending on their type  */	
 	for (ale= anim_data->first; ale; ale= ale->next) {
-		const float yminc= (float)(y - NLACHANNEL_HEIGHT_HALF);
-		const float ymaxc= (float)(y + NLACHANNEL_HEIGHT_HALF);
+		const float yminc= (float)(y - NLACHANNEL_HEIGHT_HALF(snla));
+		const float ymaxc= (float)(y + NLACHANNEL_HEIGHT_HALF(snla));
 		const float ydatac= (float)(y - 7);
 		
 		/* check if visible */
@@ -644,9 +645,9 @@
 					 *	- need special icons for these
 					 */
 					if (nlt->flag & NLATRACK_SOLO)
-						special= ICON_LAYER_ACTIVE;
+						special= ICON_SPACE2;
 					else
-						special= ICON_LAYER_USED;
+						special= ICON_SPACE3;
 						
 					/* if this track is active and we're tweaking it, don't draw these toggles */
 					// TODO: need a special macro for this...
@@ -867,7 +868,7 @@
 		}
 		
 		/* adjust y-position for next one */
-		y -= NLACHANNEL_STEP;
+		y -= NLACHANNEL_STEP(snla);
 	}
 }
 
@@ -877,6 +878,7 @@
 	bAnimListElem *ale;
 	int filter;
 	
+	SpaceNla *snla = (SpaceNla *)ac->sl;
 	View2D *v2d= &ar->v2d;
 	float y= 0.0f;
 	size_t items;
@@ -892,7 +894,7 @@
 	 *	- offset of NLACHANNEL_HEIGHT*2 is added to the height of the channels, as first is for 
 	 *	  start of list offset, and the second is as a correction for the scrollers.
 	 */
-	height= ((items*NLACHANNEL_STEP) + (NLACHANNEL_HEIGHT*2));
+	height= ((items*NLACHANNEL_STEP(snla)) + (NLACHANNEL_HEIGHT(snla)*2));
 	/* don't use totrect set, as the width stays the same 
 	 * (NOTE: this is ok here, the configuration is pretty straightforward) 
 	 */
@@ -902,14 +904,14 @@
 	
 	/* draw channels */
 	{	/* first pass: backdrops + oldstyle drawing */
-		y= (float)(-NLACHANNEL_HEIGHT);
+		y= (float)(-NLACHANNEL_HEIGHT(snla));
 		
 		draw_nla_channel_list_gl(ac, &anim_data, v2d, y);
 	}
 	{	/* second pass: UI widgets */
 		uiBlock *block= uiBeginBlock(C, ar, "NLA channel buttons", UI_EMBOSS);
 		
-		y= (float)(-NLACHANNEL_HEIGHT);
+		y= (float)(-NLACHANNEL_HEIGHT(snla));
 		
 		/* set blending again, as may not be set in previous step */
 		glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
@@ -917,8 +919,8 @@
 		
 		/* loop through channels, and set up drawing depending on their type  */	
 		for (ale= anim_data.first; ale; ale= ale->next) {
-			const float yminc= (float)(y - NLACHANNEL_HEIGHT_HALF);
-			const float ymaxc= (float)(y + NLACHANNEL_HEIGHT_HALF);
+			const float yminc= (float)(y - NLACHANNEL_HEIGHT_HALF(snla));
+			const float ymaxc= (float)(y + NLACHANNEL_HEIGHT_HALF(snla));
 			
 			/* check if visible */
 			if ( IN_RANGE(yminc, v2d->cur.ymin, v2d->cur.ymax) ||
@@ -929,7 +931,7 @@
 			}
 			
 			/* adjust y-position for next one */
-			y -= NLACHANNEL_STEP;
+			y -= NLACHANNEL_STEP(snla);
 		}
 		
 		uiEndBlock(C, block);

Modified: branches/soc-2011-pepper/source/blender/editors/space_nla/nla_select.c
===================================================================
--- branches/soc-2011-pepper/source/blender/editors/space_nla/nla_select.c	2011-07-05 23:27:57 UTC (rev 38133)
+++ branches/soc-2011-pepper/source/blender/editors/space_nla/nla_select.c	2011-07-06 01:34:10 UTC (rev 38134)
@@ -225,9 +225,10 @@
 	bAnimListElem *ale;
 	int filter;
 	
+	SpaceNla *snla = (SpaceNla *)ac->sl;
 	View2D *v2d= &ac->ar->v2d;
 	rctf rectf;
-	float ymin=(float)(-NLACHANNEL_HEIGHT), ymax=0;
+	float ymin=(float)(-NLACHANNEL_HEIGHT(snla)), ymax=0;
 	
 	/* convert border-region to view coordinates */
 	UI_view2d_region_to_view(v2d, rect.xmin, rect.ymin+2, &rectf.xmin, &rectf.ymin);
@@ -242,7 +243,7 @@
 	
 	/* loop over data, doing border select */
 	for (ale= anim_data.first; ale; ale= ale->next) {
-		ymin= ymax - NLACHANNEL_STEP;
+		ymin= ymax - NLACHANNEL_STEP(snla);
 		
 		/* perform vertical suitability check (if applicable) */
 		if ( (mode == NLA_BORDERSEL_FRAMERANGE) ||
@@ -505,6 +506,7 @@
 	bAnimListElem *ale = NULL;
 	int filter;
 	
+	SpaceNla *snla = (SpaceNla *)ac->sl;
 	View2D *v2d= &ac->ar->v2d;
 	Scene *scene= ac->scene;
 	NlaStrip *strip = NULL;
@@ -515,7 +517,7 @@
 	
 	/* use View2D to determine the index of the channel (i.e a row in the list) where keyframe was */
 	UI_view2d_region_to_view(v2d, mval[0], mval[1], &x, &y);
-	UI_view2d_listview_view_to_cell(v2d, 0, NLACHANNEL_STEP, 0, (float)NLACHANNEL_HEIGHT_HALF, x, y, NULL, &channel_index);
+	UI_view2d_listview_view_to_cell(v2d, 0, NLACHANNEL_STEP(snla), 0, (float)NLACHANNEL_HEIGHT_HALF(snla), x, y, NULL, &channel_index);
 	
 	/* x-range to check is +/- 7 (in screen/region-space) on either side of mouse click 
 	 * (that is the size of keyframe icons, so user should be expecting similar tolerances) 

Modified: branches/soc-2011-pepper/source/blender/editors/transform/transform_conversions.c
===================================================================
--- branches/soc-2011-pepper/source/blender/editors/transform/transform_conversions.c	2011-07-05 23:27:57 UTC (rev 38133)
+++ branches/soc-2011-pepper/source/blender/editors/transform/transform_conversions.c	2011-07-06 01:34:10 UTC (rev 38134)
@@ -2479,6 +2479,7 @@
 static void createTransNlaData(bContext *C, TransInfo *t)
 {
 	Scene *scene= t->scene;
+	SpaceNla *snla = NULL;
 	TransData *td = NULL;

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list