forked from bartvdbraak/blender
== NLA Editor ==
Strips under an object's strip in the NLA editor can now get collapsed, like items in the Outliner. Once an object's strips have been collapsed, it is still possible to add strips to that object; Other operations will not be possible.
This commit is contained in:
parent
877688129a
commit
ab150e8512
@ -426,6 +426,7 @@ extern Object workob;
|
||||
|
||||
/* ob->nlaflag */
|
||||
#define OB_NLA_OVERRIDE 1
|
||||
#define OB_NLA_COLLAPSED 2
|
||||
|
||||
/* ob->protectflag */
|
||||
#define OB_LOCK_LOCX 1
|
||||
|
@ -87,6 +87,7 @@
|
||||
|
||||
#define TESTBASE_SAFE(base) ((base)->flag & SELECT)
|
||||
|
||||
|
||||
/* the left hand side with channels only */
|
||||
static void draw_nla_channels(void)
|
||||
{
|
||||
@ -126,74 +127,83 @@ static void draw_nla_channels(void)
|
||||
BIF_ThemeColor(TH_TEXT_HI);
|
||||
else
|
||||
BIF_ThemeColor(TH_TEXT);
|
||||
glRasterPos2f(x+21, y-4);
|
||||
|
||||
glRasterPos2f(x+34, y-4);
|
||||
BMF_DrawString(G.font, ob->id.name+2);
|
||||
|
||||
/* icon to indicate nla or action */
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) ;
|
||||
|
||||
/* icon to indicate expanded or collapsed */
|
||||
if (ob->nlaflag & OB_NLA_COLLAPSED)
|
||||
BIF_icon_draw(x+1, y-8, ICON_TRIA_RIGHT);
|
||||
else
|
||||
BIF_icon_draw(x+1, y-8, ICON_TRIA_DOWN);
|
||||
|
||||
/* icon to indicate nla or action */
|
||||
if(ob->nlastrips.first && ob->action) {
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) ;
|
||||
if(ob->nlaflag & OB_NLA_OVERRIDE)
|
||||
BIF_icon_draw(x+5, y-8, ICON_NLA);
|
||||
BIF_icon_draw(x+17, y-8, ICON_NLA);
|
||||
else
|
||||
BIF_icon_draw(x+5, y-8, ICON_ACTION);
|
||||
glDisable(GL_BLEND);
|
||||
BIF_icon_draw(x+17, y-8, ICON_ACTION);
|
||||
}
|
||||
glDisable(GL_BLEND);
|
||||
y-=NLACHANNELHEIGHT+NLACHANNELSKIP;
|
||||
|
||||
/* Draw the action timeline */
|
||||
if (ob->action){
|
||||
BIF_ThemeColorShade(TH_HEADER, -20);
|
||||
glRectf(x+16, y-NLACHANNELHEIGHT/2, (float)NLAWIDTH, y+NLACHANNELHEIGHT/2);
|
||||
/* check if object's nla strips are collapsed or not */
|
||||
if ((ob->nlaflag & OB_NLA_COLLAPSED)==0) {
|
||||
/* Draw the action timeline */
|
||||
if (ob->action){
|
||||
BIF_ThemeColorShade(TH_HEADER, -20);
|
||||
glRectf(x+19, y-NLACHANNELHEIGHT/2, (float)NLAWIDTH, y+NLACHANNELHEIGHT/2);
|
||||
|
||||
if (TESTBASE_SAFE(base))
|
||||
BIF_ThemeColor(TH_TEXT_HI);
|
||||
else
|
||||
BIF_ThemeColor(TH_TEXT);
|
||||
glRasterPos2f(x+32, y-4);
|
||||
BMF_DrawString(G.font, ob->action->id.name+2);
|
||||
if (TESTBASE_SAFE(base))
|
||||
BIF_ThemeColor(TH_TEXT_HI);
|
||||
else
|
||||
BIF_ThemeColor(TH_TEXT);
|
||||
glRasterPos2f(x+38, y-4);
|
||||
BMF_DrawString(G.font, ob->action->id.name+2);
|
||||
|
||||
/* icon for active action (no strip mapping) */
|
||||
for (strip = ob->nlastrips.first; strip; strip=strip->next)
|
||||
if(strip->flag & ACTSTRIP_ACTIVE) break;
|
||||
if(strip==NULL) {
|
||||
glEnable(GL_BLEND);
|
||||
BIF_icon_draw(x, y-8, ICON_DOT);
|
||||
glDisable(GL_BLEND);
|
||||
}
|
||||
|
||||
y-=NLACHANNELHEIGHT+NLACHANNELSKIP;
|
||||
}
|
||||
|
||||
/* Draw the nla strips */
|
||||
for (strip = ob->nlastrips.first; strip; strip=strip->next){
|
||||
BIF_ThemeColorShade(TH_HEADER, -40);
|
||||
glRectf(x+32, y-NLACHANNELHEIGHT/2, (float)NLAWIDTH, y+NLACHANNELHEIGHT/2);
|
||||
|
||||
if (TESTBASE_SAFE(base))
|
||||
BIF_ThemeColor(TH_TEXT_HI);
|
||||
else
|
||||
BIF_ThemeColor(TH_TEXT);
|
||||
|
||||
// why this test? check freeing mem when deleting strips? (ton)
|
||||
if(strip->act) {
|
||||
glRasterPos2f(x+48, y-4);
|
||||
BMF_DrawString(G.font, strip->act->id.name+2);
|
||||
|
||||
if(strip->flag & ACTSTRIP_ACTIVE) {
|
||||
/* icon for active action (no strip mapping) */
|
||||
for (strip = ob->nlastrips.first; strip; strip=strip->next)
|
||||
if(strip->flag & ACTSTRIP_ACTIVE) break;
|
||||
if(strip==NULL) {
|
||||
glEnable(GL_BLEND);
|
||||
BIF_icon_draw(x+16, y-8, ICON_DOT);
|
||||
glDisable(GL_BLEND);
|
||||
}
|
||||
if(strip->modifiers.first) {
|
||||
glEnable(GL_BLEND);
|
||||
BIF_icon_draw(x+34, y-8, ICON_MODIFIER);
|
||||
BIF_icon_draw(x+5, y-8, ICON_DOT);
|
||||
glDisable(GL_BLEND);
|
||||
}
|
||||
|
||||
y-=NLACHANNELHEIGHT+NLACHANNELSKIP;
|
||||
}
|
||||
|
||||
y-=(NLACHANNELHEIGHT+NLACHANNELSKIP);
|
||||
/* Draw the nla strips */
|
||||
for (strip = ob->nlastrips.first; strip; strip=strip->next){
|
||||
BIF_ThemeColorShade(TH_HEADER, -40);
|
||||
glRectf(x+32, y-NLACHANNELHEIGHT/2, (float)NLAWIDTH, y+NLACHANNELHEIGHT/2);
|
||||
|
||||
if (TESTBASE_SAFE(base))
|
||||
BIF_ThemeColor(TH_TEXT_HI);
|
||||
else
|
||||
BIF_ThemeColor(TH_TEXT);
|
||||
|
||||
// why this test? check freeing mem when deleting strips? (ton)
|
||||
if(strip->act) {
|
||||
glRasterPos2f(x+48, y-4);
|
||||
BMF_DrawString(G.font, strip->act->id.name+2);
|
||||
|
||||
if(strip->flag & ACTSTRIP_ACTIVE) {
|
||||
glEnable(GL_BLEND);
|
||||
BIF_icon_draw(x+16, y-8, ICON_DOT);
|
||||
glDisable(GL_BLEND);
|
||||
}
|
||||
if(strip->modifiers.first) {
|
||||
glEnable(GL_BLEND);
|
||||
BIF_icon_draw(x+34, y-8, ICON_MODIFIER);
|
||||
glDisable(GL_BLEND);
|
||||
}
|
||||
}
|
||||
|
||||
y-=(NLACHANNELHEIGHT+NLACHANNELSKIP);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -274,6 +284,10 @@ static void draw_nla_strips_keys(SpaceNla *snla)
|
||||
|
||||
y-=NLACHANNELHEIGHT+NLACHANNELSKIP;
|
||||
|
||||
/* check if object nla-strips expanded or not */
|
||||
if (ob->nlaflag & OB_NLA_COLLAPSED)
|
||||
continue;
|
||||
|
||||
|
||||
/* Draw the action strip */
|
||||
if (ob->action) {
|
||||
@ -430,10 +444,12 @@ bActionStrip *get_active_nlastrip(Object **obpp)
|
||||
bActionStrip *strip;
|
||||
|
||||
for (base=G.scene->base.first; base; base=base->next){
|
||||
for (strip=base->object->nlastrips.first; strip; strip=strip->next){
|
||||
if (strip->flag & ACTSTRIP_SELECT) {
|
||||
*obpp= base->object;
|
||||
return strip;
|
||||
if ((base->object->nlaflag & OB_NLA_COLLAPSED)==0) {
|
||||
for (strip=base->object->nlastrips.first; strip; strip=strip->next){
|
||||
if (strip->flag & ACTSTRIP_SELECT) {
|
||||
*obpp= base->object;
|
||||
return strip;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -718,18 +734,21 @@ void drawnlaspace(ScrArea *sa, void *spacedata)
|
||||
int count_nla_levels(void)
|
||||
{
|
||||
Base *base;
|
||||
int y=0;
|
||||
int y= 0;
|
||||
|
||||
for (y=0, base=G.scene->base.first; base; base=base->next) {
|
||||
for (base=G.scene->base.first; base; base=base->next) {
|
||||
if (nla_filter(base)) {
|
||||
/* object level */
|
||||
y++;
|
||||
|
||||
if(base->object->action)
|
||||
y++;
|
||||
/* nla strips for object collapsed? */
|
||||
if ((base->object->nlaflag & OB_NLA_COLLAPSED)==0) {
|
||||
if(base->object->action)
|
||||
y++;
|
||||
|
||||
/* Nla strips */
|
||||
y+= BLI_countlist(&base->object->nlastrips);
|
||||
/* Nla strips */
|
||||
y+= BLI_countlist(&base->object->nlastrips);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -108,6 +108,9 @@ void shift_nlastrips_up(void) {
|
||||
bActionStrip *strip, *prevstrip;
|
||||
|
||||
for (base=G.scene->base.first; base; base=base->next) {
|
||||
if (base->object->nlaflag & OB_NLA_COLLAPSED)
|
||||
continue;
|
||||
|
||||
for (strip = base->object->nlastrips.first;
|
||||
strip; strip=strip->next){
|
||||
if (strip->flag & ACTSTRIP_SELECT) {
|
||||
@ -145,6 +148,9 @@ void shift_nlastrips_down(void) {
|
||||
bActionStrip *strip, *nextstrip;
|
||||
|
||||
for (base=G.scene->base.first; base; base=base->next) {
|
||||
if (base->object->nlaflag & OB_NLA_COLLAPSED)
|
||||
continue;
|
||||
|
||||
for (strip = base->object->nlastrips.last;
|
||||
strip; strip=strip->prev){
|
||||
if (strip->flag & ACTSTRIP_SELECT) {
|
||||
@ -209,6 +215,9 @@ void reset_action_strips(int val)
|
||||
bActionStrip *strip;
|
||||
|
||||
for (base=G.scene->base.first; base; base=base->next) {
|
||||
if (base->object->nlaflag & OB_NLA_COLLAPSED)
|
||||
continue;
|
||||
|
||||
for (strip = base->object->nlastrips.last; strip; strip=strip->prev) {
|
||||
if (strip->flag & ACTSTRIP_SELECT) {
|
||||
if(val==2) {
|
||||
@ -236,6 +245,9 @@ void snap_action_strips(int snap_mode)
|
||||
bActionStrip *strip;
|
||||
|
||||
for (base=G.scene->base.first; base; base=base->next) {
|
||||
if (base->object->nlaflag & OB_NLA_COLLAPSED)
|
||||
continue;
|
||||
|
||||
for (strip = base->object->nlastrips.last; strip; strip=strip->prev) {
|
||||
if (strip->flag & ACTSTRIP_SELECT) {
|
||||
if (snap_mode==1) {
|
||||
@ -467,6 +479,7 @@ static void relink_active_strip(void)
|
||||
char *str;
|
||||
|
||||
if(ob==NULL) return;
|
||||
if(ob->nlaflag & OB_NLA_COLLAPSED) return;
|
||||
|
||||
for (strip = ob->nlastrips.first; strip; strip=strip->next)
|
||||
if(strip->flag & ACTSTRIP_ACTIVE)
|
||||
@ -530,22 +543,25 @@ static void mouse_nlachannels(short mval[2])
|
||||
}
|
||||
click--;
|
||||
|
||||
/* See if this is an action */
|
||||
if (ob->action){
|
||||
if (click==0) {
|
||||
actclick= 1;
|
||||
break;
|
||||
}
|
||||
click--;
|
||||
}
|
||||
|
||||
/* See if this is an nla strip */
|
||||
if(ob->nlastrips.first) {
|
||||
for (strip = ob->nlastrips.first; strip; strip=strip->next){
|
||||
if (click==0) break;
|
||||
/* see if any strips under object */
|
||||
if ((ob->nlaflag & OB_NLA_COLLAPSED)==0) {
|
||||
/* See if this is an action */
|
||||
if (ob->action){
|
||||
if (click==0) {
|
||||
actclick= 1;
|
||||
break;
|
||||
}
|
||||
click--;
|
||||
}
|
||||
if (strip && click==0) break;
|
||||
|
||||
/* See if this is an nla strip */
|
||||
if(ob->nlastrips.first) {
|
||||
for (strip = ob->nlastrips.first; strip; strip=strip->next){
|
||||
if (click==0) break;
|
||||
click--;
|
||||
}
|
||||
if (strip && click==0) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -571,9 +587,15 @@ static void mouse_nlachannels(short mval[2])
|
||||
else if(strip) /* set action */
|
||||
set_active_strip(ob, strip);
|
||||
|
||||
/* override option for NLA */
|
||||
if(obclick && mval[0]<25)
|
||||
/* icon toggles beside strip */
|
||||
if (obclick && mval[0]<20) {
|
||||
/* collapse option for NLA object strip */
|
||||
ob->nlaflag ^= OB_NLA_COLLAPSED;
|
||||
}
|
||||
else if(obclick && mval[0]<36) {
|
||||
/* override option for NLA */
|
||||
ob->nlaflag ^= OB_NLA_OVERRIDE;
|
||||
}
|
||||
|
||||
ob->ctime= -1234567.0f; // eveil!
|
||||
DAG_object_flush_update(G.scene, ob, OB_RECALC_OB|OB_RECALC_DATA);
|
||||
@ -596,6 +618,9 @@ void deselect_nlachannel_keys (int test)
|
||||
/* Determine if this is selection or deselection */
|
||||
if (test){
|
||||
for (base=G.scene->base.first; base && sel; base=base->next){
|
||||
/* check if collapsed */
|
||||
if (base->object->nlaflag & OB_NLA_COLLAPSED)
|
||||
continue;
|
||||
|
||||
/* Test object ipos */
|
||||
if (is_ipo_key_selected(base->object->ipo)){
|
||||
@ -652,6 +677,9 @@ void deselect_nlachannel_keys (int test)
|
||||
|
||||
/* Set the flags */
|
||||
for (base=G.scene->base.first; base; base=base->next){
|
||||
/* check if collapsed */
|
||||
if (base->object->nlaflag & OB_NLA_COLLAPSED)
|
||||
continue;
|
||||
|
||||
/* Set the object ipos */
|
||||
set_ipo_key_selection(base->object->ipo, sel);
|
||||
@ -716,6 +744,9 @@ void transform_nlachannel_keys(int mode, int dummy)
|
||||
|
||||
/* Ensure that partial selections result in beztriple selections */
|
||||
for (base=G.scene->base.first; base; base=base->next){
|
||||
/* skip if object is collapsed */
|
||||
if (base->object->nlaflag & OB_NLA_COLLAPSED)
|
||||
continue;
|
||||
|
||||
/* Check object ipos */
|
||||
i= fullselect_ipo_keys(base->object->ipo);
|
||||
@ -766,6 +797,10 @@ void transform_nlachannel_keys(int mode, int dummy)
|
||||
tv = MEM_callocN (sizeof(TransVert) * tvtot, "transVert");
|
||||
tvtot=0;
|
||||
for (base=G.scene->base.first; base; base=base->next){
|
||||
/* skip if object collapsed */
|
||||
if (base->object->nlaflag & OB_NLA_COLLAPSED)
|
||||
continue;
|
||||
|
||||
/* Manipulate object ipos */
|
||||
tvtot=add_trans_ipo_keys(base->object->ipo, tv, tvtot);
|
||||
|
||||
@ -973,6 +1008,9 @@ void delete_nlachannel_keys(void)
|
||||
bActionStrip *strip, *nextstrip;
|
||||
|
||||
for (base = G.scene->base.first; base; base=base->next){
|
||||
/* check if object collapsed */
|
||||
if (base->object->nlaflag & OB_NLA_COLLAPSED)
|
||||
continue;
|
||||
|
||||
/* Delete object ipos */
|
||||
delete_ipo_keys(base->object->ipo);
|
||||
@ -1021,6 +1059,10 @@ void duplicate_nlachannel_keys(void)
|
||||
|
||||
/* Find selected items */
|
||||
for (base = G.scene->base.first; base; base=base->next){
|
||||
/* check if object collapsed */
|
||||
if (base->object->nlaflag & OB_NLA_COLLAPSED)
|
||||
continue;
|
||||
|
||||
/* Duplicate object keys */
|
||||
duplicate_ipo_keys(base->object->ipo);
|
||||
|
||||
@ -1095,6 +1137,10 @@ void borderselect_nla(void)
|
||||
|
||||
ymin=ymax-(NLACHANNELHEIGHT+NLACHANNELSKIP);
|
||||
|
||||
/* check if expanded */
|
||||
if (base->object->nlaflag & OB_NLA_COLLAPSED)
|
||||
continue;
|
||||
|
||||
/* Check object ipos */
|
||||
if (base->object->ipo){
|
||||
if (!((ymax < rectf.ymin) || (ymin > rectf.ymax)))
|
||||
@ -1296,6 +1342,10 @@ static Base *get_nearest_nlastrip (bActionStrip **rstrip, short *sel)
|
||||
/* Skip object ipos */
|
||||
ymax-=(NLACHANNELHEIGHT+NLACHANNELSKIP);
|
||||
|
||||
/* check if skip strips if collapsed */
|
||||
if (base->object->nlaflag & OB_NLA_COLLAPSED)
|
||||
continue;
|
||||
|
||||
/* Skip action ipos */
|
||||
if (base->object->action)
|
||||
ymax-=(NLACHANNELHEIGHT+NLACHANNELSKIP);
|
||||
@ -1369,6 +1419,10 @@ static Base *get_nearest_nlachannel_ob_key (float *index, short *sel)
|
||||
|
||||
ymin=ymax-(NLACHANNELHEIGHT+NLACHANNELSKIP);
|
||||
|
||||
/* check if skip strips below due to collapsed */
|
||||
if (base->object->nlaflag & OB_NLA_COLLAPSED)
|
||||
continue;
|
||||
|
||||
/* Handle object ipo selection */
|
||||
if (base->object->ipo){
|
||||
if (!((ymax < rectf.ymin) || (ymin > rectf.ymax))){
|
||||
@ -1478,6 +1532,11 @@ static bAction *get_nearest_nlachannel_ac_key (float *index, short *sel)
|
||||
|
||||
/* Skip object ipo and ob-constraint ipo */
|
||||
ymin=ymax-(NLACHANNELHEIGHT+NLACHANNELSKIP);
|
||||
|
||||
/* skip this object if it is collapsed */
|
||||
if (base->object->nlaflag & OB_NLA_COLLAPSED)
|
||||
continue;
|
||||
|
||||
ymax=ymin;
|
||||
|
||||
/* Handle action ipos */
|
||||
@ -1598,10 +1657,12 @@ static Object *get_object_from_active_strip(void) {
|
||||
bActionStrip *strip;
|
||||
|
||||
for (base=G.scene->base.first; base; base=base->next) {
|
||||
for (strip = base->object->nlastrips.first;
|
||||
strip; strip=strip->next){
|
||||
if (strip->flag & ACTSTRIP_SELECT) {
|
||||
return base->object;
|
||||
if ((base->object->nlaflag & OB_NLA_COLLAPSED)==0) {
|
||||
for (strip = base->object->nlastrips.first;
|
||||
strip; strip=strip->next){
|
||||
if (strip->flag & ACTSTRIP_SELECT) {
|
||||
return base->object;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user