== NLA Editor ==
Added some features to the NLA Editor that had previously only been added for the Action Editor. * It is now possible to choose whether timing is displayed in Frames or Seconds like in many of the other Animation Editors. Use Ctrl-T or the View menu to change this. * Autosnap behaviour from Action Editor is now also available for the NLA Editor. It was partially done in the previous commit (for transform). Use the new combo-box on the NLA Editor header (like the one on the Action Editor header) to set this. * editaction.c: silenced a compiler warning from the previous commit related to a function which is no longer needed.
This commit is contained in:
@@ -152,7 +152,7 @@ typedef struct SpaceAction {
|
||||
#define SACTION_SLIDERS 2 /* show sliders (if relevant) - limited to shape keys for now */
|
||||
#define SACTION_DRAWTIME 4 /* draw time in seconds instead of time in frames */
|
||||
|
||||
/* SpaceAction AutoSnap Settings */
|
||||
/* SpaceAction AutoSnap Settings (also used by SpaceNLA) */
|
||||
#define SACTSNAP_OFF 0 /* no auto-snap */
|
||||
#define SACTSNAP_STEP 1 /* snap to 1.0 frame/second intervals */
|
||||
#define SACTSNAP_FRAME 2 /* snap to actual frames/seconds (nla-action time) */
|
||||
|
||||
@@ -250,7 +250,7 @@ typedef struct SpaceImage {
|
||||
|
||||
} SpaceImage;
|
||||
|
||||
typedef struct SpaceNla{
|
||||
typedef struct SpaceNla {
|
||||
struct SpaceLink *next, *prev;
|
||||
int spacetype;
|
||||
float blockscale;
|
||||
@@ -259,7 +259,8 @@ typedef struct SpaceNla{
|
||||
short blockhandler[8];
|
||||
|
||||
short menunr, lock;
|
||||
int flag;
|
||||
short autosnap; /* this uses the same settings as autosnap for Action Editor */
|
||||
short flag;
|
||||
|
||||
View2D v2d;
|
||||
} SpaceNla;
|
||||
@@ -580,6 +581,7 @@ typedef struct SpaceImaSel {
|
||||
/* nla->flag */
|
||||
#define SNLA_ALLKEYED 1
|
||||
#define SNLA_ACTIVELAYERS 2
|
||||
#define SNLA_DRAWTIME 4
|
||||
|
||||
/* time->flag */
|
||||
#define TIME_DRAWFRAMES 1
|
||||
|
||||
@@ -230,6 +230,14 @@ void calc_ipogrid()
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SPACE_NLA: {
|
||||
SpaceNla *snla = curarea->spacedata.first;
|
||||
if (snla->flag & SNLA_DRAWTIME) {
|
||||
secondgrid = 1;
|
||||
secondiv = 0.01 * (float)G.scene->r.frs_sec;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -241,7 +249,7 @@ void calc_ipogrid()
|
||||
step_to_grid(&ipogrid_dx, &ipomachtx);
|
||||
ipogrid_dx*= secondiv;
|
||||
|
||||
if ELEM4(curarea->spacetype, SPACE_SEQ, SPACE_SOUND, SPACE_TIME, SPACE_ACTION) {
|
||||
if ELEM5(curarea->spacetype, SPACE_SEQ, SPACE_SOUND, SPACE_TIME, SPACE_ACTION, SPACE_NLA) {
|
||||
if(ipogrid_dx < 0.1) ipogrid_dx= 0.1;
|
||||
ipomachtx-= 2;
|
||||
if(ipomachtx<-2) ipomachtx= -2;
|
||||
@@ -252,7 +260,7 @@ void calc_ipogrid()
|
||||
ipogrid_dy= IPOSTEP*space/pixels;
|
||||
step_to_grid(&ipogrid_dy, &ipomachty);
|
||||
|
||||
if ELEM4(curarea->spacetype, SPACE_SEQ, SPACE_SOUND, SPACE_TIME, SPACE_ACTION) {
|
||||
if ELEM5(curarea->spacetype, SPACE_SEQ, SPACE_SOUND, SPACE_TIME, SPACE_ACTION, SPACE_NLA) {
|
||||
if(ipogrid_dy < 1.0) ipogrid_dy= 1.0;
|
||||
if(ipomachty<1) ipomachty= 1;
|
||||
}
|
||||
@@ -983,6 +991,18 @@ void drawscroll(int disptype)
|
||||
scroll_prstr(fac, 3.0+(float)(hor.ymin), val, 'h', disptype);
|
||||
}
|
||||
}
|
||||
else if (curarea->spacetype==SPACE_NLA) {
|
||||
SpaceNla *snla= curarea->spacedata.first;
|
||||
|
||||
if (snla->flag & SNLA_DRAWTIME) {
|
||||
fac2= val/(float)G.scene->r.frs_sec;
|
||||
scroll_prstr(fac, 3.0+(float)(hor.ymin), fac2, 'h', disptype);
|
||||
}
|
||||
else {
|
||||
ipomachtx= 1;
|
||||
scroll_prstr(fac, 3.0+(float)(hor.ymin), val, 'h', disptype);
|
||||
}
|
||||
}
|
||||
else {
|
||||
scroll_prstr(fac, 3.0+(float)(hor.ymin), val, 'h', disptype);
|
||||
}
|
||||
|
||||
@@ -173,21 +173,6 @@ void remake_action_ipos (bAction *act)
|
||||
synchronize_action_strips();
|
||||
}
|
||||
|
||||
static void remake_meshaction_ipos (Ipo *ipo)
|
||||
{
|
||||
/* this puts the bezier triples in proper
|
||||
* order and makes sure the bezier handles
|
||||
* aren't too strange.
|
||||
*/
|
||||
IpoCurve *icu;
|
||||
|
||||
for (icu = ipo->curve.first; icu; icu=icu->next) {
|
||||
sort_time_ipocurve(icu);
|
||||
testhandles_ipocurve(icu);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* **************************************************** */
|
||||
/* FILTER->EDIT STRUCTURES */
|
||||
/*
|
||||
|
||||
@@ -427,6 +427,12 @@ void snap_action_strips(int snap_mode)
|
||||
strip->end += diff;
|
||||
}
|
||||
}
|
||||
else if (snap_mode==3) {
|
||||
/* nearest second */
|
||||
float secf = (float)(G.scene->r.frs_sec);
|
||||
strip->start= (float)(floor(strip->start/secf + 0.5f) * secf);
|
||||
strip->end= (float)(floor(strip->end/secf + 0.5f) * secf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1866,8 +1872,11 @@ void winqreadnlaspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
|
||||
reset_action_strips(2);
|
||||
}
|
||||
else if(G.qual & LR_SHIFTKEY) {
|
||||
val= pupmenu("Snap To%t|Nearest Frame%x1|Current Frame%x2");
|
||||
if (val==1 || val==2)
|
||||
if (snla->flag & SNLA_DRAWTIME)
|
||||
val= pupmenu("Snap To%t|Nearest Second%x3|Current Time%x2");
|
||||
else
|
||||
val= pupmenu("Snap To%t|Nearest Frame%x1|Current Frame%x2");
|
||||
if (ELEM3(val, 1, 2, 3))
|
||||
snap_action_strips(val);
|
||||
}
|
||||
else {
|
||||
@@ -1877,6 +1886,19 @@ void winqreadnlaspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
|
||||
}
|
||||
break;
|
||||
|
||||
case TKEY:
|
||||
if (G.qual & LR_CTRLKEY) {
|
||||
val= pupmenu("Time value%t|Frames %x1|Seconds%x2");
|
||||
|
||||
if (val > 0) {
|
||||
if (val == 2) snla->flag |= SNLA_DRAWTIME;
|
||||
else snla->flag &= ~SNLA_DRAWTIME;
|
||||
|
||||
doredraw= 1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case DELKEY:
|
||||
case XKEY:
|
||||
if (mval[0]>=NLAWIDTH) {
|
||||
|
||||
@@ -122,6 +122,9 @@ static void do_nla_viewmenu(void *arg, int event)
|
||||
case 6: /* Show all objects that have keyframes? */
|
||||
G.snla->flag ^= SNLA_ALLKEYED;
|
||||
break;
|
||||
case 7: /* Show timing in Frames or Seconds */
|
||||
G.snla->flag ^= SNLA_DRAWTIME;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,6 +140,12 @@ static uiBlock *nla_viewmenu(void *arg_unused)
|
||||
uiDefIconTextBut(block, BUTM, 1, (G.snla->flag & SNLA_ALLKEYED)?ICON_CHECKBOX_DEHLT:ICON_CHECKBOX_HLT,
|
||||
"Only Objects On Visible Layers|", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
|
||||
|
||||
if (G.snla->flag & SNLA_DRAWTIME) {
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Frames|Ctrl T", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, "");
|
||||
} else {
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Seconds|Ctrl T", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, "");
|
||||
}
|
||||
|
||||
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
|
||||
|
||||
if(BTST(G.snla->lock, 0)) {
|
||||
@@ -501,6 +510,24 @@ void nla_buttons(void)
|
||||
uiBlockSetEmboss(block, UI_EMBOSS);
|
||||
|
||||
|
||||
/* draw AUTOSNAP */
|
||||
xco += 8;
|
||||
|
||||
if (G.snla->flag & SNLA_DRAWTIME) {
|
||||
uiDefButS(block, MENU, B_REDR,
|
||||
"Auto-Snap Strips/Keyframes %t|Off %x0|Second Step %x1|Nearest Second %x2",
|
||||
xco,0,70,YIC, &(G.snla->autosnap), 0, 1, 0, 0,
|
||||
"Auto-snapping mode for strips and keyframes when transforming");
|
||||
}
|
||||
else {
|
||||
uiDefButS(block, MENU, B_REDR,
|
||||
"Auto-Snap Strips/Keyframes %t|Off %x0|Frame Step %x1|Nearest Frame %x2",
|
||||
xco,0,70,YIC, &(G.snla->autosnap), 0, 1, 0, 0,
|
||||
"Auto-snapping mode for strips and keyframes when transforming");
|
||||
}
|
||||
|
||||
xco += (70 + 8);
|
||||
|
||||
/* FULL WINDOW */
|
||||
|
||||
|
||||
|
||||
@@ -3249,6 +3249,24 @@ static short getAnimEdit_SnapMode(TransInfo *t)
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (t->spacetype == SPACE_NLA && G.snla) {
|
||||
switch (G.snla->autosnap) {
|
||||
case SACTSNAP_OFF:
|
||||
if (G.qual == LR_CTRLKEY)
|
||||
autosnap= SACTSNAP_STEP;
|
||||
else if (G.qual == LR_SHIFTKEY)
|
||||
autosnap= SACTSNAP_FRAME;
|
||||
else
|
||||
autosnap= SACTSNAP_OFF;
|
||||
break;
|
||||
case SACTSNAP_STEP:
|
||||
autosnap= (G.qual==LR_CTRLKEY)? SACTSNAP_OFF: SACTSNAP_STEP;
|
||||
break;
|
||||
case SACTSNAP_FRAME:
|
||||
autosnap= (G.qual==LR_SHIFTKEY)? SACTSNAP_OFF: SACTSNAP_FRAME;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (G.qual == LR_CTRLKEY)
|
||||
autosnap= SACTSNAP_STEP;
|
||||
@@ -3271,10 +3289,10 @@ static short getAnimEdit_DrawTime(TransInfo *t)
|
||||
|
||||
/* currently, some of these are only for the action editor */
|
||||
if (t->spacetype == SPACE_ACTION && G.saction) {
|
||||
if (G.saction->flag & SACTION_DRAWTIME)
|
||||
drawtime = 1;
|
||||
else
|
||||
drawtime = 0;
|
||||
drawtime = (G.saction->flag & SACTION_DRAWTIME)? 1 : 0;
|
||||
}
|
||||
else if (t->spacetype == SPACE_NLA && G.snla) {=
|
||||
drawtime = (G.snla->flag & SNLA_DRAWTIME)? 1 : 0;
|
||||
}
|
||||
else {
|
||||
drawtime = 0;
|
||||
|
||||
Reference in New Issue
Block a user