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
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2008-12-23 14:58:02 +0300
committerJoshua Leung <aligorith@gmail.com>2008-12-23 14:58:02 +0300
commit00d2cf3ddbdbe1162435249ad4cb359ca70b357a (patch)
tree0882f94a8d894c07a5a73c860e4df5d9c0b6ef57
parent67888ee34b61130113e6b8fc439ff6b50d4078a1 (diff)
2.5 Action Editor - Brought back Select All (AKEY)
Now, selecting keyframes with mouse behaves more like before. Note: this still mostly uses old code, since other parts of code also call this. For later, it'd be nice to store as RNA prop, method of selecting.
-rw-r--r--source/blender/editors/include/ED_keyframes_edit.h3
-rw-r--r--source/blender/editors/space_action/action_intern.h1
-rw-r--r--source/blender/editors/space_action/action_ops.c4
-rw-r--r--source/blender/editors/space_action/action_select.c120
4 files changed, 107 insertions, 21 deletions
diff --git a/source/blender/editors/include/ED_keyframes_edit.h b/source/blender/editors/include/ED_keyframes_edit.h
index ed3c09c8a98..d312289ca2a 100644
--- a/source/blender/editors/include/ED_keyframes_edit.h
+++ b/source/blender/editors/include/ED_keyframes_edit.h
@@ -98,6 +98,9 @@ BeztEditFunc ANIM_editkeyframes_ipo(short mode);
void select_ipo_key(struct Scene *scene, struct Ipo *ipo, float selx, short selectmode);
void select_icu_key(struct Scene *scene, struct IpoCurve *icu, float selx, short selectmode);
+short is_ipo_key_selected(struct Ipo *ipo);
+void set_ipo_key_selection(struct Ipo *ipo, short sel);
+
/* ************************************************ */
diff --git a/source/blender/editors/space_action/action_intern.h b/source/blender/editors/space_action/action_intern.h
index ef9ab5a9d66..3ea3e179a80 100644
--- a/source/blender/editors/space_action/action_intern.h
+++ b/source/blender/editors/space_action/action_intern.h
@@ -45,6 +45,7 @@ void draw_channel_strips(struct bAnimContext *ac, struct SpaceAction *saction, s
void action_header_buttons(const struct bContext *C, struct ARegion *ar);
/* action_select.c */
+void ED_ACT_OT_keyframes_deselectall(struct wmOperatorType *ot);
void ED_ACT_OT_keyframes_clickselect(struct wmOperatorType *ot);
/* action_ops.c */
diff --git a/source/blender/editors/space_action/action_ops.c b/source/blender/editors/space_action/action_ops.c
index 9a64a026f81..4fafb176a92 100644
--- a/source/blender/editors/space_action/action_ops.c
+++ b/source/blender/editors/space_action/action_ops.c
@@ -63,6 +63,7 @@ void action_operatortypes(void)
/* keyframes */
WM_operatortype_append(ED_ACT_OT_keyframes_clickselect);
+ WM_operatortype_append(ED_ACT_OT_keyframes_deselectall);
}
/* ************************** registration - keymaps **********************************/
@@ -73,6 +74,9 @@ static void action_keymap_keyframes (ListBase *keymap)
WM_keymap_add_item(keymap, "ED_ACT_OT_keyframes_clickselect", SELECTMOUSE, KM_PRESS, 0, 0);
RNA_boolean_set(WM_keymap_add_item(keymap, "ED_ACT_OT_keyframes_clickselect", SELECTMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "extend_select", 1);
RNA_boolean_set(WM_keymap_add_item(keymap, "ED_ACT_OT_keyframes_clickselect", SELECTMOUSE, KM_PRESS, KM_ALT, 0)->ptr, "left_right", 1);
+
+ /* deselect all */
+ WM_keymap_add_item(keymap, "ED_ACT_OT_keyframes_deselectall", AKEY, KM_PRESS, 0, 0);
}
/* --------------- */
diff --git a/source/blender/editors/space_action/action_select.c b/source/blender/editors/space_action/action_select.c
index fac55963a7f..887de081de8 100644
--- a/source/blender/editors/space_action/action_select.c
+++ b/source/blender/editors/space_action/action_select.c
@@ -316,6 +316,86 @@ static void *get_nearest_action_key (bAnimContext *ac, int mval[2], float *selx,
/* ************************************************************************** */
/* KEYFRAMES STUFF */
+/* ******************** Deselect All Operator ***************************** */
+
+/* Deselects keyframes in the action editor
+ * - This is called by the deselect all operator, as well as other ones!
+ */
+static void deselect_action_keys (bAnimContext *ac, short test, short sel)
+{
+ ListBase anim_data = {NULL, NULL};
+ bAnimListElem *ale;
+ int filter;
+
+ /* determine type-based settings */
+ if (ac->datatype == ANIMCONT_GPENCIL)
+ filter= (ANIMFILTER_VISIBLE);
+ else
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_IPOKEYS);
+
+ /* filter data */
+ ANIM_animdata_filter(&anim_data, filter, ac->data, ac->datatype);
+
+ /* See if we should be selecting or deselecting */
+ if (test) {
+ for (ale= anim_data.first; ale; ale= ale->next) {
+ if (ale->type == ANIMTYPE_GPLAYER) {
+ //if (is_gplayer_frame_selected(ale->data)) {
+ // sel= 0;
+ // break;
+ //}
+ }
+ else {
+ if (is_ipo_key_selected(ale->key_data)) {
+ sel= 0;
+ break;
+ }
+ }
+ }
+ }
+
+ /* Now set the flags */
+ for (ale= anim_data.first; ale; ale= ale->next) {
+ //if (ale->type == ACTTYPE_GPLAYER)
+ // set_gplayer_frame_selection(ale->data, sel);
+ //else
+ set_ipo_key_selection(ale->key_data, sel);
+ }
+
+ /* Cleanup */
+ BLI_freelistN(&anim_data);
+}
+
+/* ------------------- */
+
+static int actkeys_deselectall_invoke(bContext *C, wmOperator *op, wmEvent *event)
+{
+ bAnimContext ac;
+
+ /* get editor data */
+ if ((ANIM_animdata_get_context(C, &ac) == 0) || (ac.data == NULL))
+ return OPERATOR_CANCELLED;
+
+ /* 'standard' behaviour - check if selected, then apply relevant selection */
+ deselect_action_keys(&ac, 1, 1);
+
+ /* set notifier tha things have changed */
+ ED_area_tag_redraw(CTX_wm_area(C)); // FIXME... should be updating 'keyframes' data context or so instead!
+
+ return OPERATOR_FINISHED;
+}
+
+void ED_ACT_OT_keyframes_deselectall (wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Deselect All";
+ ot->idname= "ED_ACT_OT_keyframes_deselectall";
+
+ /* api callbacks */
+ ot->invoke= actkeys_deselectall_invoke;
+ //ot->poll= ED_operator_areaactive;
+}
+
/* ******************** Column Select Operator **************************** */
/* ******************** Mouse-Click Select Operator *********************** */
@@ -343,8 +423,8 @@ static void mouse_action_keys (bAnimContext *ac, int mval[2], short selectmode)
bGPdata *gpd = NULL;
bGPDlayer *gpl = NULL;
- void *act_channel;
- short sel, act_type = 0;
+ void *anim_channel;
+ short sel, chan_type = 0;
float selx = 0.0f, selxa;
/* determine what type of data we are operating on */
@@ -355,48 +435,48 @@ static void mouse_action_keys (bAnimContext *ac, int mval[2], short selectmode)
else if (ac->datatype == ANIMCONT_GPENCIL)
gpd= (bGPdata *)ac->data;
- act_channel= get_nearest_action_key(ac, mval, &selx, &sel, &act_type, &achan);
- if (act_channel) {
+ anim_channel= get_nearest_action_key(ac, mval, &selx, &sel, &chan_type, &achan);
+ if (anim_channel) {
/* must have been a channel */
- switch (act_type) {
+ switch (chan_type) {
case ANIMTYPE_ICU:
- icu= (IpoCurve *)act_channel;
+ icu= (IpoCurve *)anim_channel;
break;
case ANIMTYPE_CONCHAN:
- conchan= (bConstraintChannel *)act_channel;
+ conchan= (bConstraintChannel *)anim_channel;
break;
case ANIMTYPE_ACHAN:
- achan= (bActionChannel *)act_channel;
+ achan= (bActionChannel *)anim_channel;
break;
case ANIMTYPE_GROUP:
- agrp= (bActionGroup *)act_channel;
+ agrp= (bActionGroup *)anim_channel;
break;
case ANIMTYPE_DSMAT:
- ipo= ((Material *)act_channel)->ipo;
+ ipo= ((Material *)anim_channel)->ipo;
break;
case ANIMTYPE_DSLAM:
- ipo= ((Lamp *)act_channel)->ipo;
+ ipo= ((Lamp *)anim_channel)->ipo;
break;
case ANIMTYPE_DSCAM:
- ipo= ((Camera *)act_channel)->ipo;
+ ipo= ((Camera *)anim_channel)->ipo;
break;
case ANIMTYPE_DSCUR:
- ipo= ((Curve *)act_channel)->ipo;
+ ipo= ((Curve *)anim_channel)->ipo;
break;
case ANIMTYPE_DSSKEY:
- ipo= ((Key *)act_channel)->ipo;
+ ipo= ((Key *)anim_channel)->ipo;
break;
case ANIMTYPE_FILLACTD:
- act= (bAction *)act_channel;
+ act= (bAction *)anim_channel;
break;
case ANIMTYPE_FILLIPOD:
- ipo= ((Object *)act_channel)->ipo;
+ ipo= ((Object *)anim_channel)->ipo;
break;
case ANIMTYPE_OBJECT:
- ob= ((Base *)act_channel)->object;
+ ob= ((Base *)anim_channel)->object;
break;
case ANIMTYPE_GPLAYER:
- gpl= (bGPDlayer *)act_channel;
+ gpl= (bGPDlayer *)anim_channel;
break;
default:
return;
@@ -405,7 +485,7 @@ static void mouse_action_keys (bAnimContext *ac, int mval[2], short selectmode)
if (selectmode == SELECT_REPLACE) {
selectmode = SELECT_ADD;
- //deselect_action_keys(0, 0); // XXX fixme
+ deselect_action_keys(ac, 0, 0);
if (ELEM(ac->datatype, ANIMCONT_ACTION, ANIMCONT_DOPESHEET)) {
//deselect_action_channels(0);
@@ -486,8 +566,6 @@ static int actkeys_clickselect_invoke(bContext *C, wmOperator *op, wmEvent *even
short in_scroller, selectmode;
int mval[2];
- puts("Action click select invoke");
-
/* get editor data */
if ((ANIM_animdata_get_context(C, &ac) == 0) || (ac.data == NULL))
return OPERATOR_CANCELLED;