== NLA Editor ==
Todo Tracker Item: #4754 Now the 'Convert Action to NLA Strip' command (CKEY) is able to be found in the NLA editor's header in the Strip Menu. It now tries to add a convert the active action of the active object (so it is no longer dependant on mouse location).
This commit is contained in:
@@ -54,6 +54,7 @@ void reset_action_strips(int val);
|
||||
void synchronize_action_strips(void);
|
||||
void snap_action_strips(int snap_mode);
|
||||
void add_nlablock(void);
|
||||
void convert_nla(void);
|
||||
void copy_action_modifiers(void);
|
||||
|
||||
/* Baking */
|
||||
|
||||
@@ -99,7 +99,6 @@ static Base *get_nearest_nlachannel_ob_key (float *index, short *sel);
|
||||
static bAction *get_nearest_nlachannel_ac_key (float *index, short *sel);
|
||||
static Base *get_nearest_nlastrip (bActionStrip **rstrip, short *sel);
|
||||
static void mouse_nlachannels(short mval[2]);
|
||||
static void convert_nla(short mval[2]);
|
||||
|
||||
/* ******************** SPACE: NLA ********************** */
|
||||
|
||||
@@ -308,75 +307,29 @@ static void set_active_strip(Object *ob, bActionStrip *act)
|
||||
}
|
||||
}
|
||||
|
||||
static void convert_nla(short mval[2])
|
||||
void convert_nla(void)
|
||||
{
|
||||
bActionStrip *strip, *nstrip;
|
||||
Base *base;
|
||||
float x,y;
|
||||
float ymax, ymin;
|
||||
int sel=0;
|
||||
short event;
|
||||
bActionStrip *strip;
|
||||
Object *ob= OBACT;
|
||||
char str[128];
|
||||
short event;
|
||||
|
||||
/* Find out what strip we're over */
|
||||
ymax = count_nla_levels() * (NLACHANNELSKIP+NLACHANNELHEIGHT);
|
||||
ymax+= NLACHANNELHEIGHT/2;
|
||||
|
||||
areamouseco_to_ipoco(G.v2d, mval, &x, &y);
|
||||
|
||||
for (base=G.scene->base.first; base; base=base->next){
|
||||
if (nla_filter(base)) {
|
||||
|
||||
/* Area that encloses object name (or ipo) */
|
||||
ymin=ymax-(NLACHANNELHEIGHT+NLACHANNELSKIP);
|
||||
|
||||
/* skip if object collapsed */
|
||||
if (base->object->nlaflag & OB_NLA_COLLAPSED)
|
||||
continue;
|
||||
|
||||
ymax=ymin;
|
||||
|
||||
/* Check action ipo */
|
||||
if (base->object->action) {
|
||||
ymin=ymax-(NLACHANNELSKIP+NLACHANNELHEIGHT);
|
||||
if (y>=ymin && y<=ymax)
|
||||
break;
|
||||
ymax=ymin;
|
||||
}
|
||||
|
||||
/* Check nlastrips */
|
||||
for (strip=base->object->nlastrips.first; strip; strip=strip->next){
|
||||
ymin=ymax-(NLACHANNELSKIP+NLACHANNELHEIGHT);
|
||||
if (y>=ymin && y<=ymax){
|
||||
sel = 1;
|
||||
break;
|
||||
}
|
||||
ymax=ymin;
|
||||
}
|
||||
if (sel)
|
||||
break;
|
||||
}
|
||||
if ((ob==NULL)||(ob->action==NULL)) {
|
||||
error("Need active Object to convert Action to NLA Strip");
|
||||
return;
|
||||
}
|
||||
|
||||
if (base==0 || base->object->action==NULL)
|
||||
return;
|
||||
|
||||
sprintf(str, "Convert Action%%t|%s to NLA Strip%%x1", base->object->action->id.name+2);
|
||||
sprintf(str, "Convert Action%%t|%s to NLA Strip%%x1", ob->action->id.name+2);
|
||||
event = pupmenu(str);
|
||||
|
||||
switch (event){
|
||||
case 1:
|
||||
if (base->object->action) {
|
||||
if (event==1) {
|
||||
if (ob->action) {
|
||||
deselect_nlachannel_keys(0);
|
||||
nstrip = convert_action_to_strip(base->object); //creates a new NLA strip from the action in given object
|
||||
set_active_strip(base->object, nstrip);
|
||||
strip = convert_action_to_strip(ob); //creates a new NLA strip from the action in given object
|
||||
set_active_strip(ob, strip);
|
||||
BIF_undo_push("Convert NLA");
|
||||
allqueue (REDRAWNLA, 0);
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1812,7 +1765,7 @@ void winqreadnlaspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
|
||||
if(okee("Copy Modifiers"))
|
||||
copy_action_modifiers();
|
||||
}
|
||||
else convert_nla(mval);
|
||||
else convert_nla();
|
||||
break;
|
||||
|
||||
case DKEY:
|
||||
|
||||
@@ -304,6 +304,7 @@ static void do_nla_stripmenu(void *arg, int event)
|
||||
}
|
||||
break;
|
||||
case 5: /* Convert Action to NLA Strip */
|
||||
convert_nla();
|
||||
break;
|
||||
case 6: /* Move Up */
|
||||
shift_nlastrips_up();
|
||||
@@ -337,6 +338,8 @@ static uiBlock *nla_stripmenu(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, "Add Action Strip|Shift A", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, "");
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Convert Action to NLA Strip|C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 5, "");
|
||||
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Duplicate|Shift D", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 2, "");
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Delete|X", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 3, "");
|
||||
|
||||
@@ -344,8 +347,7 @@ static uiBlock *nla_stripmenu(void *arg_unused)
|
||||
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Move Down|Ctrl Page Down", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 7, "");
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Move Up|Ctrl Page Up", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 6, "");
|
||||
|
||||
// uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Convert Action to NLA Strip|C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 5, "");
|
||||
|
||||
|
||||
if(curarea->headertype==HEADERTOP) {
|
||||
uiBlockSetDirection(block, UI_DOWN);
|
||||
|
||||
Reference in New Issue
Block a user