[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [23807] trunk/blender/source/blender/ editors/animation/anim_draw.c: Animation Editors: Filtering buttons Cleanup

Joshua Leung aligorith at gmail.com
Tue Oct 13 13:32:03 CEST 2009


Revision: 23807
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=23807
Author:   aligorith
Date:     2009-10-13 13:32:03 +0200 (Tue, 13 Oct 2009)

Log Message:
-----------
Animation Editors: Filtering buttons Cleanup

The filtering buttons for datatypes will now only be shown if there is data of that type present in the current file. They will still be shown in the same order, but by hiding the ones that won't be of any relevance, the presentation of the views should be cleaner (I hope ;)

Modified Paths:
--------------
    trunk/blender/source/blender/editors/animation/anim_draw.c

Modified: trunk/blender/source/blender/editors/animation/anim_draw.c
===================================================================
--- trunk/blender/source/blender/editors/animation/anim_draw.c	2009-10-13 11:21:02 UTC (rev 23806)
+++ trunk/blender/source/blender/editors/animation/anim_draw.c	2009-10-13 11:32:03 UTC (rev 23807)
@@ -48,6 +48,7 @@
 #include "BKE_context.h"
 #include "BKE_global.h"
 #include "BKE_fcurve.h"
+#include "BKE_main.h"
 #include "BKE_nla.h"
 #include "BKE_object.h"
 #include "BKE_screen.h"
@@ -325,6 +326,7 @@
 /* standard header buttons for Animation Editors */
 short ANIM_headerUI_standard_buttons (const bContext *C, bDopeSheet *ads, uiBlock *block, short xco, short yco)
 {
+	Main *mainptr= CTX_data_main(C);
 	ScrArea *sa= CTX_wm_area(C);
 	short nlaActive= ((sa) && (sa->spacetype==SPACE_NLA));
 	
@@ -337,19 +339,27 @@
 		if (nlaActive) uiBlockEndAlign(block);
 		xco += 5;
 		
-		/* datatype based */
+		/* datatype based - only available datatypes are shown */
 		// TODO: only show the datablocks which exist
 		uiBlockBeginAlign(block);
 			uiDefIconButBitI(block, TOGN, ADS_FILTER_NOSCE, B_REDR, ICON_SCENE_DATA,	(short)(xco+=XIC),yco,XIC,YIC, &(ads->filterflag), 0, 0, 0, 0, "Display Scene Animation");
 			uiDefIconButBitI(block, TOGN, ADS_FILTER_NOWOR, B_REDR, ICON_WORLD_DATA,	(short)(xco+=XIC),yco,XIC,YIC, &(ads->filterflag), 0, 0, 0, 0, "Display World Animation");
-			uiDefIconButBitI(block, TOGN, ADS_FILTER_NOSHAPEKEYS, B_REDR, ICON_SHAPEKEY_DATA,	(short)(xco+=XIC),yco,XIC,YIC, &(ads->filterflag), 0, 0, 0, 0, "Display ShapeKeys");
-			uiDefIconButBitI(block, TOGN, ADS_FILTER_NOMAT, B_REDR, ICON_MATERIAL_DATA,	(short)(xco+=XIC),yco,XIC,YIC, &(ads->filterflag), 0, 0, 0, 0, "Display Material Data");
-			uiDefIconButBitI(block, TOGN, ADS_FILTER_NOLAM, B_REDR, ICON_LAMP_DATA,	(short)(xco+=XIC),yco,XIC,YIC, &(ads->filterflag), 0, 0, 0, 0, "Display Lamp Data");
-			uiDefIconButBitI(block, TOGN, ADS_FILTER_NOCAM, B_REDR, ICON_CAMERA_DATA,	(short)(xco+=XIC),yco,XIC,YIC, &(ads->filterflag), 0, 0, 0, 0, "Display Camera Data");
-			uiDefIconButBitI(block, TOGN, ADS_FILTER_NOCUR, B_REDR, ICON_CURVE_DATA,	(short)(xco+=XIC),yco,XIC,YIC, &(ads->filterflag), 0, 0, 0, 0, "Display Curve Data");
-			uiDefIconButBitI(block, TOGN, ADS_FILTER_NOMBA, B_REDR, ICON_META_DATA,	(short)(xco+=XIC),yco,XIC,YIC, &(ads->filterflag), 0, 0, 0, 0, "Display MetaBall Data");
-			uiDefIconButBitI(block, TOGN, ADS_FILTER_NOARM, B_REDR, ICON_ARMATURE_DATA,	(short)(xco+=XIC),yco,XIC,YIC, &(ads->filterflag), 0, 0, 0, 0, "Display Armature Data");
-			uiDefIconButBitI(block, TOGN, ADS_FILTER_NOPART, B_REDR, ICON_PARTICLE_DATA,	(short)(xco+=XIC),yco,XIC,YIC, &(ads->filterflag), 0, 0, 0, 0, "Display Particle Data");
+			if (mainptr && mainptr->key.first)
+				uiDefIconButBitI(block, TOGN, ADS_FILTER_NOSHAPEKEYS, B_REDR, ICON_SHAPEKEY_DATA,	(short)(xco+=XIC),yco,XIC,YIC, &(ads->filterflag), 0, 0, 0, 0, "Display ShapeKeys");
+			if (mainptr && mainptr->mat.first)
+				uiDefIconButBitI(block, TOGN, ADS_FILTER_NOMAT, B_REDR, ICON_MATERIAL_DATA,	(short)(xco+=XIC),yco,XIC,YIC, &(ads->filterflag), 0, 0, 0, 0, "Display Material Data");
+			if (mainptr && mainptr->lamp.first)
+				uiDefIconButBitI(block, TOGN, ADS_FILTER_NOLAM, B_REDR, ICON_LAMP_DATA,	(short)(xco+=XIC),yco,XIC,YIC, &(ads->filterflag), 0, 0, 0, 0, "Display Lamp Data");
+			if (mainptr && mainptr->camera.first)
+				uiDefIconButBitI(block, TOGN, ADS_FILTER_NOCAM, B_REDR, ICON_CAMERA_DATA,	(short)(xco+=XIC),yco,XIC,YIC, &(ads->filterflag), 0, 0, 0, 0, "Display Camera Data");
+			if (mainptr && mainptr->curve.first)
+				uiDefIconButBitI(block, TOGN, ADS_FILTER_NOCUR, B_REDR, ICON_CURVE_DATA,	(short)(xco+=XIC),yco,XIC,YIC, &(ads->filterflag), 0, 0, 0, 0, "Display Curve Data");
+			if (mainptr && mainptr->mball.first)
+				uiDefIconButBitI(block, TOGN, ADS_FILTER_NOMBA, B_REDR, ICON_META_DATA,	(short)(xco+=XIC),yco,XIC,YIC, &(ads->filterflag), 0, 0, 0, 0, "Display MetaBall Data");
+			if (mainptr && mainptr->armature.first)
+				uiDefIconButBitI(block, TOGN, ADS_FILTER_NOARM, B_REDR, ICON_ARMATURE_DATA,	(short)(xco+=XIC),yco,XIC,YIC, &(ads->filterflag), 0, 0, 0, 0, "Display Armature Data");
+			if (mainptr && mainptr->particle.first)
+				uiDefIconButBitI(block, TOGN, ADS_FILTER_NOPART, B_REDR, ICON_PARTICLE_DATA,	(short)(xco+=XIC),yco,XIC,YIC, &(ads->filterflag), 0, 0, 0, 0, "Display Particle Data");
 		uiBlockEndAlign(block);
 		xco += 30;
 	}





More information about the Bf-blender-cvs mailing list