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>2006-12-05 08:25:34 +0300
committerJoshua Leung <aligorith@gmail.com>2006-12-05 08:25:34 +0300
commit246ab11255a4f5a3a2f024ef708b6807a5f63317 (patch)
treeac73976ad240a4cf53af831a8215434c1c8cc219 /source/blender/src
parent201df23d5474b7257ccf25b5f5b763e94a62d46f (diff)
Some more action editor goodies:
* Now it is possible to invert the selection status of keyframes and markers. These options can only be found in the Select menu in the header. * It is also possible to select the keyframes that occur within the 2 'extreme' selected markers. Hotkey for this is Ctrl K
Diffstat (limited to 'source/blender/src')
-rw-r--r--source/blender/src/editaction.c82
-rw-r--r--source/blender/src/editipo_mods.c7
-rw-r--r--source/blender/src/edittime.c63
-rw-r--r--source/blender/src/header_action.c67
4 files changed, 168 insertions, 51 deletions
diff --git a/source/blender/src/editaction.c b/source/blender/src/editaction.c
index 9bfc9bdf40b..33784d9663f 100644
--- a/source/blender/src/editaction.c
+++ b/source/blender/src/editaction.c
@@ -631,7 +631,7 @@ static void mouse_action(int selectmode)
if (selectmode == SELECT_REPLACE) {
selectmode = SELECT_ADD;
- deselect_actionchannel_keys(act, 0);
+ deselect_actionchannel_keys(act, 0, 0);
deselect_actionchannels(act, 0);
chan->flag |= ACHAN_SELECTED;
@@ -716,7 +716,7 @@ static void mouse_mesh_action(int selectmode, Key *key)
* key had been unselected, we will select
* it, otherwise, we are done.
*/
- deselect_meshchannel_keys(key, 0);
+ deselect_meshchannel_keys(key, 0, 0);
if (sel == 0)
selectmode = SELECT_ADD;
@@ -1388,11 +1388,10 @@ void transform_meshchannel_keys(char mode, Key *key)
*/
}
-void deselect_actionchannel_keys (bAction *act, int test)
+void deselect_actionchannel_keys (bAction *act, int test, int sel)
{
bActionChannel *chan;
bConstraintChannel *conchan;
- int sel=1;;
if (!act)
return;
@@ -1421,8 +1420,6 @@ void deselect_actionchannel_keys (bAction *act, int test)
}
}
}
- else
- sel=0;
/* Set the flags */
for (chan=act->chanbase.first; chan; chan=chan->next){
@@ -1434,11 +1431,10 @@ void deselect_actionchannel_keys (bAction *act, int test)
}
}
-void deselect_meshchannel_keys (Key *key, int test)
+void deselect_meshchannel_keys (Key *key, int test, int sel)
{
/* should deselect the rvk keys
*/
- int sel=1;
/* Determine if this is selection or deselection */
if (test){
@@ -1446,9 +1442,6 @@ void deselect_meshchannel_keys (Key *key, int test)
sel = 0;
}
}
- else {
- sel=0;
- }
/* Set the flags */
set_ipo_key_selection(key->ipo, sel);
@@ -2229,7 +2222,7 @@ static void select_all_keys_frames(bAction *act, short *mval,
return;
if (selectmode == SELECT_REPLACE) {
- deselect_actionchannel_keys(act, 0);
+ deselect_actionchannel_keys(act, 0, 1);
selectmode = SELECT_ADD;
}
@@ -2309,7 +2302,7 @@ static void select_all_keys_channels(bAction *act, short *mval,
return;
if (selectmode == SELECT_REPLACE) {
- deselect_actionchannel_keys(act, 0);
+ deselect_actionchannel_keys(act, 0, 1);
selectmode = SELECT_ADD;
}
@@ -2555,7 +2548,7 @@ void winqreadactionspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
allqueue(REDRAWSOUND, 0);
}
else {
- deselect_meshchannel_keys(key, 1);
+ deselect_meshchannel_keys(key, 1, 1);
allqueue (REDRAWACTION, 0);
allqueue(REDRAWNLA, 0);
allqueue (REDRAWIPO, 0);
@@ -2580,7 +2573,7 @@ void winqreadactionspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
allqueue(REDRAWSOUND, 0);
}
else {
- deselect_actionchannel_keys (act, 1);
+ deselect_actionchannel_keys (act, 1, 1);
allqueue (REDRAWACTION, 0);
allqueue(REDRAWNLA, 0);
allqueue (REDRAWIPO, 0);
@@ -2697,12 +2690,17 @@ void winqreadactionspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
break;
case KKEY:
- val= (G.qual & LR_SHIFTKEY) ? 2 : 1;
-
- if(key)
- column_select_shapekeys(key, val);
- else if(act)
- column_select_actionkeys(act, val);
+ if (G.qual & LR_CTRLKEY) {
+ markers_selectkeys_between();
+ }
+ else {
+ val= (G.qual & LR_SHIFTKEY) ? 2 : 1;
+
+ if(key)
+ column_select_shapekeys(key, val);
+ else if(act)
+ column_select_actionkeys(act, val);
+ }
allqueue(REDRAWTIME, 0);
allqueue(REDRAWIPO, 0);
@@ -3004,26 +3002,40 @@ int get_nearest_key_num(Key *key, short *mval, float *x) {
}
/* ************************************* Action Editor Markers ************************************* */
-void get_minmax_saction_markers(float *first, float *last)
+
+void markers_selectkeys_between(void)
{
- TimeMarker *marker;
- ListBase *markers;
+ bAction *act;
+ Key *key;
float min, max;
- markers= &(G.scene->markers);
+ /* get extreme markers */
+ get_minmax_markers(1, &min, &max);
+ if (min==max) return;
- min= ((TimeMarker *)markers->first)->frame;
- max= ((TimeMarker *)markers->last)->frame;
+ /* get keyframe data */
+ act = G.saction->action;
+ key = get_action_mesh_key();
- for (marker= markers->first; marker; marker= marker->next) {
- if (marker->frame < min)
- min= marker->frame;
- else if (marker->frame > max)
- max= marker->frame;
+ /* select keys in-between */
+ if (key) {
+ if (key->ipo)
+ borderselect_ipo_key(key->ipo, min, max, SELECT_ADD);
+ }
+ else {
+ bActionChannel *achan;
+ bConstraintChannel *conchan;
+
+ for (achan= act->chanbase.first; achan; achan= achan->next) {
+ if (achan->ipo)
+ borderselect_ipo_key(achan->ipo, min, max, SELECT_ADD);
+
+ for (conchan= achan->constraintChannels.first; conchan; conchan= conchan->next) {
+ if (conchan->ipo)
+ borderselect_ipo_key(conchan->ipo, min, max, SELECT_ADD);
+ }
+ }
}
-
- *first= min;
- *last= max;
}
/* ************************************* Action Channel Ordering *********************************** */
diff --git a/source/blender/src/editipo_mods.c b/source/blender/src/editipo_mods.c
index fd9a60edf3e..b54ae5d4f01 100644
--- a/source/blender/src/editipo_mods.c
+++ b/source/blender/src/editipo_mods.c
@@ -995,7 +995,12 @@ void set_ipo_key_selection(Ipo *ipo, int sel)
for (icu=ipo->curve.first; icu; icu=icu->next){
for (i=0; i<icu->totvert; i++){
- if (sel){
+ if (sel == 2) {
+ icu->bezt[i].f1^=1;
+ icu->bezt[i].f2^=1;
+ icu->bezt[i].f3^=1;
+ }
+ else if (sel == 1){
icu->bezt[i].f1|=1;
icu->bezt[i].f2|=1;
icu->bezt[i].f3|=1;
diff --git a/source/blender/src/edittime.c b/source/blender/src/edittime.c
index ad2d07f590e..d71bc81b143 100644
--- a/source/blender/src/edittime.c
+++ b/source/blender/src/edittime.c
@@ -1,5 +1,5 @@
/**
- * $Id:
+ * $Id: BIF_edittime.c
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -294,7 +294,10 @@ void deselect_markers(short test, short sel)
/* do selection */
for (marker= G.scene->markers.first; marker; marker= marker->next) {
- if (sel) {
+ if (sel == 2) {
+ marker->flag ^= SELECT;
+ }
+ else if (sel == 1) {
if ((marker->flag & SELECT)==0)
marker->flag |= SELECT;
}
@@ -307,7 +310,10 @@ void deselect_markers(short test, short sel)
else {
/* not dependant on existing selection */
for (marker= G.scene->markers.first; marker; marker= marker->next) {
- if (sel) {
+ if (sel==2) {
+ marker->flag ^= SELECT;
+ }
+ else if (sel==1) {
if ((marker->flag & SELECT)==0)
marker->flag |= SELECT;
}
@@ -405,6 +411,57 @@ void nextprev_marker(short dir)
}
}
+void get_minmax_markers(short sel, float *first, float *last)
+{
+ TimeMarker *marker;
+ ListBase *markers;
+ float min, max;
+ int selcount = 0;
+
+ markers= &(G.scene->markers);
+
+ if (sel)
+ for (marker= markers->first; marker; marker= marker->next) {
+ if (marker->flag & SELECT)
+ selcount++;
+ }
+ else {
+ selcount= BLI_countlist(markers);
+ }
+
+ if (markers->first && markers->last) {
+ min= ((TimeMarker *)markers->first)->frame;
+ max= ((TimeMarker *)markers->last)->frame;
+ }
+ else {
+ *first = 0.0f;
+ *last = 0.0f;
+ return;
+ }
+
+ if (selcount > 1) {
+ for (marker= markers->first; marker; marker= marker->next) {
+ if (sel) {
+ if (marker->flag & SELECT) {
+ if (marker->frame < min)
+ min= marker->frame;
+ else if (marker->frame > max)
+ max= marker->frame;
+ }
+ }
+ else {
+ if (marker->frame < min)
+ min= marker->frame;
+ else if (marker->frame > max)
+ max= marker->frame;
+ }
+ }
+ }
+
+ *first= min;
+ *last= max;
+}
+
TimeMarker *find_nearest_marker(int clip_y)
{
TimeMarker *marker;
diff --git a/source/blender/src/header_action.c b/source/blender/src/header_action.c
index b59f63682ca..76244ff2e6a 100644
--- a/source/blender/src/header_action.c
+++ b/source/blender/src/header_action.c
@@ -93,6 +93,8 @@
#define ACTMENU_SEL_ALL_KEYS 2
#define ACTMENU_SEL_ALL_CHAN 3
#define ACTMENU_SEL_ALL_MARKERS 4
+#define ACTMENU_SEL_INVERSE_KEYS 5
+#define ACTMENU_SEL_INVERSE_MARKERS 6
#define ACTMENU_SEL_COLUMN_KEYS 1
#define ACTMENU_SEL_COLUMN_MARKERSCOLUMN 2
@@ -362,19 +364,21 @@ static void do_action_selectmenu_columnmenu(void *arg, int event)
bAction *act;
Key *key;
- key = get_action_mesh_key();
saction= curarea->spacedata.first;
-
act=saction->action;
+ key = get_action_mesh_key();
- if ( ELEM3(event, ACTMENU_SEL_COLUMN_KEYS, ACTMENU_SEL_COLUMN_MARKERSCOLUMN,
- ACTMENU_SEL_COLUMN_MARKERSBETWEEN) == 0)
- return;
-
- if (key)
- column_select_shapekeys(key, event);
+ if (event == ACTMENU_SEL_COLUMN_MARKERSBETWEEN) {
+ markers_selectkeys_between();
+ }
+ else if (ELEM(event, ACTMENU_SEL_COLUMN_KEYS, ACTMENU_SEL_COLUMN_MARKERSCOLUMN)) {
+ if (key)
+ column_select_shapekeys(key, event);
+ else
+ column_select_actionkeys(act, event);
+ }
else
- column_select_actionkeys(act, event);
+ return;
allqueue(REDRAWTIME, 0);
allqueue(REDRAWIPO, 0);
@@ -398,6 +402,9 @@ static uiBlock *action_selectmenu_columnmenu(void *arg_unused)
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
"On Selected Markers|Shift K", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0,
ACTMENU_SEL_COLUMN_MARKERSCOLUMN, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
+ "Between Selected Markers|Ctrl K", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0,
+ ACTMENU_SEL_COLUMN_MARKERSBETWEEN, "");
uiBlockSetDirection(block, UI_RIGHT);
@@ -436,13 +443,13 @@ static void do_action_selectmenu(void *arg, int event)
case ACTMENU_SEL_ALL_KEYS: /* Select/Deselect All Keys */
if (key) {
- deselect_meshchannel_keys(key, 1);
+ deselect_meshchannel_keys(key, 1, 1);
allqueue (REDRAWACTION, 0);
allqueue(REDRAWNLA, 0);
allqueue (REDRAWIPO, 0);
}
else {
- deselect_actionchannel_keys (act, 1);
+ deselect_actionchannel_keys (act, 1, 1);
allqueue (REDRAWACTION, 0);
allqueue(REDRAWNLA, 0);
allqueue (REDRAWIPO, 0);
@@ -465,6 +472,30 @@ static void do_action_selectmenu(void *arg, int event)
allqueue(REDRAWNLA, 0);
allqueue(REDRAWSOUND, 0);
break;
+
+ case ACTMENU_SEL_INVERSE_KEYS: /* invert selection status of keys */
+ if (key) {
+ deselect_meshchannel_keys(key, 0, 2);
+ allqueue (REDRAWACTION, 0);
+ allqueue(REDRAWNLA, 0);
+ allqueue (REDRAWIPO, 0);
+ }
+ else {
+ deselect_actionchannel_keys (act, 0, 2);
+ allqueue (REDRAWACTION, 0);
+ allqueue(REDRAWNLA, 0);
+ allqueue (REDRAWIPO, 0);
+ }
+ break;
+
+ case ACTMENU_SEL_INVERSE_MARKERS: /* invert selection of markers */
+ deselect_markers(0, 2);
+ allqueue(REDRAWTIME, 0);
+ allqueue(REDRAWIPO, 0);
+ allqueue(REDRAWACTION, 0);
+ allqueue(REDRAWNLA, 0);
+ allqueue(REDRAWSOUND, 0);
+ break;
}
}
@@ -504,7 +535,19 @@ static uiBlock *action_selectmenu(void *arg_unused)
uiDefBut(block, SEPR, 0, "", 0, yco-=6,
menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
+
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
+ "Inverse Keys", 0, yco-=20,
+ menuwidth, 19, NULL, 0.0, 0.0, 0,
+ ACTMENU_SEL_INVERSE_KEYS, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
+ "Inverse Markers", 0, yco-=20,
+ menuwidth, 19, NULL, 0.0, 0.0, 0,
+ ACTMENU_SEL_INVERSE_MARKERS, "");
+
+ uiDefBut(block, SEPR, 0, "", 0, yco-=6,
+ menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
+
uiDefIconTextBlockBut(block, action_selectmenu_columnmenu,
NULL, ICON_RIGHTARROW_THIN, "Column Select Keys", 0, yco-=20, 120, 20, "");