[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [18037] branches/blender2.5/blender/source /blender/editors: 2.5 - Action Editor

Joshua Leung aligorith at gmail.com
Wed Dec 24 01:05:56 CET 2008


Revision: 18037
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=18037
Author:   aligorith
Date:     2008-12-24 01:05:56 +0100 (Wed, 24 Dec 2008)

Log Message:
-----------
2.5 - Action Editor

Select Left/Right (Alt-Select) works again.
Fixed compiling errors from previous commit.

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/editors/animation/keyframes_edit.c
    branches/blender2.5/blender/source/blender/editors/space_action/action_select.c

Modified: branches/blender2.5/blender/source/blender/editors/animation/keyframes_edit.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/animation/keyframes_edit.c	2008-12-24 00:05:06 UTC (rev 18036)
+++ branches/blender2.5/blender/source/blender/editors/animation/keyframes_edit.c	2008-12-24 00:05:56 UTC (rev 18037)
@@ -32,6 +32,7 @@
 #include "BLI_blenlib.h"
 #include "BLI_arithb.h"
 
+#include "DNA_action_types.h"
 #include "DNA_curve_types.h"
 #include "DNA_ipo_types.h"
 #include "DNA_key_types.h"
@@ -44,6 +45,7 @@
 #include "BKE_key.h"
 #include "BKE_utildefines.h"
 
+#include "ED_anim_api.h"
 #include "ED_keyframes_edit.h"
 #include "ED_markers.h"
 
@@ -67,6 +69,8 @@
 // FIXME: it would be useful to be able to supply custom properties to the bezt function...
 // workaround for those callbacks that need this now, is to set globals...
 
+/* --------------------------- Base Functions ------------------------------------ */
+
 /* This function is used to loop over BezTriples in the given IpoCurve, applying a given 
  * operation on them, and optionally applies an IPO-curve validate function afterwards.
  */
@@ -111,6 +115,21 @@
     return 0;
 }
 
+/* This function is used to loop over the channels in an Action Group to modify the IPO blocks within them */
+short actgroup_keys_bezier_loop(Scene *scene, bActionGroup *agrp, BeztEditFunc bezt_cb, IcuEditFunc icu_cb)
+{
+	
+}
+
+/* -------------------------------- Further Abstracted ----------------------------- */
+
+/* this function is called to apply the same operation to all types of channels */
+short animchannel_keys_bezier_loop(Scene *scene, bAnimListElem *ale, BeztEditFunc bezt_cb, IcuEditFunc icu_cb)
+{
+
+}
+
+
 /* ******************************************* */
 /* Transform */
 

Modified: branches/blender2.5/blender/source/blender/editors/space_action/action_select.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_action/action_select.c	2008-12-24 00:05:06 UTC (rev 18036)
+++ branches/blender2.5/blender/source/blender/editors/space_action/action_select.c	2008-12-24 00:05:56 UTC (rev 18037)
@@ -114,7 +114,7 @@
 	clickmax = clickmin;
 	
 	if (clickmax < 0) {
-		*ret_type= ACTTYPE_NONE;
+		*ret_type= ANIMTYPE_NONE;
 		return NULL;
 	}
 	
@@ -455,7 +455,7 @@
 		
 		/* what gets selected depends on the mode (based on initial position of cursor) */
 		switch (in_scroller) {
-		case 'h': /* all in frame(s) */
+		case 'h': /* all in frame(s) (option 3) */
 			if (ale->key_data) {
 				if (ale->datatype == ALE_IPO)
 					borderselect_ipo_key(ale->key_data, rectf.xmin, rectf.xmax, selectmode);
@@ -478,7 +478,7 @@
 			//	borderselect_gplayer_frames(ale->data, rectf.xmin, rectf.xmax, selectmode);
 			//}
 			break;
-		case 'v': /* all in channel(s) */
+		case 'v': /* all in channel(s) (option 2) */
 			if (!((ymax < rectf.ymin) || (ymin > rectf.ymax))) {
 				if (ale->key_data) {
 					if (ale->datatype == ALE_IPO)
@@ -503,7 +503,7 @@
 				//}
 			}
 			break;
-		default: /* any keyframe inside region defined by region */
+		default: /* any keyframe inside region defined by region (option 1) */
 			if (!((ymax < rectf.ymin) || (ymin > rectf.ymax))) {
 				if (ale->key_data) {
 					if (ale->datatype == ALE_IPO)
@@ -524,12 +524,6 @@
 							borderselect_ipo_key(conchan->ipo, rectf.xmin, rectf.xmax, selectmode);
 					}
 				}
-				else if (ale->type == ANIMTYPE_ACT) {
-					// fixme: need a nicer way of dealing with summaries!
-				}
-				else if (ale->type == ANIMTYPE_OB) {
-					// fixme: need a nicer way of dealing with summaries!
-				}
 				//else if (ale->type == ANIMTYPE_GPLAYER) {
 				////	borderselect_gplayer_frames(ale->data, rectf.xmin, rectf.xmax, selectmode);
 				//}
@@ -602,7 +596,7 @@
 void ED_ACT_OT_keyframes_borderselect(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Borderselect";
+	ot->name= "Border Select";
 	ot->idname= "ED_ACT_OT_keyframes_borderselect";
 	
 	/* api callbacks */
@@ -781,12 +775,62 @@
 		//	select_gpencil_frame(gpl, (int)selx, selectmode);
 	}
 }
+
+/* Option 2) Selects all the keyframes on either side of the current frame (depends on which side the mouse is on) */
+static void selectkeys_leftright (bAnimContext *ac, short leftright, short select_mode)
+{
+	ListBase anim_data = {NULL, NULL};
+	bAnimListElem *ale;
+	int filter;
+	Scene *scene= ac->scene;
+	float min, max;
+	
+	if (select_mode==SELECT_REPLACE) {
+		select_mode=SELECT_ADD;
+		deselect_action_keys(ac, 0, 0);
+	}
+	
+	if (leftright == 1) {
+		min = -MAXFRAMEF;
+		max = (float)(CFRA + 0.1f);
+	} 
+	else {
+		min = (float)(CFRA - 0.1f);
+		max = MAXFRAMEF;
+	}
+	
+	/* filter data */
+	if (ac->datatype == ANIMCONT_GPENCIL)
+		filter= (ANIMFILTER_VISIBLE);
+	else
+		filter= (ANIMFILTER_VISIBLE | ANIMFILTER_IPOKEYS);
+	ANIM_animdata_filter(&anim_data, filter, ac->data, ac->datatype);
+		
+	/* select keys on the side where most data occurs */
+	for (ale= anim_data.first; ale; ale= ale->next) {
+		Object *nob= ANIM_nla_mapping_get(ac, ale);
+		
+		if (nob) {
+			ANIM_nla_mapping_apply(nob, ale->key_data, 0, 1);
+			borderselect_ipo_key(ale->key_data, min, max, SELECT_ADD);
+			ANIM_nla_mapping_apply(nob, ale->key_data, 1, 1);
+		}
+		//else if (ale->type == ANIMTYPE_GPLAYER)
+		//	borderselect_gplayer_frames(ale->data, min, max, SELECT_ADD);
+		else
+			borderselect_ipo_key(ale->key_data, min, max, SELECT_ADD);
+	}
+	
+	/* Cleanup */
+	BLI_freelistN(&anim_data);
+}
  
 /* ------------------- */
 
 static int actkeys_clickselect_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
 	bAnimContext ac;
+	Scene *scene;
 	ARegion *ar;
 	short in_scroller, selectmode;
 	int mval[2];
@@ -796,6 +840,7 @@
 		return OPERATOR_CANCELLED;
 		
 	/* get useful pointers from animation context data */
+	scene= ac.scene;
 	ar= ac.ar;
 	
 	/* get mouse coordinates (in region coordinates) */
@@ -822,7 +867,7 @@
 	}
 	else if (RNA_boolean_get(op->ptr, "left_right")) {
 		/* select all keys on same side of current frame as mouse */
-		
+		selectkeys_leftright(&ac, (mval[0] < CFRA), selectmode);
 	}
 	else {
 		/* select keyframe under mouse */





More information about the Bf-blender-cvs mailing list