[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [38104] branches/soc-2011-pepper/source/ blender/editors/space_nla/nla_draw.c: Reduce duplicate code

Joshua Leung aligorith at gmail.com
Tue Jul 5 03:55:05 CEST 2011


Revision: 38104
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38104
Author:   aligorith
Date:     2011-07-05 01:55:03 +0000 (Tue, 05 Jul 2011)
Log Message:
-----------
Reduce duplicate code

Modified Paths:
--------------
    branches/soc-2011-pepper/source/blender/editors/space_nla/nla_draw.c

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 01:54:01 UTC (rev 38103)
+++ branches/soc-2011-pepper/source/blender/editors/space_nla/nla_draw.c	2011-07-05 01:55:03 UTC (rev 38104)
@@ -640,47 +640,6 @@
 				{
 					NlaTrack *nlt= (NlaTrack *)ale->data;
 					
-					indent= 0;
-					
-					if (ale->id) {
-						/* special exception for textures */
-						if (GS(ale->id->name) == ID_TE) {
-							offset= 14;
-							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= 14;
-									indent= 1;
-								}
-									break;
-									
-								case NTREE_TEXTURE:
-								{
-									/* even more */
-									offset= 21;
-									indent= 1;
-								}	
-									break;
-									
-								default:
-									/* normal will do */
-									offset= 14;
-									break;
-							}
-						}
-						else
-							offset= 14;
-					}
-					else
-						offset= 0;
-					
 					/* FIXME: 'solo' as the 'special' button?
 					 *	- need special icons for these
 					 */
@@ -717,45 +676,6 @@
 					
 					group = 5;
 					
-					if (ale->id) {
-						/* special exception for textures */
-						if (GS(ale->id->name) == ID_TE) {
-							offset= 14;
-							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= 14;
-									indent= 1;
-								}
-									break;
-									
-								case NTREE_TEXTURE:
-								{
-									/* even more */
-									offset= 21;
-									indent= 1;
-								}	
-									break;
-									
-								default:
-									/* normal will do */
-									offset= 14;
-									break;
-							}
-						}
-						else
-							offset= 14;
-					}
-					else
-						offset= 0;
-					
 					special = ICON_ACTION;
 					
 					if (act)
@@ -776,6 +696,45 @@
 			
 			/* if special types, draw manually for now... */
 			if (doDraw) {
+				if (ale->id) {
+					/* special exception for textures */
+					if (GS(ale->id->name) == ID_TE) {
+						offset= 14;
+						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= 14;
+								indent= 1;
+							}
+								break;
+								
+							case NTREE_TEXTURE:
+							{
+								/* even more */
+								offset= 21;
+								indent= 1;
+							}	
+								break;
+								
+							default:
+								/* normal will do */
+								offset= 14;
+								break;
+						}
+					}
+					else
+						offset= 14;
+				}
+				else
+					offset= 0;
+				
 				/* now, start drawing based on this information */
 				glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 				glEnable(GL_BLEND);




More information about the Bf-blender-cvs mailing list