Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2008-12-24 03:05:56 +0300
committerJoshua Leung <aligorith@gmail.com>2008-12-24 03:05:56 +0300
commita65fabc553e817a3bfe5b27acf725065506e5b62 (patch)
tree367695038501eeeefb09894ae09841dbef741f2f /source
parent1062946cad265ea532cc44b1bbf1e593b3a86169 (diff)
2.5 - Action Editor
Select Left/Right (Alt-Select) works again. Fixed compiling errors from previous commit.
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/animation/keyframes_edit.c19
-rw-r--r--source/blender/editors/space_action/action_select.c69
2 files changed, 76 insertions, 12 deletions
diff --git a/source/blender/editors/animation/keyframes_edit.c b/source/blender/editors/animation/keyframes_edit.c
index 951e91dc55a..278e216535b 100644
--- a/source/blender/editors/animation/keyframes_edit.c
+++ b/source/blender/editors/animation/keyframes_edit.c
@@ -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 @@ short ipo_keys_bezier_loop(Scene *scene, Ipo *ipo, BeztEditFunc bezt_cb, IcuEdit
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 */
diff --git a/source/blender/editors/space_action/action_select.c b/source/blender/editors/space_action/action_select.c
index 0a5a2969a0f..100024fc0d1 100644
--- a/source/blender/editors/space_action/action_select.c
+++ b/source/blender/editors/space_action/action_select.c
@@ -114,7 +114,7 @@ void *get_nearest_act_channel (short mval[], short *ret_type, void **owner)
clickmax = clickmin;
if (clickmax < 0) {
- *ret_type= ACTTYPE_NONE;
+ *ret_type= ANIMTYPE_NONE;
return NULL;
}
@@ -455,7 +455,7 @@ static void borderselect_action (bAnimContext *ac, rcti rect, short in_scroller,
/* 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 @@ static void borderselect_action (bAnimContext *ac, rcti rect, short in_scroller,
// 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 @@ static void borderselect_action (bAnimContext *ac, rcti rect, short in_scroller,
//}
}
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 @@ static void borderselect_action (bAnimContext *ac, rcti rect, short in_scroller,
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 @@ static int actkeys_borderselect_invoke(bContext *C, wmOperator *op, wmEvent *eve
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 @@ static void mouse_action_keys (bAnimContext *ac, int mval[2], short selectmode)
// 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 @@ static int actkeys_clickselect_invoke(bContext *C, wmOperator *op, wmEvent *even
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 @@ static int actkeys_clickselect_invoke(bContext *C, wmOperator *op, wmEvent *even
}
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 */