[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [18746] branches/blender2.5/blender/source /blender/editors/space_outliner: Outliner: Updated the tree-building code to work for Animato

Joshua Leung aligorith at gmail.com
Fri Jan 30 11:08:59 CET 2009


Revision: 18746
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=18746
Author:   aligorith
Date:     2009-01-30 11:08:58 +0100 (Fri, 30 Jan 2009)

Log Message:
-----------
Outliner: Updated the tree-building code to work for Animato

* Note to Icon Designers - we need a new icon for 'Animation data' I think. Currently I'm using the old IPO icon...
* Should F-Curves get shown in the Outliner?

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/editors/space_outliner/outliner.c
    branches/blender2.5/blender/source/blender/editors/space_outliner/outliner_intern.h

Modified: branches/blender2.5/blender/source/blender/editors/space_outliner/outliner.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_outliner/outliner.c	2009-01-30 08:10:31 UTC (rev 18745)
+++ branches/blender2.5/blender/source/blender/editors/space_outliner/outliner.c	2009-01-30 10:08:58 UTC (rev 18746)
@@ -33,6 +33,7 @@
 
 #include "MEM_guardedalloc.h"
 
+#include "DNA_anim_types.h"
 #include "DNA_action_types.h"
 #include "DNA_armature_types.h"
 #include "DNA_constraint_types.h"
@@ -590,6 +591,7 @@
 	te->index= index;	// for data arays
 	if(ELEM3(type, TSE_SEQUENCE, TSE_SEQ_STRIP, TSE_SEQUENCE_DUP));
 	else if(ELEM3(type, TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM));
+	else if(type==TSE_ANIM_DATA);
 	else {
 		te->name= id->name+2; // default, can be overridden by Library or non-ID data
 		te->idcode= GS(id->name);
@@ -612,6 +614,8 @@
 			{
 				Object *ob= (Object *)id;
 				
+				outliner_add_element(soops, &te->subtree, ob->adt, te, TSE_ANIM_DATA, 0);
+				
 				if(ob->proxy && ob->id.lib==NULL)
 					outliner_add_element(soops, &te->subtree, ob->proxy, te, TSE_PROXY, 0);
 				
@@ -696,9 +700,6 @@
 					}
 				}
 				
-				outliner_add_element(soops, &te->subtree, ob->ipo, te, 0, 0);
-				outliner_add_element(soops, &te->subtree, ob->action, te, 0, 0);
-				
 				for(a=0; a<ob->totcol; a++) 
 					outliner_add_element(soops, &te->subtree, ob->mat[a], te, 0, a);
 				
@@ -778,27 +779,16 @@
 				}
 				
 				if(ob->dup_group)
-					outliner_add_element(soops, &te->subtree, ob->dup_group, te, 0, 0);
-
-				if(ob->nlastrips.first) {
-					bActionStrip *strip;
-					TreeElement *ten;
-					TreeElement *tenla= outliner_add_element(soops, &te->subtree, ob, te, TSE_NLA, 0);
-					int a= 0;
-					
-					tenla->name= "NLA strips";
-					for (strip=ob->nlastrips.first; strip; strip=strip->next, a++) {
-						ten= outliner_add_element(soops, &tenla->subtree, strip->act, tenla, TSE_NLA_ACTION, a);
-						if(ten) ten->directdata= strip;
-					}
-				}
+					outliner_add_element(soops, &te->subtree, ob->dup_group, te, 0, 0);	
 				
 			}
 			break;
 		case ID_ME:
 			{
 				Mesh *me= (Mesh *)id;
-				outliner_add_element(soops, &te->subtree, me->ipo, te, 0, 0);
+				
+				//outliner_add_element(soops, &te->subtree, me->adt, te, TSE_ANIM_DATA, 0);
+				
 				outliner_add_element(soops, &te->subtree, me->key, te, 0, 0);
 				for(a=0; a<me->totcol; a++) 
 					outliner_add_element(soops, &te->subtree, me->mat[a], te, 0, a);
@@ -809,6 +799,9 @@
 		case ID_CU:
 			{
 				Curve *cu= (Curve *)id;
+				
+				outliner_add_element(soops, &te->subtree, cu->adt, te, TSE_ANIM_DATA, 0);
+				
 				for(a=0; a<cu->totcol; a++) 
 					outliner_add_element(soops, &te->subtree, cu->mat[a], te, 0, a);
 			}
@@ -824,7 +817,8 @@
 		{
 			Material *ma= (Material *)id;
 			
-			outliner_add_element(soops, &te->subtree, ma->ipo, te, 0, 0);
+			outliner_add_element(soops, &te->subtree, ma->adt, te, TSE_ANIM_DATA, 0);
+			
 			for(a=0; a<MAX_MTEX; a++) {
 				if(ma->mtex[a]) outliner_add_element(soops, &te->subtree, ma->mtex[a]->tex, te, 0, a);
 			}
@@ -834,20 +828,22 @@
 			{
 				Tex *tex= (Tex *)id;
 				
-				outliner_add_element(soops, &te->subtree, tex->ipo, te, 0, 0);
+				outliner_add_element(soops, &te->subtree, tex->adt, te, TSE_ANIM_DATA, 0);
 				outliner_add_element(soops, &te->subtree, tex->ima, te, 0, 0);
 			}
 			break;
 		case ID_CA:
 			{
 				Camera *ca= (Camera *)id;
-				outliner_add_element(soops, &te->subtree, ca->ipo, te, 0, 0);
+				outliner_add_element(soops, &te->subtree, ca->adt, te, TSE_ANIM_DATA, 0);
 			}
 			break;
 		case ID_LA:
 			{
 				Lamp *la= (Lamp *)id;
-				outliner_add_element(soops, &te->subtree, la->ipo, te, 0, 0);
+				
+				outliner_add_element(soops, &te->subtree, la->adt, te, TSE_ANIM_DATA, 0);
+				
 				for(a=0; a<MAX_MTEX; a++) {
 					if(la->mtex[a]) outliner_add_element(soops, &te->subtree, la->mtex[a]->tex, te, 0, a);
 				}
@@ -856,7 +852,9 @@
 		case ID_WO:
 			{
 				World *wrld= (World *)id;
-				outliner_add_element(soops, &te->subtree, wrld->ipo, te, 0, 0);
+				
+				outliner_add_element(soops, &te->subtree, wrld->adt, te, TSE_ANIM_DATA, 0);
+				
 				for(a=0; a<MAX_MTEX; a++) {
 					if(wrld->mtex[a]) outliner_add_element(soops, &te->subtree, wrld->mtex[a]->tex, te, 0, a);
 				}
@@ -865,35 +863,14 @@
 		case ID_KE:
 			{
 				Key *key= (Key *)id;
-				outliner_add_element(soops, &te->subtree, key->ipo, te, 0, 0);
-			}
-			break;
-		case ID_IP:
-			{
-				Ipo *ipo= (Ipo *)id;
-				IpoCurve *icu;
-				Object *lastadded= NULL;
 				
-				for (icu= ipo->curve.first; icu; icu= icu->next) {
-					if (icu->driver && icu->driver->ob) {
-						if (lastadded != icu->driver->ob) {
-							outliner_add_element(soops, &te->subtree, icu->driver->ob, te, TSE_LINKED_OB, 0);
-							lastadded= icu->driver->ob;
-						}
-					}
-				}
+				outliner_add_element(soops, &te->subtree, key->adt, te, TSE_ANIM_DATA, 0);
 			}
 			break;
 		case ID_AC:
 			{
-				bAction *act= (bAction *)id;
-				bActionChannel *chan;
-				int a= 0;
-				
-				tselem= TREESTORE(parent);
-				for (chan=act->chanbase.first; chan; chan=chan->next, a++) {
-					outliner_add_element(soops, &te->subtree, chan->ipo, te, 0, a);
-				}
+				// XXX do we want to be exposing the F-Curves here?
+				//bAction *act= (bAction *)id;
 			}
 			break;
 		case ID_AR:
@@ -940,6 +917,56 @@
 			break;
 		}
 	}
+	else if(type==TSE_ANIM_DATA) {
+		AnimData *adt= (AnimData *)idv;
+		
+		/* this element's info */
+		te->name= "Animation";
+		
+		/* Action */
+		outliner_add_element(soops, &te->subtree, adt->action, te, 0, 0);
+		
+		/* Drivers */
+		if (adt->drivers.first) {
+			TreeElement *ted= outliner_add_element(soops, &te->subtree, adt, te, TSE_DRIVER_BASE, 0);
+			ID *lastadded= NULL;
+			FCurve *fcu;
+			
+			ted->name= "Drivers";
+		
+			for (fcu= adt->drivers.first; fcu; fcu= fcu->next) {
+				if (fcu->driver && fcu->driver->id) {
+					if (lastadded != fcu->driver->id) {
+						outliner_add_element(soops, &ted->subtree, fcu->driver->id, ted, TSE_LINKED_OB, 0);
+						lastadded= fcu->driver->id;
+					}
+				}
+			}
+		}
+		
+		/* NLA Data */
+		if (adt->nla_tracks.first) {
+#if 0
+			TreeElement *tenla= outliner_add_element(soops, &te->subtree, adt, te, TSE_NLA, 0);
+			NlaTrack *nlt;
+			int a= 0;
+			
+			tenla->name= "NLA Tracks";
+			
+			for (nlt= adt->nla_tracks.first; nlt; nlt= nlt->next) {
+				TreeElement *tenlt= outliner_add_element(soops, &te->subtree, nlt, te, TSE_NLA_TRACK, a);
+				bActionStrip *strip;
+				TreeElement *ten;
+				int b= 0;
+				
+				for (strip=nlt->strips.first; strip; strip=strip->next, a++) {
+					ten= outliner_add_element(soops, &tenla->subtree, strip->act, tenla, TSE_NLA_ACTION, a);
+					if(ten) ten->directdata= strip;
+				}
+			}
+#endif
+		}
+	}
 	else if(type==TSE_SEQUENCE) {
 		Sequence *seq= (Sequence*) idv;
 		Sequence *p;
@@ -1833,75 +1860,6 @@
 	return 0;
 }
 
-static int tree_element_active_ipo(Scene *scene, SpaceOops *soops, TreeElement *te, int set)
-{
-	TreeElement *tes;
-	TreeStoreElem *tselems=NULL;
-	Object *ob;
-	
-	/* we search for the object parent */
-	ob= (Object *)outliner_search_back(soops, te, ID_OB);
-	if(ob==NULL || ob!=OBACT) return 0;	// just paranoia
-	
-	/* the parent of ipo */
-	tes= te->parent;
-	tselems= TREESTORE(tes);
-	
-	if(set) {
-		if(tes->idcode==ID_AC) {
-			if(ob->ipoflag & OB_ACTION_OB)
-				ob->ipowin= ID_OB;
-			else if(ob->ipoflag & OB_ACTION_KEY)
-				ob->ipowin= ID_KE;
-			else 
-				ob->ipowin= ID_PO;
-		}
-		else ob->ipowin= tes->idcode;
-		
-		if(ob->ipowin==ID_MA) tree_element_active_material(scene, soops, tes, 1);
-		else if(ob->ipowin==ID_AC) {
-			bActionChannel *chan;
-			short a=0;
-			for(chan=ob->action->chanbase.first; chan; chan= chan->next) {
-				if(a==te->index) break;
-				if(chan->ipo) a++;
-			}
-// XXX			deselect_actionchannels(ob->action, 0);
-//			if (chan)
-//				select_channel(ob->action, chan, SELECT_ADD);
-			allqueue(REDRAWACTION, ob->ipowin);
-			allqueue(REDRAWVIEW3D, ob->ipowin);
-		}
-		
-		allqueue(REDRAWIPO, ob->ipowin);
-	}
-	else {
-		if(tes->idcode==ID_AC) {
-			if(ob->ipoflag & OB_ACTION_OB)
-				return ob->ipowin==ID_OB;
-			else if(ob->ipoflag & OB_ACTION_KEY)
-				return ob->ipowin==ID_KE;
-			else if(ob->ipowin==ID_AC) {
-				bActionChannel *chan;
-				short a=0;
-				for(chan=ob->action->chanbase.first; chan; chan= chan->next) {
-					if(a==te->index) break;
-					if(chan->ipo) a++;
-				}
-// XXX				if(chan==get_hilighted_action_channel(ob->action)) return 1;
-			}
-		}
-		else if(ob->ipowin==tes->idcode) {
-			if(ob->ipowin==ID_MA) {
-				Material *ma= give_current_material(ob, ob->actcol);
-				if(ma==(Material *)tselems->id) return 1;
-			}
-			else return 1;
-		}
-	}
-	return 0;
-}	
-
 static int tree_element_active_defgroup(Scene *scene, TreeElement *te, TreeStoreElem *tselem, int set)
 {
 	Object *ob;
@@ -1920,26 +1878,6 @@
 	return 0;
 }
 
-static int tree_element_active_nla_action(TreeElement *te, TreeStoreElem *tselem, int set)
-{
-	if(set) {
-		bActionStrip *strip= te->directdata;
-		if(strip) {
-// XXX			deselect_nlachannel_keys(0);
-			strip->flag |= ACTSTRIP_SELECT;
-			allqueue(REDRAWNLA, 0);
-		}
-	}
-	else {
-		/* id in tselem is action */
-		bActionStrip *strip= te->directdata;
-		if(strip) {
-			if(strip->flag & ACTSTRIP_SELECT) return 1;
-		}
-	}
-	return 0;
-}
-
 static int tree_element_active_posegroup(Scene *scene, TreeElement *te, TreeStoreElem *tselem, int set)
 {
 	Object *ob= (Object *)tselem->id;
@@ -2085,8 +2023,6 @@
 			return tree_element_active_world(scene, soops, te, set);
 		case ID_LA:
 			return tree_element_active_lamp(scene, soops, te, set);
-		case ID_IP:
-			return tree_element_active_ipo(scene, soops, te, set);
 		case ID_TE:
 			return tree_element_active_texture(scene, soops, te, set);
 		case ID_TXT:
@@ -2159,8 +2095,6 @@
 {
 	
 	switch(tselem->type) {
-		case TSE_NLA_ACTION:
-			return tree_element_active_nla_action(te, tselem, set);
 		case TSE_DEFGROUP:
 			return tree_element_active_defgroup(scene, te, tselem, set);
 		case TSE_BONE:
@@ -2233,7 +2167,7 @@
 			if(event==LEFTMOUSE) {
 			
 				if (ctrl) {
-					if(ELEM9(tselem->type, TSE_NLA, TSE_DEFGROUP_BASE, TSE_CONSTRAINT_BASE, TSE_MODIFIER_BASE, TSE_SCRIPT_BASE, TSE_POSE_BASE, TSE_POSEGRP_BASE, TSE_R_LAYER_BASE, TSE_R_PASS)) 

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list