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 06:48:39 +0300
committerJoshua Leung <aligorith@gmail.com>2006-12-05 06:48:39 +0300
commit201df23d5474b7257ccf25b5f5b763e94a62d46f (patch)
tree7cc03e39b35690d62e506773a8f677d6bd785a82
parent0f7f11fafc72daee9328f0abb1e9fc77d1861ea0 (diff)
== Action Editor - Column Select Tools ==
Now it is possible to column select keyframes that occur on the same frame as selected markers with the hotkey: SHIFT K More selection goodies to come :-)
-rw-r--r--source/blender/include/BIF_editaction.h3
-rw-r--r--source/blender/include/BSE_time.h6
-rw-r--r--source/blender/src/editaction.c56
-rw-r--r--source/blender/src/edittime.c37
-rw-r--r--source/blender/src/header_action.c89
5 files changed, 141 insertions, 50 deletions
diff --git a/source/blender/include/BIF_editaction.h b/source/blender/include/BIF_editaction.h
index ca4f7944460..363f8eae186 100644
--- a/source/blender/include/BIF_editaction.h
+++ b/source/blender/include/BIF_editaction.h
@@ -113,7 +113,8 @@ void deselect_actionchannels (struct bAction *act, int test);
void deselect_meshchannel_keys (struct Key *key, int test);
int select_channel(struct bAction *act, struct bActionChannel *chan, int selectmode);
void select_actionchannel_by_name (struct bAction *act, char *name, int select);
-
+void column_select_meshkeys(struct Key *key, int mode);
+void column_select_actionkeys(struct bAction *act, int mode);
/* Action */
struct bActionChannel* get_hilighted_action_channel(struct bAction* action);
diff --git a/source/blender/include/BSE_time.h b/source/blender/include/BSE_time.h
index dfae47d2133..c3326d93393 100644
--- a/source/blender/include/BSE_time.h
+++ b/source/blender/include/BSE_time.h
@@ -33,6 +33,7 @@
#ifndef BSE_TIME_H
#define BSE_TIME_H
+struct ListBase;
struct View2D;
/* ******** Markers - General Api ********* */
@@ -41,11 +42,16 @@ void duplicate_marker(void);
void remove_marker(void);
void rename_marker(void);
void transform_markers(int mode, int smode);
+
void borderselect_markers(void);
void deselect_markers(short test, short sel);
struct TimeMarker *find_nearest_marker(int clip_y);
+
void nextprev_marker(short dir);
+void add_marker_to_cfra_elem(struct ListBase *lb, struct TimeMarker *marker);
+void make_marker_cfra_list(struct ListBase *lb);
+
/* ******** Markers - Space Specific ************* */
void draw_markers_timespace(struct View2D *v2d);
diff --git a/source/blender/src/editaction.c b/source/blender/src/editaction.c
index c7d5223f702..9bfc9bdf40b 100644
--- a/source/blender/src/editaction.c
+++ b/source/blender/src/editaction.c
@@ -485,16 +485,24 @@ static void make_sel_cfra_list(Ipo *ipo, ListBase *elems)
/* This function selects all key frames in the same column(s) as a already selected key(s)
* this version only works for Shape Keys, Key should be not NULL
*/
-static void column_select_shapekeys(Key *key)
+void column_select_shapekeys(Key *key, int mode)
{
-
if(key->ipo) {
IpoCurve *icu;
ListBase elems= {NULL, NULL};
CfraElem *ce;
- /* create a list of all selected keys */
- make_sel_cfra_list(key->ipo, &elems);
+ /* build list of columns */
+ switch (mode) {
+ case 1:
+ /* create a list of all selected keys */
+ make_sel_cfra_list(key->ipo, &elems);
+ break;
+ case 2:
+ /* create a list of all selected markers */
+ make_marker_cfra_list(&elems);
+ break;
+ }
/* loop through all of the keys and select additional keyframes
* based on the keys found to be selected above
@@ -521,7 +529,7 @@ static void column_select_shapekeys(Key *key)
/* This function selects all key frames in the same column(s) as a already selected key(s)
* this version only works for on Action. *act should be not NULL
*/
-static void column_select_actionkeys(bAction *act)
+void column_select_actionkeys(bAction *act, int mode)
{
IpoCurve *icu;
BezTriple *bezt;
@@ -530,18 +538,27 @@ static void column_select_actionkeys(bAction *act)
bActionChannel *chan;
bConstraintChannel *conchan;
- /* create a list of all selected keys */
- for (chan=act->chanbase.first; chan; chan=chan->next){
- if((chan->flag & ACHAN_HIDDEN)==0) {
- if (chan->ipo)
- make_sel_cfra_list(chan->ipo, &elems);
- for (conchan=chan->constraintChannels.first; conchan; conchan=conchan->next) {
- if (conchan->ipo)
- make_sel_cfra_list(conchan->ipo, &elems);
+ /* build list of columns */
+ switch (mode) {
+ case 1:
+ /* create a list of all selected keys */
+ for (chan=act->chanbase.first; chan; chan=chan->next){
+ if((chan->flag & ACHAN_HIDDEN)==0) {
+ if (chan->ipo)
+ make_sel_cfra_list(chan->ipo, &elems);
+ for (conchan=chan->constraintChannels.first; conchan; conchan=conchan->next) {
+ if (conchan->ipo)
+ make_sel_cfra_list(conchan->ipo, &elems);
+ }
+ }
}
- }
+ break;
+ case 2:
+ /* create a list of all selected markers */
+ make_marker_cfra_list(&elems);
+ break;
}
-
+
/* loop through all of the keys and select additional keyframes
* based on the keys found to be selected above
*/
@@ -2680,15 +2697,18 @@ void winqreadactionspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
break;
case KKEY:
+ val= (G.qual & LR_SHIFTKEY) ? 2 : 1;
+
if(key)
- column_select_shapekeys(key);
+ column_select_shapekeys(key, val);
else if(act)
- column_select_actionkeys(act);
+ column_select_actionkeys(act, val);
+ allqueue(REDRAWTIME, 0);
allqueue(REDRAWIPO, 0);
- allqueue(REDRAWVIEW3D, 0);
allqueue(REDRAWACTION, 0);
allqueue(REDRAWNLA, 0);
+ allqueue(REDRAWSOUND, 0);
break;
case MKEY:
diff --git a/source/blender/src/edittime.c b/source/blender/src/edittime.c
index ffa2b8b8354..ad2d07f590e 100644
--- a/source/blender/src/edittime.c
+++ b/source/blender/src/edittime.c
@@ -435,6 +435,43 @@ TimeMarker *find_nearest_marker(int clip_y)
return NULL;
}
+/* Adds a marker to list of cfra elems */
+void add_marker_to_cfra_elem(ListBase *lb, TimeMarker *marker)
+{
+ CfraElem *ce, *cen;
+
+ ce= lb->first;
+ while(ce) {
+
+ if( ce->cfra==marker->frame ) {
+ /* do because of double keys */
+ if(marker->flag & SELECT) ce->sel= marker->flag;
+ return;
+ }
+ else if(ce->cfra > marker->frame) break;
+
+ ce= ce->next;
+ }
+
+ cen= MEM_callocN(sizeof(CfraElem), "add_to_cfra_elem");
+ if(ce) BLI_insertlinkbefore(lb, ce, cen);
+ else BLI_addtail(lb, cen);
+
+ cen->cfra= marker->frame;
+ cen->sel= marker->flag;
+}
+
+/* This function makes a list of the selected markers
+ */
+void make_marker_cfra_list(ListBase *lb)
+{
+ TimeMarker *marker;
+
+ for (marker= G.scene->markers.first; marker; marker= marker->next) {
+ add_marker_to_cfra_elem(lb, marker);
+ }
+}
+
/* *********** End Markers - Markers API *************** */
static int find_nearest_timeline_marker(float dx)
diff --git a/source/blender/src/header_action.c b/source/blender/src/header_action.c
index 194d4976f51..b59f63682ca 100644
--- a/source/blender/src/header_action.c
+++ b/source/blender/src/header_action.c
@@ -92,10 +92,11 @@
#define ACTMENU_SEL_BORDERM 1
#define ACTMENU_SEL_ALL_KEYS 2
#define ACTMENU_SEL_ALL_CHAN 3
-#define ACTMENU_SEL_COLUMN 4
-#define ACTMENU_SEL_ALL_MARKERS 5
-#define ACTMENU_SEL_MARKERS_KEYSBETWEEN 6
-#define ACTMENU_SEL_MARKERS_KEYSCOLUMN 7
+#define ACTMENU_SEL_ALL_MARKERS 4
+
+#define ACTMENU_SEL_COLUMN_KEYS 1
+#define ACTMENU_SEL_COLUMN_MARKERSCOLUMN 2
+#define ACTMENU_SEL_COLUMN_MARKERSBETWEEN 3
#define ACTMENU_KEY_DUPLICATE 0
#define ACTMENU_KEY_DELETE 1
@@ -355,6 +356,56 @@ static uiBlock *action_viewmenu(void *arg_unused)
return block;
}
+static void do_action_selectmenu_columnmenu(void *arg, int event)
+{
+ SpaceAction *saction;
+ bAction *act;
+ Key *key;
+
+ key = get_action_mesh_key();
+ saction= curarea->spacedata.first;
+
+ act=saction->action;
+
+ if ( ELEM3(event, ACTMENU_SEL_COLUMN_KEYS, ACTMENU_SEL_COLUMN_MARKERSCOLUMN,
+ ACTMENU_SEL_COLUMN_MARKERSBETWEEN) == 0)
+ return;
+
+ if (key)
+ column_select_shapekeys(key, event);
+ else
+ column_select_actionkeys(act, event);
+
+ allqueue(REDRAWTIME, 0);
+ allqueue(REDRAWIPO, 0);
+ allqueue(REDRAWACTION, 0);
+ allqueue(REDRAWNLA, 0);
+ allqueue(REDRAWSOUND, 0);
+}
+
+static uiBlock *action_selectmenu_columnmenu(void *arg_unused)
+{
+ uiBlock *block;
+ short yco= 0, menuwidth=120;
+
+ block= uiNewBlock(&curarea->uiblocks, "action_selectmenu_columnmenu",
+ UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
+ uiBlockSetButmFunc(block, do_action_selectmenu_columnmenu, NULL);
+
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
+ "On Selected Keys|K", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0,
+ ACTMENU_SEL_COLUMN_KEYS, "");
+ 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, "");
+
+
+ uiBlockSetDirection(block, UI_RIGHT);
+ uiTextBoundsBlock(block, 60);
+
+ return block;
+}
+
static void do_action_selectmenu(void *arg, int event)
{
SpaceAction *saction;
@@ -414,16 +465,6 @@ static void do_action_selectmenu(void *arg, int event)
allqueue(REDRAWNLA, 0);
allqueue(REDRAWSOUND, 0);
break;
-
- case ACTMENU_SEL_COLUMN: /* select column */
- addqueue (curarea->win, KKEY, 1);
- break;
-
- case ACTMENU_SEL_MARKERS_KEYSBETWEEN: /* keys between 2 extreme selected markers */
- break;
-
- case ACTMENU_SEL_MARKERS_KEYSCOLUMN: /* keys on same frame as marker(s) */
- break;
}
}
@@ -463,23 +504,9 @@ 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,
- "Select Keys Column|K", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 0,
- ACTMENU_SEL_COLUMN, "");
-
-/*
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
- "Select Keys At Markers|CTRL K", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 0,
- ACTMENU_SEL_MARKERS_KEYSCOLUMN, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
- "Select Keys Between Markers|SHIFT K", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 0,
- ACTMENU_SEL_MARKERS_KEYSBETWEEN, "");
-*/
+
+ uiDefIconTextBlockBut(block, action_selectmenu_columnmenu,
+ NULL, ICON_RIGHTARROW_THIN, "Column Select Keys", 0, yco-=20, 120, 20, "");
if(curarea->headertype==HEADERTOP) {
uiBlockSetDirection(block, UI_DOWN);