[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [18858] branches/blender2.5/blender/source /blender/editors/space_action: Action Editor - Added back ID browsing buttons.

Joshua Leung aligorith at gmail.com
Sun Feb 8 11:21:38 CET 2009


Revision: 18858
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=18858
Author:   aligorith
Date:     2009-02-08 11:21:38 +0100 (Sun, 08 Feb 2009)

Log Message:
-----------
Action Editor - Added back ID browsing buttons. Only browse/delete works for now.

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/editors/space_action/action_edit.c
    branches/blender2.5/blender/source/blender/editors/space_action/action_header.c

Modified: branches/blender2.5/blender/source/blender/editors/space_action/action_edit.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_action/action_edit.c	2009-02-08 09:07:36 UTC (rev 18857)
+++ branches/blender2.5/blender/source/blender/editors/space_action/action_edit.c	2009-02-08 10:21:38 UTC (rev 18858)
@@ -238,10 +238,8 @@
 //	- insert key
 
 /* ******************** Copy/Paste Keyframes Operator ************************* */
-/* - The copy/paste buffer currently stores a set of Action Channels, with temporary
- *	IPO-blocks, and also temporary IpoCurves which only contain the selected keyframes.
- * - Only pastes between compatable data is possible (i.e. same achan->name, ipo-curve type, etc.)
- *	Unless there is only one element in the buffer, names are also tested to check for compatability.
+/* - The copy/paste buffer currently stores a set of temporary F-Curves containing only the keyframes 
+ *   that were selected in each of the original F-Curves
  * - All pasted frames are offset by the same amount. This is calculated as the difference in the times of
  *	the current frame and the 'first keyframe' (i.e. the earliest one in all channels).
  * - The earliest frame is calculated per copy operation.
@@ -276,7 +274,6 @@
  */
 static short copy_action_keys (bAnimContext *ac)
 {	
-#if 0 // XXX old animation system
 	ListBase anim_data = {NULL, NULL};
 	bAnimListElem *ale;
 	int filter;
@@ -285,11 +282,12 @@
 	free_actcopybuf();
 	
 	/* filter data */
-	filter= (ANIMFILTER_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_IPOKEYS);
+	filter= (ANIMFILTER_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_CURVESONLY);
 	ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
 	
 	/* assume that each of these is an ipo-block */
 	for (ale= anim_data.first; ale; ale= ale->next) {
+#if 0
 		bActionChannel *achan;
 		Ipo *ipo= ale->key_data;
 		Ipo *ipn;
@@ -347,16 +345,21 @@
 				}
 			}
 		}
+#endif
+		//FCurve *fcu= (FCurve *)ale->key_data;
+		//FCurve *fcn;
+		//BezTriple *bezt;
+		//int i;
+		
+		
 	}
 	
 	/* check if anything ended up in the buffer */
 	if (ELEM(NULL, actcopybuf.first, actcopybuf.last))
-	//	error("Nothing copied to buffer");
 		return -1;
 	
 	/* free temp memory */
 	BLI_freelistN(&anim_data);
-#endif // XXX old animation system
 	
 	/* everything went fine */
 	return 0;

Modified: branches/blender2.5/blender/source/blender/editors/space_action/action_header.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_action/action_header.c	2009-02-08 09:07:36 UTC (rev 18857)
+++ branches/blender2.5/blender/source/blender/editors/space_action/action_header.c	2009-02-08 10:21:38 UTC (rev 18858)
@@ -29,8 +29,10 @@
 #include <string.h>
 #include <stdio.h>
 
+#include "DNA_anim_types.h"
 #include "DNA_action_types.h"
 #include "DNA_key_types.h"
+#include "DNA_object_types.h"
 #include "DNA_space_types.h"
 #include "DNA_scene_types.h"
 #include "DNA_screen_types.h"
@@ -1551,6 +1553,38 @@
 	}
 }
 
+static void saction_idpoin_handle(bContext *C, ID *id, int event)
+{
+	SpaceAction *saction= (SpaceAction*)CTX_wm_space_data(C);
+	Object *obact= CTX_data_active_object(C);
+	AnimData *adt= BKE_id_add_animdata((ID *)obact);
+
+	switch (event) {
+		case UI_ID_BROWSE:
+		case UI_ID_DELETE:
+			/* we must set this action to be the one used by active object (if not pinned) */
+			if (saction->pin == 0)
+				obact->adt->action= saction->action;
+			
+			ED_area_tag_redraw(CTX_wm_area(C));
+			ED_undo_push(C, "Assign Action");
+			break;
+		case UI_ID_RENAME:
+			break;
+		case UI_ID_ADD_NEW:
+			/* XXX not implemented */
+			break;
+		case UI_ID_OPEN:
+			/* XXX not implemented */
+			break;
+		case UI_ID_ALONE:
+			/* XXX not implemented */
+			break;
+		case UI_ID_PIN:
+			break;
+	}
+}
+
 void action_header_buttons(const bContext *C, ARegion *ar)
 {
 	ScrArea *sa= CTX_wm_area(C);
@@ -1628,7 +1662,8 @@
 	
 	xco += (90 + 8);
 	
-	if (ac.data) {
+	/*if (ac.data)*/ 
+	{
 		/* MODE-DEPENDENT DRAWING */
 		if (saction->mode == SACTCONT_DOPESHEET) {
 			/* FILTERING OPTIONS */
@@ -1652,17 +1687,12 @@
 		}
 		else if (saction->mode == SACTCONT_ACTION) { // not too appropriate for shapekeys atm...
 			/* NAME ETC */
-				// XXX missing stuff here!
-			//ob= OBACT;
-			//from = (ID *)ob;
+			//uiClearButLock();
 			
-			//xco= std_libbuttons(block, xco, 0, B_ACTPIN, saction->pin, 
-			//					B_ACTIONBROWSE, ID_AC, 0, (ID*)saction->action, 
-			//					from, &(saction->actnr), B_ACTALONE, 
-			//					B_ACTLOCAL, B_ACTIONDELETE, 0, B_KEEPDATA);	
+			/* NAME ETC (it is assumed that */
+			xco= uiDefIDPoinButs(block, CTX_data_main(C), NULL, (ID**)&saction->action, ID_AC, &saction->pin, xco, yco,
+				saction_idpoin_handle, UI_ID_BROWSE|UI_ID_RENAME|UI_ID_ADD_NEW|UI_ID_DELETE|UI_ID_FAKE_USER|UI_ID_ALONE|UI_ID_PIN);
 			
-			//uiClearButLock();
-			
 			xco += 8;
 		}
 		





More information about the Bf-blender-cvs mailing list