From 4bbccd39bc827e5d794bdbe987b4d48164e8d950 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Fri, 14 Aug 2009 11:09:19 +0000 Subject: 2.5 - Assorted Animation UI Tweaks * Fixed padding for Graph Editor visibility toggles * Reverted many of the tweaks to Timeline UI for now (for the reasons outlined in earlier mail) * NLA Editor now (mostly) uses the new channel-drawing API --- .../editors/animation/anim_channels_defines.c | 45 +- source/blender/editors/include/ED_anim_api.h | 6 +- source/blender/editors/space_graph/graph_buttons.c | 2 +- source/blender/editors/space_graph/graph_draw.c | 15 - source/blender/editors/space_nla/nla_draw.c | 549 +++++---------------- source/blender/editors/space_time/time_header.c | 39 +- 6 files changed, 170 insertions(+), 486 deletions(-) (limited to 'source/blender') diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index 879296c58b8..32bda94f796 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -1874,10 +1874,10 @@ void ANIM_channel_draw (bAnimContext *ac, bAnimListElem *ale, float yminc, float glColor3fv(fcu->color); /* just a solid color rect - * hardcoded 18 pixels width is slightly wider than icon width, so that + * hardcoded 17 pixels width is slightly wider than icon width, so that * there's a slight border around it */ - glRectf(offset, yminc, offset+18, ymaxc); + glRectf(offset, yminc, offset+17, ymaxc); } /* finally the icon itself */ @@ -1913,34 +1913,35 @@ void ANIM_channel_draw (bAnimContext *ac, bAnimListElem *ale, float yminc, float UI_DrawString(offset, ytext, name); } - /* step 6) draw mute+protection toggles ............................. */ + /* step 6) draw mute+protection toggles + (sliders) ....................... */ /* reset offset - now goes from RHS of panel */ offset = 0; // TODO: we need a mechanism of drawing over (and hiding) stuff from here... + // TODO: when drawing sliders, make those draw instead of these toggles if not enough space - /* set blending again, as text drawing may clear it */ - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - - /* protect... */ - // XXX v2d might not be valid - if (acf->has_setting(ac, ale, ACHANNEL_SETTING_PROTECT)) { - enabled= ANIM_channel_setting_get(ac, ale, ACHANNEL_SETTING_PROTECT); + if (v2d) { + /* set blending again, as text drawing may clear it */ + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); - offset += ICON_WIDTH; - UI_icon_draw(v2d->cur.xmax-(float)offset, ymid, ((enabled)? ICON_LOCKED : ICON_UNLOCKED)); - } - /* mute... */ - // XXX v2d might not be valid - if (acf->has_setting(ac, ale, ACHANNEL_SETTING_MUTE)) { - enabled= ANIM_channel_setting_get(ac, ale, ACHANNEL_SETTING_MUTE); + /* protect... */ + if (acf->has_setting(ac, ale, ACHANNEL_SETTING_PROTECT)) { + enabled= ANIM_channel_setting_get(ac, ale, ACHANNEL_SETTING_PROTECT); + + offset += ICON_WIDTH; + UI_icon_draw(v2d->cur.xmax-(float)offset, ymid, ((enabled)? ICON_LOCKED : ICON_UNLOCKED)); + } + /* mute... */ + if (acf->has_setting(ac, ale, ACHANNEL_SETTING_MUTE)) { + enabled= ANIM_channel_setting_get(ac, ale, ACHANNEL_SETTING_MUTE); + + offset += ICON_WIDTH; + UI_icon_draw(v2d->cur.xmax-(float)offset, ymid, ((enabled)? ICON_MUTE_IPO_ON : ICON_MUTE_IPO_OFF)); + } - offset += ICON_WIDTH; - UI_icon_draw(v2d->cur.xmax-(float)offset, ymid, ((enabled)? ICON_MUTE_IPO_ON : ICON_MUTE_IPO_OFF)); + glDisable(GL_BLEND); /* End of blending with background */ } - - glDisable(GL_BLEND); /* End of blending with background */ } /* *********************************************** */ diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h index d3d42deba21..21c5e6bbcf9 100644 --- a/source/blender/editors/include/ED_anim_api.h +++ b/source/blender/editors/include/ED_anim_api.h @@ -402,14 +402,16 @@ void ANIM_uiTemplate_fmodifier_draw(struct uiLayout *layout, struct ID *id, List /* ------------ Animation F-Curves <-> Icons/Names Mapping ------------ */ /* anim_ipo_utils.c */ +/* Get icon for type of setting F-Curve is for */ +// XXX include this in the getname() method via RNA? int geticon_anim_blocktype(short blocktype); +/* Get name for channel-list displays for F-Curve */ void getname_anim_fcurve(char *name, struct ID *id, struct FCurve *fcu); - +/* Automatically determine a color for the nth F-Curve */ void ipo_rainbow(int cur, int tot, float *out); - /* ------------- NLA-Mapping ----------------------- */ /* anim_draw.c */ diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c index 82babb70c53..fb995285ab7 100644 --- a/source/blender/editors/space_graph/graph_buttons.c +++ b/source/blender/editors/space_graph/graph_buttons.c @@ -160,7 +160,7 @@ static void graph_panel_properties(const bContext *C, Panel *pa) } getname_anim_fcurve(name, ale->id, fcu); - uiDefBut(block, LABEL, 1, name, 30, 180, 300, 19, NULL, 0.0, 0.0, 0, 0, "Name of Active F-Curve"); + uiDefBut(block, LABEL, 1, name, 40, 180, 300, 19, NULL, 0.0, 0.0, 0, 0, "Name of Active F-Curve"); /* TODO: the following settings could be added here * - F-Curve coloring mode - mode selector + color selector diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c index 07918646926..46d067d9dd2 100644 --- a/source/blender/editors/space_graph/graph_draw.c +++ b/source/blender/editors/space_graph/graph_draw.c @@ -877,10 +877,6 @@ void graph_draw_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGri /* ************************************************************************* */ /* Channel List */ -// XXX quite a few of these need to be kept in sync with their counterparts in Action Editor -// as they're the same. We have 2 separate copies of this for now to make it easier to develop -// the diffences between the two editors, but one day these should be merged! - /* left hand part */ void graph_draw_channel_names(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar) { @@ -903,17 +899,6 @@ void graph_draw_channel_names(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar) * start of list offset, and the second is as a correction for the scrollers. */ height= (float)((items*ACHANNEL_STEP) + (ACHANNEL_HEIGHT*2)); - -#if 0 - if (height > (v2d->mask.ymax - v2d->mask.ymin)) { - /* don't use totrect set, as the width stays the same - * (NOTE: this is ok here, the configuration is pretty straightforward) - */ - v2d->tot.ymin= (float)(-height); - } - - /* XXX I would call the below line! (ton) */ -#endif UI_view2d_totRect_set(v2d, ar->winx, height); /* loop through channels, and set up drawing depending on their type */ diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c index a7a854a7277..a4265af71d9 100644 --- a/source/blender/editors/space_nla/nla_draw.c +++ b/source/blender/editors/space_nla/nla_draw.c @@ -633,308 +633,10 @@ void draw_nla_channel_list (bAnimContext *ac, SpaceNla *snla, ARegion *ar) short indent= 0, offset= 0, sel= 0, group= 0; int expand= -1, protect = -1, special= -1, mute = -1; char name[128]; + short doDraw=0; /* determine what needs to be drawn */ switch (ale->type) { - case ANIMTYPE_SCENE: /* scene */ - { - Scene *sce= (Scene *)ale->data; - AnimData *adt= ale->adt; - - group= 4; - indent= 0; - - special= ICON_SCENE_DATA; - - /* only show expand if there are any channels */ - if (EXPANDED_SCEC(sce)) - expand= ICON_TRIA_DOWN; - else - expand= ICON_TRIA_RIGHT; - - /* NLA evaluation on/off button */ - if (adt) { - if (adt->flag & ADT_NLA_EVAL_OFF) - mute = ICON_MUTE_IPO_ON; - else - mute = ICON_MUTE_IPO_OFF; - } - - sel = SEL_SCEC(sce); - strcpy(name, sce->id.name+2); - } - break; - case ANIMTYPE_OBJECT: /* object */ - { - Base *base= (Base *)ale->data; - Object *ob= base->object; - AnimData *adt= ale->adt; - - group= 4; - indent= 0; - - /* icon depends on object-type */ - if (ob->type == OB_ARMATURE) - special= ICON_ARMATURE_DATA; - else - special= ICON_OBJECT_DATA; - - /* only show expand if there are any channels */ - if (EXPANDED_OBJC(ob)) - expand= ICON_TRIA_DOWN; - else - expand= ICON_TRIA_RIGHT; - - /* NLA evaluation on/off button */ - if (adt) { - if (adt->flag & ADT_NLA_EVAL_OFF) - mute = ICON_MUTE_IPO_ON; - else - mute = ICON_MUTE_IPO_OFF; - } - - sel = SEL_OBJC(base); - strcpy(name, ob->id.name+2); - } - break; - case ANIMTYPE_FILLMATD: /* object materials (dopesheet) expand widget */ - { - Object *ob = (Object *)ale->data; - - group = 4; - indent = 1; - special = ICON_MATERIAL_DATA; - - if (FILTER_MAT_OBJC(ob)) - expand = ICON_TRIA_DOWN; - else - expand = ICON_TRIA_RIGHT; - - strcpy(name, "Materials"); - } - break; - case ANIMTYPE_FILLPARTD: /* object particles (dopesheet) expand widget */ - { - Object *ob = (Object *)ale->data; - - group = 4; - indent = 1; - special = ICON_PARTICLE_DATA; - - if (FILTER_PART_OBJC(ob)) - expand = ICON_TRIA_DOWN; - else - expand = ICON_TRIA_RIGHT; - - strcpy(name, "Particles"); - } - break; - - - case ANIMTYPE_DSMAT: /* single material (dopesheet) expand widget */ - { - Material *ma = (Material *)ale->data; - AnimData *adt= ale->adt; - - group = 0; - indent = 0; - special = ICON_MATERIAL_DATA; - offset = 21; - - if (FILTER_MAT_OBJD(ma)) - expand = ICON_TRIA_DOWN; - else - expand = ICON_TRIA_RIGHT; - - /* NLA evaluation on/off button */ - if (adt) { - if (adt->flag & ADT_NLA_EVAL_OFF) - mute = ICON_MUTE_IPO_ON; - else - mute = ICON_MUTE_IPO_OFF; - } - - strcpy(name, ma->id.name+2); - } - break; - case ANIMTYPE_DSLAM: /* lamp (dopesheet) expand widget */ - { - Lamp *la = (Lamp *)ale->data; - AnimData *adt= ale->adt; - - group = 4; - indent = 1; - special = ICON_LAMP_DATA; - - if (FILTER_LAM_OBJD(la)) - expand = ICON_TRIA_DOWN; - else - expand = ICON_TRIA_RIGHT; - - /* NLA evaluation on/off button */ - if (adt) { - if (adt->flag & ADT_NLA_EVAL_OFF) - mute = ICON_MUTE_IPO_ON; - else - mute = ICON_MUTE_IPO_OFF; - } - - strcpy(name, la->id.name+2); - } - break; - case ANIMTYPE_DSCAM: /* camera (dopesheet) expand widget */ - { - Camera *ca = (Camera *)ale->data; - AnimData *adt= ale->adt; - - group = 4; - indent = 1; - special = ICON_CAMERA_DATA; - - if (FILTER_CAM_OBJD(ca)) - expand = ICON_TRIA_DOWN; - else - expand = ICON_TRIA_RIGHT; - - /* NLA evaluation on/off button */ - if (adt) { - if (adt->flag & ADT_NLA_EVAL_OFF) - mute = ICON_MUTE_IPO_ON; - else - mute = ICON_MUTE_IPO_OFF; - } - - strcpy(name, ca->id.name+2); - } - break; - case ANIMTYPE_DSCUR: /* curve (dopesheet) expand widget */ - { - Curve *cu = (Curve *)ale->data; - AnimData *adt= ale->adt; - - group = 4; - indent = 1; - special = ICON_CURVE_DATA; - - if (FILTER_CUR_OBJD(cu)) - expand = ICON_TRIA_DOWN; - else - expand = ICON_TRIA_RIGHT; - - /* NLA evaluation on/off button */ - if (adt) { - if (adt->flag & ADT_NLA_EVAL_OFF) - mute = ICON_MUTE_IPO_ON; - else - mute = ICON_MUTE_IPO_OFF; - } - - strcpy(name, cu->id.name+2); - } - break; - case ANIMTYPE_DSSKEY: /* shapekeys (dopesheet) expand widget */ - { - Key *key= (Key *)ale->data; - AnimData *adt= ale->adt; - - group = 4; - indent = 1; - special = ICON_SHAPEKEY_DATA; - - if (FILTER_SKE_OBJD(key)) - expand = ICON_TRIA_DOWN; - else - expand = ICON_TRIA_RIGHT; - - /* NLA evaluation on/off button */ - if (adt) { - if (adt->flag & ADT_NLA_EVAL_OFF) - mute = ICON_MUTE_IPO_ON; - else - mute = ICON_MUTE_IPO_OFF; - } - - //sel = SEL_OBJC(base); - strcpy(name, "Shape Keys"); - } - break; - case ANIMTYPE_DSWOR: /* world (dopesheet) expand widget */ - { - World *wo= (World *)ale->data; - AnimData *adt= ale->adt; - - group = 4; - indent = 1; - special = ICON_WORLD_DATA; - - if (FILTER_WOR_SCED(wo)) - expand = ICON_TRIA_DOWN; - else - expand = ICON_TRIA_RIGHT; - - /* NLA evaluation on/off button */ - if (adt) { - if (adt->flag & ADT_NLA_EVAL_OFF) - mute = ICON_MUTE_IPO_ON; - else - mute = ICON_MUTE_IPO_OFF; - } - - strcpy(name, wo->id.name+2); - } - break; - case ANIMTYPE_DSPART: /* particle (dopesheet) expand widget */ - { - ParticleSettings *part= (ParticleSettings*)ale->data; - AnimData *adt= ale->adt; - - group = 0; - indent = 0; - special = ICON_PARTICLE_DATA; - offset = 21; - - if (FILTER_PART_OBJD(part)) - expand = ICON_TRIA_DOWN; - else - expand = ICON_TRIA_RIGHT; - - /* NLA evaluation on/off button */ - if (adt) { - if (adt->flag & ADT_NLA_EVAL_OFF) - mute = ICON_MUTE_IPO_ON; - else - mute = ICON_MUTE_IPO_OFF; - } - - strcpy(name, part->id.name+2); - } - break; - case ANIMTYPE_DSMBALL: /* metaball (dopesheet) expand widget */ - { - MetaBall *mb = (MetaBall *)ale->data; - AnimData *adt= ale->adt; - - group = 4; - indent = 1; - special = ICON_META_DATA; - - if (FILTER_MBALL_OBJD(mb)) - expand = ICON_TRIA_DOWN; - else - expand = ICON_TRIA_RIGHT; - - /* NLA evaluation on/off button */ - if (adt) { - if (adt->flag & ADT_NLA_EVAL_OFF) - mute = ICON_MUTE_IPO_ON; - else - mute = ICON_MUTE_IPO_OFF; - } - - strcpy(name, mb->id.name+2); - } - break; - case ANIMTYPE_NLATRACK: /* NLA Track */ { NlaTrack *nlt= (NlaTrack *)ale->data; @@ -978,6 +680,9 @@ void draw_nla_channel_list (bAnimContext *ac, SpaceNla *snla, ARegion *ar) sel = SEL_NLT(nlt); strcpy(name, nlt->name); + + // draw manually still + doDraw= 1; } break; case ANIMTYPE_NLAACTION: /* NLA Action-Line */ @@ -1004,162 +709,148 @@ void draw_nla_channel_list (bAnimContext *ac, SpaceNla *snla, ARegion *ar) sprintf(name, "ActAction: <%s>", act->id.name+2); else sprintf(name, ""); + + // draw manually still + doDraw= 1; } break; + + default: /* handled by standard channel-drawing API */ + ANIM_channel_draw(ac, ale, yminc, ymaxc); + break; } - /* now, start drawing based on this information */ - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - - /* draw backing strip behind channel name */ - if (group == 4) { - /* only used in dopesheet... */ - if (ELEM(ale->type, ANIMTYPE_SCENE, ANIMTYPE_OBJECT)) { - /* object channel - darker */ - UI_ThemeColor(TH_DOPESHEET_CHANNELOB); - uiSetRoundBox((expand == ICON_TRIA_DOWN)? (8):(1|8)); - gl_round_box(GL_POLYGON, x+offset, yminc, (float)NLACHANNEL_NAMEWIDTH, ymaxc, 10); + /* if special types, draw manually for now... */ + if (doDraw) { + /* now, start drawing based on this information */ + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + + /* draw backing strip behind channel name */ + if (group == 5) { + /* Action Line */ + AnimData *adt= ale->adt; + + // TODO: if tweaking some action, use the same color as for the tweaked track (quick hack done for now) + if (adt && (adt->flag & ADT_NLA_EDIT_ON)) { + // greenish color (same as tweaking strip) - hardcoded for now + glColor3f(0.3f, 0.95f, 0.1f); + } + else { + if (ale->data) + glColor3f(0.8f, 0.2f, 0.0f); // reddish color - hardcoded for now + else + glColor3f(0.6f, 0.5f, 0.5f); // greyish-red color - hardcoded for now + } + + offset += 7 * indent; + + /* only on top two corners, to show that this channel sits on top of the preceeding ones */ + uiSetRoundBox((1|2)); + + /* draw slightly shifted up vertically to look like it has more separtion from other channels, + * but we then need to slightly shorten it so that it doesn't look like it overlaps + */ + gl_round_box(GL_POLYGON, x+offset, yminc+NLACHANNEL_SKIP, (float)v2d->cur.xmax, ymaxc+NLACHANNEL_SKIP-1, 8); + + /* clear group value, otherwise we cause errors... */ + group = 0; } else { - /* sub-object folders - lighter */ - UI_ThemeColor(TH_DOPESHEET_CHANNELSUBOB); + /* for normal channels + * - use 3 shades of color group/standard color for 3 indention level + */ + UI_ThemeColorShade(TH_HEADER, ((indent==0)?20: (indent==1)?-20: -40)); + indent += group; offset += 7 * indent; glBegin(GL_QUADS); glVertex2f(x+offset, yminc); glVertex2f(x+offset, ymaxc); - glVertex2f((float)ACHANNEL_NAMEWIDTH, ymaxc); - glVertex2f((float)ACHANNEL_NAMEWIDTH, yminc); + glVertex2f((float)v2d->cur.xmax, ymaxc); + glVertex2f((float)v2d->cur.xmax, yminc); glEnd(); - - /* clear group value, otherwise we cause errors... */ - group = 0; } - } - else if (group == 5) { - /* Action Line */ - AnimData *adt= ale->adt; - // TODO: if tweaking some action, use the same color as for the tweaked track (quick hack done for now) - if (adt && (adt->flag & ADT_NLA_EDIT_ON)) { - // greenish color (same as tweaking strip) - hardcoded for now - glColor3f(0.3f, 0.95f, 0.1f); - } - else { - if (ale->data) - glColor3f(0.8f, 0.2f, 0.0f); // reddish color - hardcoded for now - else - glColor3f(0.6f, 0.5f, 0.5f); // greyish-red color - hardcoded for now + /* draw expand/collapse triangle */ + if (expand > 0) { + UI_icon_draw(x+offset, ydatac, expand); + offset += 17; } - offset += 7 * indent; + /* draw special icon indicating certain data-types */ + if (special > -1) { + /* for normal channels */ + UI_icon_draw(x+offset, ydatac, special); + offset += 17; + } + glDisable(GL_BLEND); - /* only on top two corners, to show that this channel sits on top of the preceeding ones */ - uiSetRoundBox((1|2)); + /* draw name */ + if (sel) + UI_ThemeColor(TH_TEXT_HI); + else + UI_ThemeColor(TH_TEXT); + offset += 3; + UI_DrawString(x+offset, y-4, name); - /* draw slightly shifted up vertically to look like it has more separtion from other channels, - * but we then need to slightly shorten it so that it doesn't look like it overlaps - */ - gl_round_box(GL_POLYGON, x+offset, yminc+NLACHANNEL_SKIP, (float)NLACHANNEL_NAMEWIDTH, ymaxc+NLACHANNEL_SKIP-1, 8); + /* reset offset - for RHS of panel */ + offset = 0; - /* clear group value, otherwise we cause errors... */ - group = 0; - } - else { - /* for normal channels - * - use 3 shades of color group/standard color for 3 indention level - */ - UI_ThemeColorShade(TH_HEADER, ((indent==0)?20: (indent==1)?-20: -40)); + /* set blending again, as text drawing may clear it */ + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); - indent += group; - offset += 7 * indent; - glBegin(GL_QUADS); - glVertex2f(x+offset, yminc); - glVertex2f(x+offset, ymaxc); - glVertex2f((float)NLACHANNEL_NAMEWIDTH, ymaxc); - glVertex2f((float)NLACHANNEL_NAMEWIDTH, yminc); - glEnd(); - } - - /* draw expand/collapse triangle */ - if (expand > 0) { - UI_icon_draw(x+offset, ydatac, expand); - offset += 17; - } - - /* draw special icon indicating certain data-types */ - if (special > -1) { - /* for normal channels */ - UI_icon_draw(x+offset, ydatac, special); - offset += 17; - } - glDisable(GL_BLEND); - - /* draw name */ - if (sel) - UI_ThemeColor(TH_TEXT_HI); - else - UI_ThemeColor(TH_TEXT); - offset += 3; - UI_DrawString(x+offset, y-4, name); - - /* reset offset - for RHS of panel */ - offset = 0; - - /* set blending again, as text drawing may clear it */ - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - - /* draw protect 'lock' */ - if (protect > -1) { - offset = 16; - UI_icon_draw((float)NLACHANNEL_NAMEWIDTH-offset, ydatac, protect); - } - - /* draw mute 'eye' */ - if (mute > -1) { - offset += 16; - UI_icon_draw((float)(NLACHANNEL_NAMEWIDTH-offset), ydatac, mute); - } - - /* draw NLA-action line 'status-icons' - only when there's an action */ - if ((ale->type == ANIMTYPE_NLAACTION) && (ale->data)) { - AnimData *adt= ale->adt; + /* draw protect 'lock' */ + if (protect > -1) { + offset = 16; + UI_icon_draw((float)(v2d->cur.xmax-offset), ydatac, protect); + } - offset += 16; + /* draw mute 'eye' */ + if (mute > -1) { + offset += 16; + UI_icon_draw((float)(v2d->cur.xmax-offset), ydatac, mute); + } - /* now draw some indicator icons */ - if ((adt) && (adt->flag & ADT_NLA_EDIT_ON)) { - /* toggle for tweaking with mapping/no-mapping (i.e. 'in place editing' toggle) */ - // for now, use pin icon to symbolise this - if (adt->flag & ADT_NLA_EDIT_NOMAP) - UI_icon_draw((float)(NLACHANNEL_NAMEWIDTH-offset), ydatac, ICON_PINNED); - else - UI_icon_draw((float)(NLACHANNEL_NAMEWIDTH-offset), ydatac, ICON_UNPINNED); + /* draw NLA-action line 'status-icons' - only when there's an action */ + if ((ale->type == ANIMTYPE_NLAACTION) && (ale->data)) { + AnimData *adt= ale->adt; - fdrawline((float)(NLACHANNEL_NAMEWIDTH-offset), yminc, - (float)(NLACHANNEL_NAMEWIDTH-offset), ymaxc); - offset += 16;; + offset += 16; - /* 'tweaking action' indicator - not a button */ - UI_icon_draw((float)NLACHANNEL_NAMEWIDTH-offset, ydatac, ICON_EDIT); - } - else { - /* XXX firstly draw a little rect to help identify that it's different from the toggles */ - glBegin(GL_LINE_LOOP); - glVertex2f((float)NLACHANNEL_NAMEWIDTH-offset-1, y-7); - glVertex2f((float)NLACHANNEL_NAMEWIDTH-offset-1, y+9); - glVertex2f((float)NLACHANNEL_NAMEWIDTH-1, y+9); - glVertex2f((float)NLACHANNEL_NAMEWIDTH-1, y-7); - glEnd(); // GL_LINES - - /* 'push down' icon for normal active-actions */ - UI_icon_draw((float)NLACHANNEL_NAMEWIDTH-offset, ydatac, ICON_FREEZE); + /* now draw some indicator icons */ + if ((adt) && (adt->flag & ADT_NLA_EDIT_ON)) { + /* toggle for tweaking with mapping/no-mapping (i.e. 'in place editing' toggle) */ + // for now, use pin icon to symbolise this + if (adt->flag & ADT_NLA_EDIT_NOMAP) + UI_icon_draw((float)(v2d->cur.xmax-offset), ydatac, ICON_PINNED); + else + UI_icon_draw((float)(v2d->cur.xmax-offset), ydatac, ICON_UNPINNED); + + fdrawline((float)(v2d->cur.xmax-offset), yminc, + (float)(v2d->cur.xmax-offset), ymaxc); + offset += 16;; + + /* 'tweaking action' indicator - not a button */ + UI_icon_draw((float)(v2d->cur.xmax-offset), ydatac, ICON_EDIT); + } + else { + /* XXX firstly draw a little rect to help identify that it's different from the toggles */ + glBegin(GL_LINE_LOOP); + glVertex2f((float)v2d->cur.xmax-offset-1, y-7); + glVertex2f((float)v2d->cur.xmax-offset-1, y+9); + glVertex2f((float)v2d->cur.xmax-1, y+9); + glVertex2f((float)v2d->cur.xmax-1, y-7); + glEnd(); // GL_LINES + + /* 'push down' icon for normal active-actions */ + UI_icon_draw((float)NLACHANNEL_NAMEWIDTH-offset, ydatac, ICON_FREEZE); + } } + + glDisable(GL_BLEND); } - - glDisable(GL_BLEND); } /* adjust y-position for next one */ diff --git a/source/blender/editors/space_time/time_header.c b/source/blender/editors/space_time/time_header.c index dd1130849b5..ea391e0cca7 100644 --- a/source/blender/editors/space_time/time_header.c +++ b/source/blender/editors/space_time/time_header.c @@ -437,7 +437,7 @@ void time_header_buttons(const bContext *C, ARegion *ar) &scene->r.psfra,0, 1, 0, 0, "Show settings for frame range of animation preview"); - xco += XIC*2.5; + xco += XIC*2; uiBlockBeginAlign(block); @@ -516,35 +516,37 @@ void time_header_buttons(const bContext *C, ARegion *ar) xco+= XIC; uiBlockEndAlign(block); - xco+= 0.5*XIC; + xco+= (short)(0.5*XIC); uiBlockBeginAlign(block); uiDefIconButBitS(block, TOG, AUTOKEY_ON, B_REDRAWALL, ICON_REC, xco, yco, XIC, YIC, &(scene->toolsettings->autokey_mode), 0, 0, 0, 0, "Automatic keyframe insertion for Objects and Bones"); xco+= 1*XIC; if (IS_AUTOKEY_ON(scene)) { -// uiDefButS(block, MENU, B_REDRAWALL, -// "Auto-Keying Mode %t|Add/Replace Keys%x3|Replace Keys %x5", -// xco, yco, (int)5.5*XIC, YIC, &(scene->toolsettings->autokey_mode), 0, 1, 0, 0, -// "Mode of automatic keyframe insertion for Objects and Bones"); + uiDefButS(block, MENU, B_REDRAWALL, + "Auto-Keying Mode %t|Add/Replace%x3|Replace%x5", + xco, yco, (int)(4.25*XIC), YIC, &(scene->toolsettings->autokey_mode), 0, 1, 0, 0, + "Mode of automatic keyframe insertion for Objects and Bones"); + xco+= (short)(4.25*XIC); if (animtimer) { uiDefButBitS(block, TOG, ANIMRECORD_FLAG_WITHNLA, B_REDRAWALL, "Layered", - xco,yco, 70, YIC, + xco,yco, (int)(3.5*XIC), YIC, &(scene->toolsettings->autokey_flag),0, 1, 0, 0, "Add a new NLA Track + Strip for every loop/pass made over the animation to allow non-destructive tweaking."); uiBlockEndAlign(block); + + xco+= (short)(3.5*XIC); } - + + xco += XIC; + + uiBlockEndAlign(block); + } + else { + xco+= (short)(5.25*XIC); uiBlockEndAlign(block); } - else - - - - uiBlockEndAlign(block); - - xco+= (4.5*XIC); menustr= ANIM_build_keyingsets_menu(&scene->keyingsets, 0); uiDefButI(block, MENU, B_DIFF, @@ -554,11 +556,14 @@ void time_header_buttons(const bContext *C, ARegion *ar) MEM_freeN(menustr); xco+= (5.5*XIC); + /* NOTE: order of these buttons needs to be kept in sync with other occurances + * (see Outliner header for instance, also +/- stuff for filebrowser) + */ uiBlockBeginAlign(block); - uiDefIconButO(block, BUT, "ANIM_OT_insert_keyframe", WM_OP_INVOKE_REGION_WIN, ICON_KEY_HLT, xco,yco,XIC,YIC, "Insert Keyframes for the Active Keying Set (I)"); - xco += XIC; uiDefIconButO(block, BUT, "ANIM_OT_delete_keyframe", WM_OP_INVOKE_REGION_WIN, ICON_KEY_DEHLT, xco,yco,XIC,YIC, "Delete Keyframes for the Active Keying Set (Alt-I)"); xco += XIC; + uiDefIconButO(block, BUT, "ANIM_OT_insert_keyframe", WM_OP_INVOKE_REGION_WIN, ICON_KEY_HLT, xco,yco,XIC,YIC, "Insert Keyframes for the Active Keying Set (I)"); + xco += XIC; uiBlockEndAlign(block); xco+= XIC; -- cgit v1.2.3