[Bf-blender-cvs] [e5c306b] master: Code Cleanup: Remove old deprecated NLA channel drawing code

Joshua Leung noreply at git.blender.org
Mon May 5 04:19:00 CEST 2014


Commit: e5c306b101a093521368810202b4c826fecb18a1
Author: Joshua Leung
Date:   Mon May 5 12:49:26 2014 +1200
https://developer.blender.org/rBe5c306b101a093521368810202b4c826fecb18a1

Code Cleanup: Remove old deprecated NLA channel drawing code

===================================================================

M	source/blender/editors/space_nla/nla_draw.c

===================================================================

diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c
index a6f5cf1..9431126 100644
--- a/source/blender/editors/space_nla/nla_draw.c
+++ b/source/blender/editors/space_nla/nla_draw.c
@@ -619,199 +619,6 @@ void draw_nla_main_data(bAnimContext *ac, SpaceNla *snla, ARegion *ar)
 /* *********************************************** */
 /* Channel List */
 
-/* old code for drawing NLA channels using GL only */
-// 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(snla));
-		const float ymaxc = (float)(y + NLACHANNEL_HEIGHT_HALF(snla));
-		const float ydatac = (float)(y - 0.35f * U.widget_unit);
-		
-		/* check if visible */
-		if (IN_RANGE(yminc, v2d->cur.ymin, v2d->cur.ymax) ||
-		    IN_RANGE(ymaxc, v2d->cur.ymin, v2d->cur.ymax) )
-		{
-			AnimData *adt = ale->adt;
-			
-			short indent = 0, offset = 0, sel = 0, group = 0;
-			int special = -1;
-			char name[128];
-			bool do_draw = false;
-			
-			/* determine what needs to be drawn */
-			switch (ale->type) {
-#if 0
-				case ANIMTYPE_NLAACTION: /* NLA Action-Line */
-				{
-					bAction *act = (bAction *)ale->data;
-					
-					group = 5;
-					
-					/* indicate tweaking-action state by changing the icon... */
-					if ((adt) && (adt->flag & ADT_NLA_EDIT_ON))
-						special = ICON_ACTION_TWEAK;
-					else
-						special = ICON_ACTION;
-					
-					BLI_strncpy(name, act ? act->id.name + 2 : "<No Action>", sizeof(name));
-
-					/* draw manually still */
-					do_draw = true;
-					break;
-				}
-#endif
-				default: /* handled by standard channel-drawing API */
-					/* (draw backdrops only...) */
-					ANIM_channel_draw(ac, ale, yminc, ymaxc);
-					break;
-			}
-			
-			/* if special types, draw manually for now... */
-			if (do_draw) {
-				if (ale->id) {
-					/* special exception for textures */
-					if (GS(ale->id->name) == ID_TE) {
-						offset = 0.7f * U.widget_unit;
-						indent = 1;
-					}
-					/* special exception for nodetrees */
-					else if (GS(ale->id->name) == ID_NT) {
-						bNodeTree *ntree = (bNodeTree *)ale->id;
-						
-						switch (ntree->type) {
-							case NTREE_SHADER:
-							{
-								/* same as for textures */
-								offset = 0.7f * U.widget_unit;
-								indent = 1;
-								break;
-							}
-							case NTREE_TEXTURE:
-							{
-								/* even more */
-								offset = U.widget_unit;
-								indent = 1;
-								break;
-							}
-							default:
-								/* normal will do */
-								offset = 0.7f * U.widget_unit;
-								break;
-						}
-					}
-					else {
-						offset = 0.7f * U.widget_unit;
-					}
-				}
-				else {
-					offset = 0;
-				}
-				
-				/* now, start drawing based on this information */
-				glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-				glEnable(GL_BLEND);
-				
-				/* draw backing strip behind channel name */
-				if (group == 5) {
-					float color[4];
-					
-					/* Action Line
-					 *   The alpha values action_get_color returns are only useful for drawing 
-					 *   strips backgrounds but here we're doing channel list backgrounds instead
-					 *   so we ignore that and use our own when needed
-					 */
-					nla_action_get_color(adt, (bAction *)ale->data, color);
-					
-					if (adt && (adt->flag & ADT_NLA_EDIT_ON)) {
-						/* Yes, the color vector has 4 components, BUT we only want to be using 3 of them! */
-						glColor3fv(color);
-					}
-					else {
-						float alpha = (adt && (adt->flag & ADT_NLA_SOLO_TRACK)) ? 0.3f : 1.0f;
-						glColor4f(color[0], color[1], color[2], alpha);
-					}
-					
-					offset += 0.35f * U.widget_unit * indent;
-					
-					/* only on top two corners, to show that this channel sits on top of the preceding ones */
-					uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT);
-					
-					/* draw slightly shifted up vertically to look like it has more separation from other channels,
-					 * but we then need to slightly shorten it so that it doesn't look like it overlaps
-					 */
-					uiDrawBox(GL_POLYGON, x + offset,  yminc + NLACHANNEL_SKIP, (float)v2d->cur.xmax, ymaxc + NLACHANNEL_SKIP - 1, 8);
-					
-					/* clear group value, otherwise we cause errors... */
-					group = 0;
-				}
-				
-				
-				/* draw special icon indicating certain data-types */
-				if (special > -1) {
-					/* for normal channels */
-					UI_icon_draw(x + offset, ydatac, special);
-					offset += 0.85f * U.widget_unit;
-				}
-				glDisable(GL_BLEND);
-				
-				/* draw name */
-				if (sel)
-					UI_ThemeColor(TH_TEXT_HI);
-				else
-					UI_ThemeColor(TH_TEXT);
-				offset += 3;
-				UI_DrawString(x + offset, y - 4, name);
-				
-				/* reset offset - for RHS of panel */
-				offset = 0;
-				
-				/* set blending again, as text drawing may clear it */
-				glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-				glEnable(GL_BLEND);
-				
-				
-				/* draw NLA-action line 'status-icons' - only when there's an action */
-				if ((ale->type == ANIMTYPE_NLAACTION) && (ale->data)) {
-					offset += 0.8f * U.widget_unit;
-					
-					/* now draw some indicator icons  */
-					if ((adt) && (adt->flag & ADT_NLA_EDIT_ON)) {
-						/* toggle for tweaking with mapping/no-mapping (i.e. 'in place editing' toggle) */
-						// for now, use pin icon to symbolise this
-						if (adt->flag & ADT_NLA_EDIT_NOMAP)
-							UI_icon_draw((float)(v2d->cur.xmax - offset), ydatac, ICON_PINNED);
-						else
-							UI_icon_draw((float)(v2d->cur.xmax - offset), ydatac, ICON_UNPINNED);
-					}
-					else {
-						/* XXX firstly draw a little rect to help identify that it's different from the toggles */
-						glBegin(GL_LINE_LOOP);
-						glVertex2f((float)v2d->cur.xmax - offset - 1, y - 0.35f * U.widget_unit);
-						glVertex2f((float)v2d->cur.xmax - offset - 1, y + 0.45f * U.widget_unit);
-						glVertex2f((float)v2d->cur.xmax - 1, y + 0.45f * U.widget_unit);
-						glVertex2f((float)v2d->cur.xmax - 1, y - 0.35f * U.widget_unit);
-						glEnd();
-						
-						/* 'push down' icon for normal active-actions */
-						UI_icon_draw((float)v2d->cur.xmax - offset, ydatac, ICON_NLA_PUSHDOWN);
-					}
-				}
-				
-				glDisable(GL_BLEND);
-			}
-		}
-		
-		/* adjust y-position for next one */
-		y -= NLACHANNEL_STEP(snla);
-	}
-}
-
 void draw_nla_channel_list(bContext *C, bAnimContext *ac, ARegion *ar)
 {
 	ListBase anim_data = {NULL, NULL};




More information about the Bf-blender-cvs mailing list