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:
-rw-r--r--source/blender/editors/animation/anim_channels_defines.c289
-rw-r--r--source/blender/editors/animation/anim_channels_edit.c286
-rw-r--r--source/blender/editors/include/ED_anim_api.h2
-rw-r--r--source/blender/editors/space_action/action_draw.c54
-rw-r--r--source/blender/editors/space_action/action_intern.h2
-rw-r--r--source/blender/editors/space_action/space_action.c2
-rw-r--r--source/blender/editors/space_graph/graph_draw.c54
-rw-r--r--source/blender/editors/space_graph/graph_intern.h2
-rw-r--r--source/blender/editors/space_graph/space_graph.c2
-rw-r--r--source/blender/editors/space_nla/nla_channels.c187
-rw-r--r--source/blender/editors/space_nla/nla_draw.c92
-rw-r--r--source/blender/editors/space_nla/nla_edit.c52
-rw-r--r--source/blender/editors/space_nla/nla_intern.h2
-rw-r--r--source/blender/editors/space_nla/space_nla.c2
14 files changed, 542 insertions, 486 deletions
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c
index 08155141053..c6e1dffbb30 100644
--- a/source/blender/editors/animation/anim_channels_defines.c
+++ b/source/blender/editors/animation/anim_channels_defines.c
@@ -287,6 +287,10 @@ static short acf_generic_dsexpand_setting_valid(bAnimContext *ac, bAnimListElem
case ACHANNEL_SETTING_EXPAND:
return 1;
+ /* visible - only available in Graph Editor */
+ case ACHANNEL_SETTING_VISIBLE:
+ return ((ac) && (ac->spacetype == SPACE_IPO));
+
default:
return 0;
}
@@ -345,6 +349,10 @@ static short acf_scene_setting_valid(bAnimContext *ac, bAnimListElem *ale, int s
/* muted only in NLA */
case ACHANNEL_SETTING_MUTE:
return ((ac) && (ac->spacetype == SPACE_NLA));
+
+ /* visible only in Graph Editor */
+ case ACHANNEL_SETTING_VISIBLE:
+ return ((ac) && (ac->spacetype == SPACE_IPO));
/* only select and expand supported otherwise */
case ACHANNEL_SETTING_SELECT:
@@ -373,6 +381,10 @@ static int acf_scene_setting_flag(int setting, short *neg)
case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
return ADT_NLA_EVAL_OFF;
+ case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
+ *neg= 1;
+ return ADT_CURVES_NOT_VISIBLE;
+
default: /* unsupported */
return 0;
}
@@ -394,6 +406,7 @@ static void *acf_scene_setting_ptr(bAnimListElem *ale, int setting, short *type)
GET_ACF_FLAG_PTR(scene->flag);
case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
+ case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
if (scene->adt)
GET_ACF_FLAG_PTR(scene->adt->flag)
else
@@ -451,6 +464,10 @@ static short acf_object_setting_valid(bAnimContext *ac, bAnimListElem *ale, int
/* muted only in NLA */
case ACHANNEL_SETTING_MUTE:
return ((ac) && (ac->spacetype == SPACE_NLA));
+
+ /* visible only in Graph Editor */
+ case ACHANNEL_SETTING_VISIBLE:
+ return ((ac) && (ac->spacetype == SPACE_IPO));
/* only select and expand supported otherwise */
case ACHANNEL_SETTING_SELECT:
@@ -479,6 +496,10 @@ static int acf_object_setting_flag(int setting, short *neg)
case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
return ADT_NLA_EVAL_OFF;
+ case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
+ *neg= 1;
+ return ADT_CURVES_NOT_VISIBLE;
+
default: /* unsupported */
return 0;
}
@@ -501,6 +522,7 @@ static void *acf_object_setting_ptr(bAnimListElem *ale, int setting, short *type
GET_ACF_FLAG_PTR(ob->nlaflag); // xxx
case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
+ case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
if (ob->adt)
GET_ACF_FLAG_PTR(ob->adt->flag)
else
@@ -560,8 +582,14 @@ static void acf_group_name(bAnimListElem *ale, char *name)
/* check if some setting exists for this channel */
static short acf_group_setting_valid(bAnimContext *ac, bAnimListElem *ale, int setting)
{
- /* for now, all settings are supported */
- return 1;
+ /* for now, all settings are supported, though some are only conditionally */
+ switch (setting) {
+ case ACHANNEL_SETTING_VISIBLE: /* Only available in Graph Editor */
+ return ((ac->sa) && (ac->sa->spacetype==SPACE_IPO));
+
+ default: /* always supported */
+ return 1;
+ }
}
/* get the appropriate flag(s) for the setting when it is valid */
@@ -641,6 +669,9 @@ static short acf_fcurve_setting_valid(bAnimContext *ac, bAnimListElem *ale, int
return 1;
else
return 0; // NOTE: in this special case, we need to draw ICON_ZOOMOUT
+
+ case ACHANNEL_SETTING_VISIBLE: /* Only available in Graph Editor */
+ return ((ac->sa) && (ac->sa->spacetype==SPACE_IPO));
/* always available */
default:
@@ -962,6 +993,10 @@ static int acf_dsmat_setting_flag(int setting, short *neg)
case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
return ADT_NLA_EVAL_OFF;
+
+ case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
+ *neg= 1;
+ return ADT_CURVES_NOT_VISIBLE;
default: /* unsupported */
return 0;
@@ -981,10 +1016,11 @@ static void *acf_dsmat_setting_ptr(bAnimListElem *ale, int setting, short *type)
GET_ACF_FLAG_PTR(ma->flag);
case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
+ case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
if (ma->adt)
GET_ACF_FLAG_PTR(ma->adt->flag)
else
- return NULL;
+ return NULL;
default: /* unsupported */
return NULL;
@@ -1026,6 +1062,10 @@ static int acf_dslam_setting_flag(int setting, short *neg)
case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
return ADT_NLA_EVAL_OFF;
+
+ case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
+ *neg= 1;
+ return ADT_CURVES_NOT_VISIBLE;
default: /* unsupported */
return 0;
@@ -1045,10 +1085,11 @@ static void *acf_dslam_setting_ptr(bAnimListElem *ale, int setting, short *type)
GET_ACF_FLAG_PTR(la->flag);
case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
+ case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
if (la->adt)
GET_ACF_FLAG_PTR(la->adt->flag)
else
- return NULL;
+ return NULL;
default: /* unsupported */
return NULL;
@@ -1090,6 +1131,10 @@ static int acf_dscam_setting_flag(int setting, short *neg)
case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
return ADT_NLA_EVAL_OFF;
+
+ case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
+ *neg= 1;
+ return ADT_CURVES_NOT_VISIBLE;
default: /* unsupported */
return 0;
@@ -1109,6 +1154,7 @@ static void *acf_dscam_setting_ptr(bAnimListElem *ale, int setting, short *type)
GET_ACF_FLAG_PTR(ca->flag);
case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
+ case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
if (ca->adt)
GET_ACF_FLAG_PTR(ca->adt->flag)
else
@@ -1154,6 +1200,10 @@ static int acf_dscur_setting_flag(int setting, short *neg)
case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
return ADT_NLA_EVAL_OFF;
+
+ case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
+ *neg= 1;
+ return ADT_CURVES_NOT_VISIBLE;
default: /* unsupported */
return 0;
@@ -1173,6 +1223,7 @@ static void *acf_dscur_setting_ptr(bAnimListElem *ale, int setting, short *type)
GET_ACF_FLAG_PTR(cu->flag);
case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
+ case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
if (cu->adt)
GET_ACF_FLAG_PTR(cu->adt->flag)
else
@@ -1218,6 +1269,10 @@ static int acf_dsskey_setting_flag(int setting, short *neg)
case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
return ADT_NLA_EVAL_OFF;
+
+ case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
+ *neg= 1;
+ return ADT_CURVES_NOT_VISIBLE;
default: /* unsupported */
return 0;
@@ -1237,6 +1292,7 @@ static void *acf_dsskey_setting_ptr(bAnimListElem *ale, int setting, short *type
GET_ACF_FLAG_PTR(key->flag);
case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
+ case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
if (key->adt)
GET_ACF_FLAG_PTR(key->adt->flag)
else
@@ -1282,6 +1338,10 @@ static int acf_dswor_setting_flag(int setting, short *neg)
case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
return ADT_NLA_EVAL_OFF;
+
+ case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
+ *neg= 1;
+ return ADT_CURVES_NOT_VISIBLE;
default: /* unsupported */
return 0;
@@ -1301,6 +1361,7 @@ static void *acf_dswor_setting_ptr(bAnimListElem *ale, int setting, short *type)
GET_ACF_FLAG_PTR(wo->flag);
case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
+ case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
if (wo->adt)
GET_ACF_FLAG_PTR(wo->adt->flag)
else
@@ -1346,6 +1407,10 @@ static int acf_dspart_setting_flag(int setting, short *neg)
case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
return ADT_NLA_EVAL_OFF;
+
+ case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
+ *neg= 1;
+ return ADT_CURVES_NOT_VISIBLE;
default: /* unsupported */
return 0;
@@ -1365,6 +1430,7 @@ static void *acf_dspart_setting_ptr(bAnimListElem *ale, int setting, short *type
GET_ACF_FLAG_PTR(part->flag);
case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
+ case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
if (part->adt)
GET_ACF_FLAG_PTR(part->adt->flag)
else
@@ -1410,6 +1476,10 @@ static int acf_dsmball_setting_flag(int setting, short *neg)
case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
return ADT_NLA_EVAL_OFF;
+
+ case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
+ *neg= 1;
+ return ADT_CURVES_NOT_VISIBLE;
default: /* unsupported */
return 0;
@@ -1429,6 +1499,7 @@ static void *acf_dsmball_setting_ptr(bAnimListElem *ale, int setting, short *typ
GET_ACF_FLAG_PTR(mb->flag);
case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
+ case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
if (mb->adt)
GET_ACF_FLAG_PTR(mb->adt->flag)
else
@@ -1805,7 +1876,7 @@ void ANIM_channel_draw (bAnimContext *ac, bAnimListElem *ale, float yminc, float
{
bAnimChannelType *acf= ANIM_channel_get_typeinfo(ale);
View2D *v2d= &ac->ar->v2d;
- short selected, offset, enabled;
+ short selected, offset;
float y, ymid, ytext;
/* sanity checks - don't draw anything */
@@ -1815,8 +1886,6 @@ void ANIM_channel_draw (bAnimContext *ac, bAnimListElem *ale, float yminc, float
/* get initial offset */
if (acf->get_offset)
offset= acf->get_offset(ac, ale);
- else if (acf->get_indent_level)
- offset= acf->get_indent_level(ac, ale) * INDENT_STEP_SIZE;
else
offset= 0;
@@ -1844,9 +1913,7 @@ void ANIM_channel_draw (bAnimContext *ac, bAnimListElem *ale, float yminc, float
/* step 2) draw expand widget ....................................... */
if (acf->has_setting(ac, ale, ACHANNEL_SETTING_EXPAND)) {
- enabled= ANIM_channel_setting_get(ac, ale, ACHANNEL_SETTING_EXPAND);
-
- UI_icon_draw(offset, ymid, ((enabled)? ICON_TRIA_DOWN : ICON_TRIA_RIGHT));
+ /* just skip - drawn as widget now */
offset += ICON_WIDTH;
}
@@ -1862,8 +1929,6 @@ void ANIM_channel_draw (bAnimContext *ac, bAnimListElem *ale, float yminc, float
*/
if (ac->sa) {
if ((ac->spacetype == SPACE_IPO) && acf->has_setting(ac, ale, ACHANNEL_SETTING_VISIBLE)) {
- enabled= ANIM_channel_setting_get(ac, ale, ACHANNEL_SETTING_VISIBLE);
-
/* for F-Curves, draw color-preview of curve behind checkbox */
if (ale->type == ANIMTYPE_FCURVE) {
FCurve *fcu= (FCurve *)ale->data;
@@ -1880,16 +1945,11 @@ void ANIM_channel_draw (bAnimContext *ac, bAnimListElem *ale, float yminc, float
glRectf(offset, yminc, offset+17, ymaxc);
}
- /* finally the icon itself */
- UI_icon_draw(offset, ymid, ((enabled)? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT));
+ /* icon is drawn as widget now... */
offset += ICON_WIDTH;
}
else if ((ac->spacetype == SPACE_NLA) && acf->has_setting(ac, ale, ACHANNEL_SETTING_SOLO)) {
- /* simply draw glowing dot in NLA for whether the track is enabled or not... */
- // NOTE: assumed to be for NLA track only for now...
- enabled= ANIM_channel_setting_get(ac, ale, ACHANNEL_SETTING_SOLO);
-
- UI_icon_draw(offset, ymid, ((enabled)? ICON_LAYER_ACTIVE : ICON_LAYER_USED));
+ /* just skip - drawn as widget now */
offset += ICON_WIDTH;
}
}
@@ -1927,21 +1987,198 @@ void ANIM_channel_draw (bAnimContext *ac, bAnimListElem *ale, float yminc, float
/* protect... */
if (acf->has_setting(ac, ale, ACHANNEL_SETTING_PROTECT)) {
- enabled= ANIM_channel_setting_get(ac, ale, ACHANNEL_SETTING_PROTECT);
-
+ /* just skip - drawn as widget now */
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));
+ /* just skip - drawn as widget now */
+ offset += ICON_WIDTH;
}
glDisable(GL_BLEND); /* End of blending with background */
}
}
+/* ------------------ */
+
+/* callback for widget settings - send notifiers */
+static void achannel_setting_widget_cb(bContext *C, void *poin, void *poin2)
+{
+ WM_event_add_notifier(C, NC_ANIMATION|ND_ANIMCHAN_EDIT, NULL);
+}
+
+/* Draw a widget for some setting */
+static void draw_setting_widget (bAnimContext *ac, bAnimListElem *ale, bAnimChannelType *acf, uiBlock *block, int xpos, int ypos, int setting)
+{
+ short negflag, ptrsize, enabled, butType;
+ int flag, icon;
+ void *ptr;
+ char *tooltip;
+ uiBut *but = NULL;
+
+ /* get the flag and the pointer to that flag */
+ flag= acf->setting_flag(setting, &negflag);
+ ptr= acf->setting_ptr(ale, setting, &ptrsize);
+ enabled= ANIM_channel_setting_get(ac, ale, setting);
+
+ /* get the base icon for the setting */
+ switch (setting) {
+ case ACHANNEL_SETTING_VISIBLE: /* visibility checkboxes */
+ //icon= ((enabled)? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT);
+ icon= ICON_CHECKBOX_DEHLT;
+
+ if (ale->type == ANIMTYPE_FCURVE)
+ tooltip= "F-Curve is visible in Graph Editor for editing.";
+ else
+ tooltip= "F-Curve(s) are visible in Graph Editor for editing.";
+ break;
+
+ case ACHANNEL_SETTING_EXPAND: /* expanded triangle */
+ //icon= ((enabled)? ICON_TRIA_DOWN : ICON_TRIA_RIGHT);
+ icon= ICON_TRIA_RIGHT;
+ tooltip= "Make channels grouped under this channel visible.";
+ break;
+
+ case ACHANNEL_SETTING_SOLO: /* NLA Tracks only */
+ //icon= ((enabled)? ICON_LAYER_ACTIVE : ICON_LAYER_USED);
+ icon= ICON_LAYER_USED;
+ tooltip= "NLA Track is the only one evaluated for the AnimData block it belongs to.";
+ break;
+
+ /* --- */
+
+ case ACHANNEL_SETTING_PROTECT: /* protected lock */
+ // TODO: what about when there's no protect needed?
+ //icon= ((enabled)? ICON_LOCKED : ICON_UNLOCKED);
+ icon= ICON_UNLOCKED;
+ tooltip= "Editability of keyframes for this channel.";
+ break;
+
+ case ACHANNEL_SETTING_MUTE: /* muted eye */
+ //icon= ((enabled)? ICON_MUTE_IPO_ON : ICON_MUTE_IPO_OFF);
+ icon= ICON_MUTE_IPO_OFF;
+ tooltip= "Do channel(s) contribute to result."; // XXX
+ break;
+
+ default:
+ tooltip= NULL;
+ icon= 0;
+ break;
+ }
+
+ /* type of button */
+ if (negflag)
+ butType= ICONTOGN;
+ else
+ butType= ICONTOG;
+
+ /* draw button for setting */
+ if (ptr && flag) {
+ switch (ptrsize) {
+ case sizeof(int): /* integer pointer for setting */
+ but= uiDefIconButBitI(block, butType, flag, 0, icon,
+ xpos, ypos, ICON_WIDTH, ICON_WIDTH, ptr, 0, 0, 0, 0, tooltip);
+ break;
+
+ case sizeof(short): /* short pointer for setting */
+ but= uiDefIconButBitS(block, butType, flag, 0, icon,
+ xpos, ypos, ICON_WIDTH, ICON_WIDTH, ptr, 0, 0, 0, 0, tooltip);
+ break;
+
+ case sizeof(char): /* char pointer for setting */
+ but= uiDefIconButBitC(block, butType, flag, 0, icon,
+ xpos, ypos, ICON_WIDTH, ICON_WIDTH, ptr, 0, 0, 0, 0, tooltip);
+ break;
+ }
+
+ /* set call to send relevant notifiers */
+ // NOTE: for now, we only need to send 'edited'
+ if (but)
+ uiButSetFunc(but, achannel_setting_widget_cb, NULL, NULL);
+ }
+}
+
+/* Draw UI widgets the given channel */
+// TODO: make this use UI controls for the buttons
+void ANIM_channel_draw_widgets (bAnimContext *ac, bAnimListElem *ale, uiBlock *block, float yminc, float ymaxc)
+{
+ bAnimChannelType *acf= ANIM_channel_get_typeinfo(ale);
+ View2D *v2d= &ac->ar->v2d;
+ float y, ymid, ytext;
+ short offset;
+
+ /* sanity checks - don't draw anything */
+ if ELEM3(NULL, acf, ale, block)
+ return;
+
+ /* get initial offset */
+ if (acf->get_offset)
+ offset= acf->get_offset(ac, ale);
+ else
+ offset= 0;
+
+ /* calculate appropriate y-coordinates for icon buttons
+ * 7 is hardcoded factor for half-height of icons
+ */
+ y= (ymaxc - yminc)/2 + yminc;
+ ymid= y - 7;
+ /* y-coordinates for text is only 4 down from middle */
+ ytext= y - 4;
+
+ /* no button backdrop behind icons */
+ uiBlockSetEmboss(block, UI_EMBOSSN);
+
+ /* step 1) draw expand widget ....................................... */
+ if (acf->has_setting(ac, ale, ACHANNEL_SETTING_EXPAND)) {
+ draw_setting_widget(ac, ale, acf, block, offset, ymid, ACHANNEL_SETTING_EXPAND);
+ offset += ICON_WIDTH;
+ }
+
+ /* step 2) draw icon ............................................... */
+ if (acf->icon) {
+ /* icon is not drawn here (not a widget) */
+ offset += ICON_WIDTH;
+ }
+
+ /* step 3) draw special toggles .................................
+ * - in Graph Editor, checkboxes for visibility in curves area
+ * - in NLA Editor, glowing dots for solo/not solo...
+ */
+ if (ac->sa) {
+ if ((ac->spacetype == SPACE_IPO) && acf->has_setting(ac, ale, ACHANNEL_SETTING_VISIBLE)) {
+ /* visibility toggle */
+ draw_setting_widget(ac, ale, acf, block, offset, ymid, ACHANNEL_SETTING_VISIBLE);
+ offset += ICON_WIDTH;
+ }
+ else if ((ac->spacetype == SPACE_NLA) && acf->has_setting(ac, ale, ACHANNEL_SETTING_SOLO)) {
+ /* 'solo' setting for NLA Tracks */
+ draw_setting_widget(ac, ale, acf, block, offset, ymid, ACHANNEL_SETTING_SOLO);
+ offset += ICON_WIDTH;
+ }
+ }
+
+ /* step 4) draw text... */
+ /* NOTE: this is not done here, since nothing to be clicked on... */
+
+ /* step 5) draw mute+protection toggles + (sliders) ....................... */
+ /* reset offset - now goes from RHS of panel */
+ offset = 0;
+
+ // TODO: when drawing sliders, make those draw instead of these toggles if not enough space
+
+ if (v2d) {
+ /* protect... */
+ if (acf->has_setting(ac, ale, ACHANNEL_SETTING_PROTECT)) {
+ offset += ICON_WIDTH;
+ draw_setting_widget(ac, ale, acf, block, (int)v2d->cur.xmax-offset, ymid, ACHANNEL_SETTING_PROTECT);
+ }
+ /* mute... */
+ if (acf->has_setting(ac, ale, ACHANNEL_SETTING_MUTE)) {
+ offset += ICON_WIDTH;
+ draw_setting_widget(ac, ale, acf, block, (int)v2d->cur.xmax-offset, ymid, ACHANNEL_SETTING_MUTE);
+ }
+ }
+}
+
/* *********************************************** */
diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c
index 4f463d3daed..72d8f71bc26 100644
--- a/source/blender/editors/animation/anim_channels_edit.c
+++ b/source/blender/editors/animation/anim_channels_edit.c
@@ -1277,11 +1277,7 @@ void ANIM_OT_channels_select_border(wmOperatorType *ot)
}
/* ******************** Mouse-Click Operator *********************** */
-/* Depending on the channel that was clicked on, the mouse click will activate whichever
- * part of the channel is relevant.
- *
- * NOTE: eventually, this should probably be phased out when many of these things are replaced with buttons
- */
+/* Handle selection changes due to clicking on channels. Settings will get caught by UI code... */
static int mouse_anim_channels (bAnimContext *ac, float x, int channel_index, short selectmode)
{
@@ -1319,24 +1315,16 @@ static int mouse_anim_channels (bAnimContext *ac, float x, int channel_index, sh
{
Scene *sce= (Scene *)ale->data;
- if (x < 16) {
- /* toggle expand */
- sce->flag ^= SCE_DS_COLLAPSED;
-
- notifierFlags |= ND_ANIMCHAN_EDIT;
+ /* set selection status */
+ if (selectmode == SELECT_INVERT) {
+ /* swap select */
+ sce->flag ^= SCE_DS_SELECTED;
}
else {
- /* set selection status */
- if (selectmode == SELECT_INVERT) {
- /* swap select */
- sce->flag ^= SCE_DS_SELECTED;
- }
- else {
- sce->flag |= SCE_DS_SELECTED;
- }
-
- notifierFlags |= ND_ANIMCHAN_SELECT;
+ sce->flag |= SCE_DS_SELECTED;
}
+
+ notifierFlags |= ND_ANIMCHAN_SELECT;
}
break;
case ANIMTYPE_OBJECT:
@@ -1346,233 +1334,87 @@ static int mouse_anim_channels (bAnimContext *ac, float x, int channel_index, sh
Base *base= (Base *)ale->data;
Object *ob= base->object;
- if (x < 16) {
- /* toggle expand */
- ob->nlaflag ^= OB_ADS_COLLAPSED; // XXX
-
- notifierFlags |= ND_ANIMCHAN_EDIT;
+ /* set selection status */
+ if (selectmode == SELECT_INVERT) {
+ /* swap select */
+ base->flag ^= SELECT;
+ ob->flag= base->flag;
}
else {
- /* set selection status */
- if (selectmode == SELECT_INVERT) {
- /* swap select */
- base->flag ^= SELECT;
- ob->flag= base->flag;
- }
- else {
- Base *b;
-
- /* deleselect all */
- for (b= sce->base.first; b; b= b->next) {
- b->flag &= ~SELECT;
- b->object->flag= b->flag;
- }
-
- /* select object now */
- base->flag |= SELECT;
- ob->flag |= SELECT;
- }
+ Base *b;
- /* xxx should be ED_base_object_activate(), but we need context pointer for that... */
- //set_active_base(base);
+ /* deleselect all */
+ for (b= sce->base.first; b; b= b->next) {
+ b->flag &= ~SELECT;
+ b->object->flag= b->flag;
+ }
- notifierFlags |= ND_ANIMCHAN_SELECT;
+ /* select object now */
+ base->flag |= SELECT;
+ ob->flag |= SELECT;
}
- }
- break;
- case ANIMTYPE_FILLACTD:
- {
- bAction *act= (bAction *)ale->data;
- act->flag ^= ACT_COLLAPSED;
- notifierFlags |= ND_ANIMCHAN_EDIT;
- }
- break;
- case ANIMTYPE_FILLDRIVERS:
- {
- AnimData *adt= (AnimData* )ale->data;
- adt->flag ^= ADT_DRIVERS_COLLAPSED;
- notifierFlags |= ND_ANIMCHAN_EDIT;
- }
- break;
- case ANIMTYPE_FILLMATD:
- {
- Object *ob= (Object *)ale->data;
- ob->nlaflag ^= OB_ADS_SHOWMATS; // XXX
- notifierFlags |= ND_ANIMCHAN_EDIT;
- }
- break;
- case ANIMTYPE_FILLPARTD:
- {
- Object *ob= (Object *)ale->data;
- ob->nlaflag ^= OB_ADS_SHOWPARTS; // XXX
- notifierFlags |= ND_ANIMCHAN_EDIT;
- }
- break;
-
- case ANIMTYPE_DSMAT:
- {
- Material *ma= (Material *)ale->data;
- ma->flag ^= MA_DS_EXPAND;
- notifierFlags |= ND_ANIMCHAN_EDIT;
- }
- break;
- case ANIMTYPE_DSLAM:
- {
- Lamp *la= (Lamp *)ale->data;
- la->flag ^= LA_DS_EXPAND;
- notifierFlags |= ND_ANIMCHAN_EDIT;
- }
- break;
- case ANIMTYPE_DSCAM:
- {
- Camera *ca= (Camera *)ale->data;
- ca->flag ^= CAM_DS_EXPAND;
- notifierFlags |= ND_ANIMCHAN_EDIT;
- }
- break;
- case ANIMTYPE_DSCUR:
- {
- Curve *cu= (Curve *)ale->data;
- cu->flag ^= CU_DS_EXPAND;
- notifierFlags |= ND_ANIMCHAN_EDIT;
- }
- break;
- case ANIMTYPE_DSSKEY:
- {
- Key *key= (Key *)ale->data;
- key->flag ^= KEYBLOCK_DS_EXPAND;
- notifierFlags |= ND_ANIMCHAN_EDIT;
- }
- break;
- case ANIMTYPE_DSWOR:
- {
- World *wo= (World *)ale->data;
- wo->flag ^= WO_DS_EXPAND;
- notifierFlags |= ND_ANIMCHAN_EDIT;
- }
- break;
- case ANIMTYPE_DSPART:
- {
- ParticleSettings *part= (ParticleSettings *)ale->data;
- part->flag ^= PART_DS_EXPAND;
- notifierFlags |= ND_ANIMCHAN_EDIT;
- }
- break;
- case ANIMTYPE_DSMBALL:
- {
- MetaBall *mb= (MetaBall *)ale->data;
- mb->flag2 ^= MB_DS_EXPAND;
- notifierFlags |= ND_ANIMCHAN_EDIT;
+
+ /* xxx should be ED_base_object_activate(), but we need context pointer for that... */
+ //set_active_base(base);
+
+ notifierFlags |= ND_ANIMCHAN_SELECT;
}
break;
case ANIMTYPE_GROUP:
{
bActionGroup *agrp= (bActionGroup *)ale->data;
- short offset= (ELEM3(ac->datatype, ANIMCONT_DOPESHEET, ANIMCONT_FCURVES, ANIMCONT_DRIVERS))? 18 : 0;
- if ((x < (offset+17)) && (agrp->channels.first)) {
- /* toggle expand */
- agrp->flag ^= AGRP_EXPANDED;
- notifierFlags |= ND_ANIMCHAN_EDIT;
+ /* select/deselect group */
+ if (selectmode == SELECT_INVERT) {
+ /* inverse selection status of this group only */
+ agrp->flag ^= AGRP_SELECTED;
}
- else if ((x < (offset+32)) && (ac->spacetype==SPACE_IPO)) {
- /* toggle visibility (of grouped F-Curves in Graph editor) */
- agrp->flag ^= AGRP_NOTVISIBLE;
- notifierFlags |= ND_ANIMCHAN_EDIT;
- }
- else if (x >= (ACHANNEL_NAMEWIDTH-ACHANNEL_BUTTON_WIDTH)) {
- /* toggle protection/locking */
- agrp->flag ^= AGRP_PROTECTED;
- notifierFlags |= ND_ANIMCHAN_EDIT;
- }
- else if (x >= (ACHANNEL_NAMEWIDTH-2*ACHANNEL_BUTTON_WIDTH)) {
- /* toggle mute */
- agrp->flag ^= AGRP_MUTED;
- notifierFlags |= ND_ANIMCHAN_EDIT;
+ else if (selectmode == -1) {
+ /* select all in group (and deselect everthing else) */
+ FCurve *fcu;
+
+ /* deselect all other channels */
+ ANIM_deselect_anim_channels(ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR);
+
+ /* only select channels in group and group itself */
+ for (fcu= agrp->channels.first; fcu && fcu->grp==agrp; fcu= fcu->next)
+ fcu->flag |= FCURVE_SELECTED;
+ agrp->flag |= AGRP_SELECTED;
}
else {
- /* select/deselect group */
- if (selectmode == SELECT_INVERT) {
- /* inverse selection status of this group only */
- agrp->flag ^= AGRP_SELECTED;
- }
- else if (selectmode == -1) {
- /* select all in group (and deselect everthing else) */
- FCurve *fcu;
-
- /* deselect all other channels */
- ANIM_deselect_anim_channels(ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR);
-
- /* only select channels in group and group itself */
- for (fcu= agrp->channels.first; fcu && fcu->grp==agrp; fcu= fcu->next)
- fcu->flag |= FCURVE_SELECTED;
- agrp->flag |= AGRP_SELECTED;
- }
- else {
- /* select group by itself */
- ANIM_deselect_anim_channels(ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR);
- agrp->flag |= AGRP_SELECTED;
- }
-
- /* if group is selected now, make group the 'active' one in the visible list */
- if (agrp->flag & AGRP_SELECTED)
- ANIM_set_active_channel(ac, ac->data, ac->datatype, filter, agrp, ANIMTYPE_GROUP);
-
- notifierFlags |= ND_ANIMCHAN_SELECT;
+ /* select group by itself */
+ ANIM_deselect_anim_channels(ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR);
+ agrp->flag |= AGRP_SELECTED;
}
+
+ /* if group is selected now, make group the 'active' one in the visible list */
+ if (agrp->flag & AGRP_SELECTED)
+ ANIM_set_active_channel(ac, ac->data, ac->datatype, filter, agrp, ANIMTYPE_GROUP);
+
+ notifierFlags |= ND_ANIMCHAN_SELECT;
}
break;
case ANIMTYPE_FCURVE:
{
FCurve *fcu= (FCurve *)ale->data;
- short offset;
- if (ac->datatype != ANIMCONT_ACTION) {
- /* for now, special case for materials */
- if (ale->ownertype == ANIMTYPE_DSMAT)
- offset= 21;
- else
- offset= 18;
- }
- else
- offset = 0;
-
- if (x >= (ACHANNEL_NAMEWIDTH-ACHANNEL_BUTTON_WIDTH)) {
- /* toggle protection (only if there's a toggle there) */
- if (fcu->bezt) {
- fcu->flag ^= FCURVE_PROTECTED;
- notifierFlags |= ND_ANIMCHAN_EDIT;
- }
- }
- else if (x >= (ACHANNEL_NAMEWIDTH-2*ACHANNEL_BUTTON_WIDTH)) {
- /* toggle mute */
- fcu->flag ^= FCURVE_MUTED;
- notifierFlags |= ND_ANIMCHAN_EDIT;
- }
- else if ((x < (offset+17)) && (ac->spacetype==SPACE_IPO)) {
- /* toggle visibility */
- fcu->flag ^= FCURVE_VISIBLE;
- notifierFlags |= ND_ANIMCHAN_EDIT;
+ /* select/deselect */
+ if (selectmode == SELECT_INVERT) {
+ /* inverse selection status of this F-Curve only */
+ fcu->flag ^= FCURVE_SELECTED;
}
else {
- /* select/deselect */
- if (selectmode == SELECT_INVERT) {
- /* inverse selection status of this F-Curve only */
- fcu->flag ^= FCURVE_SELECTED;
- }
- else {
- /* select F-Curve by itself */
- ANIM_deselect_anim_channels(ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR);
- fcu->flag |= FCURVE_SELECTED;
- }
-
- /* if F-Curve is selected now, make F-Curve the 'active' one in the visible list */
- if (fcu->flag & FCURVE_SELECTED)
- ANIM_set_active_channel(ac, ac->data, ac->datatype, filter, fcu, ANIMTYPE_FCURVE);
-
- notifierFlags |= ND_ANIMCHAN_SELECT;
+ /* select F-Curve by itself */
+ ANIM_deselect_anim_channels(ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR);
+ fcu->flag |= FCURVE_SELECTED;
}
+
+ /* if F-Curve is selected now, make F-Curve the 'active' one in the visible list */
+ if (fcu->flag & FCURVE_SELECTED)
+ ANIM_set_active_channel(ac, ac->data, ac->datatype, filter, fcu, ANIMTYPE_FCURVE);
+
+ notifierFlags |= ND_ANIMCHAN_SELECT;
}
break;
case ANIMTYPE_GPDATABLOCK:
diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h
index 21c5e6bbcf9..879589236ce 100644
--- a/source/blender/editors/include/ED_anim_api.h
+++ b/source/blender/editors/include/ED_anim_api.h
@@ -338,6 +338,8 @@ bAnimChannelType *ANIM_channel_get_typeinfo(bAnimListElem *ale);
/* Draw the given channel */
void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc);
+/* Draw the widgets for the given channel */
+void ANIM_channel_draw_widgets(bAnimContext *ac, bAnimListElem *ale, struct uiBlock *block, float yminc, float ymaxc);
/* ------------------------ Editing API -------------------------- */
diff --git a/source/blender/editors/space_action/action_draw.c b/source/blender/editors/space_action/action_draw.c
index f5fa263eee8..4fb22064c17 100644
--- a/source/blender/editors/space_action/action_draw.c
+++ b/source/blender/editors/space_action/action_draw.c
@@ -397,7 +397,7 @@ static void action_icu_buts(SpaceAction *saction)
/* Channel List */
/* left hand part */
-void draw_channel_names(bAnimContext *ac, SpaceAction *saction, ARegion *ar)
+void draw_channel_names(bContext *C, bAnimContext *ac, SpaceAction *saction, ARegion *ar)
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
@@ -428,22 +428,48 @@ void draw_channel_names(bAnimContext *ac, SpaceAction *saction, ARegion *ar)
UI_view2d_sync(NULL, ac->sa, v2d, V2D_VIEWSYNC_AREA_VERTICAL);
/* loop through channels, and set up drawing depending on their type */
- y= (float)ACHANNEL_FIRST;
-
- for (ale= anim_data.first; ale; ale= ale->next) {
- float yminc= (float)(y - ACHANNEL_HEIGHT_HALF);
- float ymaxc= (float)(y + ACHANNEL_HEIGHT_HALF);
+ { /* first pass: just the standard GL-drawing for backdrop + text */
+ y= (float)ACHANNEL_FIRST;
- /* check if visible */
- if ( IN_RANGE(yminc, v2d->cur.ymin, v2d->cur.ymax) ||
- IN_RANGE(ymaxc, v2d->cur.ymin, v2d->cur.ymax) )
- {
- /* draw all channels using standard channel-drawing API */
- ANIM_channel_draw(ac, ale, yminc, ymaxc);
+ for (ale= anim_data.first; ale; ale= ale->next) {
+ float yminc= (float)(y - ACHANNEL_HEIGHT_HALF);
+ float ymaxc= (float)(y + ACHANNEL_HEIGHT_HALF);
+
+ /* check if visible */
+ if ( IN_RANGE(yminc, v2d->cur.ymin, v2d->cur.ymax) ||
+ IN_RANGE(ymaxc, v2d->cur.ymin, v2d->cur.ymax) )
+ {
+ /* draw all channels using standard channel-drawing API */
+ ANIM_channel_draw(ac, ale, yminc, ymaxc);
+ }
+
+ /* adjust y-position for next one */
+ y -= ACHANNEL_STEP;
}
+ }
+ { /* second pass: widgets */
+ uiBlock *block= uiBeginBlock(C, ar, "dopesheet channel buttons", UI_EMBOSS);
- /* adjust y-position for next one */
- y -= ACHANNEL_STEP;
+ y= (float)ACHANNEL_FIRST;
+
+ for (ale= anim_data.first; ale; ale= ale->next) {
+ float yminc= (float)(y - ACHANNEL_HEIGHT_HALF);
+ float ymaxc= (float)(y + ACHANNEL_HEIGHT_HALF);
+
+ /* check if visible */
+ if ( IN_RANGE(yminc, v2d->cur.ymin, v2d->cur.ymax) ||
+ IN_RANGE(ymaxc, v2d->cur.ymin, v2d->cur.ymax) )
+ {
+ /* draw all channels using standard channel-drawing API */
+ ANIM_channel_draw_widgets(ac, ale, block, yminc, ymaxc);
+ }
+
+ /* adjust y-position for next one */
+ y -= ACHANNEL_STEP;
+ }
+
+ uiEndBlock(C, block);
+ uiDrawBlock(C, block);
}
/* free tempolary channels */
diff --git a/source/blender/editors/space_action/action_intern.h b/source/blender/editors/space_action/action_intern.h
index 26655892176..1aeeeff0c80 100644
--- a/source/blender/editors/space_action/action_intern.h
+++ b/source/blender/editors/space_action/action_intern.h
@@ -41,7 +41,7 @@ struct bAnimListElem;
/* ***************************************** */
/* action_draw.c */
-void draw_channel_names(struct bAnimContext *ac, struct SpaceAction *saction, struct ARegion *ar);
+void draw_channel_names(struct bContext *C, struct bAnimContext *ac, struct SpaceAction *saction, struct ARegion *ar);
void draw_channel_strips(struct bAnimContext *ac, struct SpaceAction *saction, struct ARegion *ar);
struct ActKeysInc *init_aki_data(struct bAnimContext *ac, struct bAnimListElem *ale);
diff --git a/source/blender/editors/space_action/space_action.c b/source/blender/editors/space_action/space_action.c
index 55e035cfced..275ac4ea4c1 100644
--- a/source/blender/editors/space_action/space_action.c
+++ b/source/blender/editors/space_action/space_action.c
@@ -243,7 +243,7 @@ static void action_channel_area_draw(const bContext *C, ARegion *ar)
/* data */
if (ANIM_animdata_get_context(C, &ac)) {
- draw_channel_names(&ac, saction, ar);
+ draw_channel_names(C, &ac, saction, ar);
}
/* reset view matrix */
diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c
index 46d067d9dd2..c2d8d7b1345 100644
--- a/source/blender/editors/space_graph/graph_draw.c
+++ b/source/blender/editors/space_graph/graph_draw.c
@@ -878,7 +878,7 @@ void graph_draw_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGri
/* Channel List */
/* left hand part */
-void graph_draw_channel_names(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar)
+void graph_draw_channel_names(bContext *C, bAnimContext *ac, SpaceIpo *sipo, ARegion *ar)
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
@@ -902,22 +902,48 @@ void graph_draw_channel_names(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar)
UI_view2d_totRect_set(v2d, ar->winx, height);
/* loop through channels, and set up drawing depending on their type */
- y= (float)ACHANNEL_FIRST;
-
- for (ale= anim_data.first, i=0; ale; ale= ale->next, i++) {
- const float yminc= (float)(y - ACHANNEL_HEIGHT_HALF);
- const float ymaxc= (float)(y + ACHANNEL_HEIGHT_HALF);
+ { /* first pass: just the standard GL-drawing for backdrop + text */
+ y= (float)ACHANNEL_FIRST;
- /* check if visible */
- if ( IN_RANGE(yminc, v2d->cur.ymin, v2d->cur.ymax) ||
- IN_RANGE(ymaxc, v2d->cur.ymin, v2d->cur.ymax) )
- {
- /* draw all channels using standard channel-drawing API */
- ANIM_channel_draw(ac, ale, yminc, ymaxc);
+ for (ale= anim_data.first, i=0; ale; ale= ale->next, i++) {
+ const float yminc= (float)(y - ACHANNEL_HEIGHT_HALF);
+ const float ymaxc= (float)(y + ACHANNEL_HEIGHT_HALF);
+
+ /* check if visible */
+ if ( IN_RANGE(yminc, v2d->cur.ymin, v2d->cur.ymax) ||
+ IN_RANGE(ymaxc, v2d->cur.ymin, v2d->cur.ymax) )
+ {
+ /* draw all channels using standard channel-drawing API */
+ ANIM_channel_draw(ac, ale, yminc, ymaxc);
+ }
+
+ /* adjust y-position for next one */
+ y -= ACHANNEL_STEP;
+ }
+ }
+ { /* second pass: widgets */
+ uiBlock *block= uiBeginBlock(C, ar, "graph channel buttons", UI_EMBOSS);
+
+ y= (float)ACHANNEL_FIRST;
+
+ for (ale= anim_data.first, i=0; ale; ale= ale->next, i++) {
+ const float yminc= (float)(y - ACHANNEL_HEIGHT_HALF);
+ const float ymaxc= (float)(y + ACHANNEL_HEIGHT_HALF);
+
+ /* check if visible */
+ if ( IN_RANGE(yminc, v2d->cur.ymin, v2d->cur.ymax) ||
+ IN_RANGE(ymaxc, v2d->cur.ymin, v2d->cur.ymax) )
+ {
+ /* draw all channels using standard channel-drawing API */
+ ANIM_channel_draw_widgets(ac, ale, block, yminc, ymaxc);
+ }
+
+ /* adjust y-position for next one */
+ y -= ACHANNEL_STEP;
}
- /* adjust y-position for next one */
- y -= ACHANNEL_STEP;
+ uiEndBlock(C, block);
+ uiDrawBlock(C, block);
}
/* free tempolary channels */
diff --git a/source/blender/editors/space_graph/graph_intern.h b/source/blender/editors/space_graph/graph_intern.h
index 31f1c6d4301..2e8d0655d2d 100644
--- a/source/blender/editors/space_graph/graph_intern.h
+++ b/source/blender/editors/space_graph/graph_intern.h
@@ -48,7 +48,7 @@ struct ARegion *graph_has_buttons_region(struct ScrArea *sa);
/* ***************************************** */
/* graph_draw.c */
-void graph_draw_channel_names(struct bAnimContext *ac, struct SpaceIpo *sipo, struct ARegion *ar);
+void graph_draw_channel_names(struct bContext *C, struct bAnimContext *ac, struct SpaceIpo *sipo, struct ARegion *ar);
void graph_draw_curves(struct bAnimContext *ac, struct SpaceIpo *sipo, struct ARegion *ar, struct View2DGrid *grid, short sel);
void graph_draw_ghost_curves(struct bAnimContext *ac, struct SpaceIpo *sipo, struct ARegion *ar, struct View2DGrid *grid);
diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c
index 0390586951b..3717ccc8244 100644
--- a/source/blender/editors/space_graph/space_graph.c
+++ b/source/blender/editors/space_graph/space_graph.c
@@ -309,7 +309,7 @@ static void graph_channel_area_draw(const bContext *C, ARegion *ar)
/* draw channels */
if (ANIM_animdata_get_context(C, &ac)) {
- graph_draw_channel_names(&ac, sipo, ar);
+ graph_draw_channel_names((bContext*)C, &ac, sipo, ar);
}
/* reset view matrix */
diff --git a/source/blender/editors/space_nla/nla_channels.c b/source/blender/editors/space_nla/nla_channels.c
index ab918519ec0..063b329b7a1 100644
--- a/source/blender/editors/space_nla/nla_channels.c
+++ b/source/blender/editors/space_nla/nla_channels.c
@@ -89,6 +89,7 @@
* part of the channel is relevant.
*
* NOTE: eventually, this should probably be phased out when many of these things are replaced with buttons
+ * --> Most channels are now selection only...
*/
static int mouse_nla_channels (bAnimContext *ac, float x, int channel_index, short selectmode)
@@ -118,32 +119,17 @@ static int mouse_nla_channels (bAnimContext *ac, float x, int channel_index, sho
case ANIMTYPE_SCENE:
{
Scene *sce= (Scene *)ale->data;
- AnimData *adt= ale->data;
- if (x < 16) {
- /* toggle expand */
- sce->flag ^= SCE_DS_COLLAPSED;
-
- notifierFlags |= ND_ANIMCHAN_EDIT;
- }
- else if ( (adt) && (x >= (NLACHANNEL_NAMEWIDTH-NLACHANNEL_BUTTON_WIDTH)) ) {
- /* toggle mute */
- adt->flag ^= ADT_NLA_EVAL_OFF;
-
- notifierFlags |= ND_ANIMCHAN_EDIT;
+ /* set selection status */
+ if (selectmode == SELECT_INVERT) {
+ /* swap select */
+ sce->flag ^= SCE_DS_SELECTED;
}
else {
- /* set selection status */
- if (selectmode == SELECT_INVERT) {
- /* swap select */
- sce->flag ^= SCE_DS_SELECTED;
- }
- else {
- sce->flag |= SCE_DS_SELECTED;
- }
-
- notifierFlags |= ND_ANIMCHAN_SELECT;
+ sce->flag |= SCE_DS_SELECTED;
}
+
+ notifierFlags |= ND_ANIMCHAN_SELECT;
}
break;
case ANIMTYPE_OBJECT:
@@ -152,20 +138,8 @@ static int mouse_nla_channels (bAnimContext *ac, float x, int channel_index, sho
Scene *sce= (Scene *)ads->source;
Base *base= (Base *)ale->data;
Object *ob= base->object;
- AnimData *adt= ale->adt;
- if (x < 16) {
- /* toggle expand */
- ob->nlaflag ^= OB_ADS_COLLAPSED; // XXX
- notifierFlags |= ND_ANIMCHAN_EDIT;
- }
- else if ( (adt) && (x >= (NLACHANNEL_NAMEWIDTH-NLACHANNEL_BUTTON_WIDTH)) ) {
- /* toggle mute */
- adt->flag ^= ADT_NLA_EVAL_OFF;
-
- notifierFlags |= ND_ANIMCHAN_EDIT;
- }
- else if (nlaedit_is_tweakmode_on(ac) == 0) {
+ if (nlaedit_is_tweakmode_on(ac) == 0) {
/* set selection status */
if (selectmode == SELECT_INVERT) {
/* swap select */
@@ -194,149 +168,6 @@ static int mouse_nla_channels (bAnimContext *ac, float x, int channel_index, sho
}
}
break;
- case ANIMTYPE_FILLMATD:
- {
- Object *ob= (Object *)ale->data;
- ob->nlaflag ^= OB_ADS_SHOWMATS; // XXX
- notifierFlags |= ND_ANIMCHAN_EDIT;
- }
- break;
- case ANIMTYPE_FILLPARTD:
- {
- Object *ob= (Object *)ale->data;
- ob->nlaflag ^= OB_ADS_SHOWPARTS; // XXX
- notifierFlags |= ND_ANIMCHAN_EDIT;
- }
- break;
-
- case ANIMTYPE_DSMAT:
- {
- Material *ma= (Material *)ale->data;
- AnimData *adt= ale->adt;
-
- if ( (adt) && (x >= (NLACHANNEL_NAMEWIDTH-NLACHANNEL_BUTTON_WIDTH)) ) {
- /* toggle mute */
- adt->flag ^= ADT_NLA_EVAL_OFF;
- }
- else {
- /* toggle expand */
- ma->flag ^= MA_DS_EXPAND;
- }
- notifierFlags |= ND_ANIMCHAN_EDIT;
- }
- break;
- case ANIMTYPE_DSLAM:
- {
- Lamp *la= (Lamp *)ale->data;
- AnimData *adt= ale->adt;
-
- if ( (adt) && (x >= (NLACHANNEL_NAMEWIDTH-NLACHANNEL_BUTTON_WIDTH)) ) {
- /* toggle mute */
- adt->flag ^= ADT_NLA_EVAL_OFF;
- }
- else {
- /* toggle expand */
- la->flag ^= LA_DS_EXPAND;
- }
- notifierFlags |= ND_ANIMCHAN_EDIT;
- }
- break;
- case ANIMTYPE_DSCAM:
- {
- Camera *ca= (Camera *)ale->data;
- AnimData *adt= ale->adt;
-
- if ( (adt) && (x >= (NLACHANNEL_NAMEWIDTH-NLACHANNEL_BUTTON_WIDTH)) ) {
- /* toggle mute */
- adt->flag ^= ADT_NLA_EVAL_OFF;
- }
- else {
- /* toggle expand */
- ca->flag ^= CAM_DS_EXPAND;
- }
- notifierFlags |= ND_ANIMCHAN_EDIT;
- }
- break;
- case ANIMTYPE_DSCUR:
- {
- Curve *cu= (Curve *)ale->data;
- AnimData *adt= ale->adt;
-
- if ( (adt) && (x >= (NLACHANNEL_NAMEWIDTH-NLACHANNEL_BUTTON_WIDTH)) ) {
- /* toggle mute */
- adt->flag ^= ADT_NLA_EVAL_OFF;
- }
- else {
- /* toggle expand */
- cu->flag ^= CU_DS_EXPAND;
- }
- notifierFlags |= ND_ANIMCHAN_EDIT;
- }
- break;
- case ANIMTYPE_DSSKEY:
- {
- Key *key= (Key *)ale->data;
- AnimData *adt= ale->adt;
-
- if ( (adt) && (x >= (NLACHANNEL_NAMEWIDTH-NLACHANNEL_BUTTON_WIDTH)) ) {
- /* toggle mute */
- adt->flag ^= ADT_NLA_EVAL_OFF;
- }
- else {
- /* toggle expand */
- key->flag ^= KEYBLOCK_DS_EXPAND;
- }
- notifierFlags |= ND_ANIMCHAN_EDIT;
- }
- break;
- case ANIMTYPE_DSWOR:
- {
- World *wo= (World *)ale->data;
- AnimData *adt= ale->adt;
-
- if ( (adt) && (x >= (NLACHANNEL_NAMEWIDTH-NLACHANNEL_BUTTON_WIDTH)) ) {
- /* toggle mute */
- adt->flag ^= ADT_NLA_EVAL_OFF;
- }
- else {
- /* toggle expand */
- wo->flag ^= WO_DS_EXPAND;
- }
- notifierFlags |= ND_ANIMCHAN_EDIT;
- }
- break;
- case ANIMTYPE_DSPART:
- {
- ParticleSettings *part= (ParticleSettings *)ale->data;
- AnimData *adt= ale->adt;
-
- if ( (adt) && (x >= (NLACHANNEL_NAMEWIDTH-NLACHANNEL_BUTTON_WIDTH)) ) {
- /* toggle mute */
- adt->flag ^= ADT_NLA_EVAL_OFF;
- }
- else {
- /* toggle expand */
- part->flag ^= PART_DS_EXPAND;
- }
- notifierFlags |= ND_ANIMCHAN_EDIT;
- }
- break;
- case ANIMTYPE_DSMBALL:
- {
- MetaBall *mb= (MetaBall *)ale->data;
- AnimData *adt= ale->adt;
-
- if ( (adt) && (x >= (NLACHANNEL_NAMEWIDTH-NLACHANNEL_BUTTON_WIDTH)) ) {
- /* toggle mute */
- adt->flag ^= ADT_NLA_EVAL_OFF;
- }
- else {
- /* toggle expand */
- mb->flag2 ^= MB_DS_EXPAND;
- }
- notifierFlags |= ND_ANIMCHAN_EDIT;
- }
- break;
case ANIMTYPE_NLATRACK:
{
diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c
index a4265af71d9..931775f1a6e 100644
--- a/source/blender/editors/space_nla/nla_draw.c
+++ b/source/blender/editors/space_nla/nla_draw.c
@@ -592,36 +592,15 @@ void draw_nla_main_data (bAnimContext *ac, SpaceNla *snla, ARegion *ar)
/* *********************************************** */
/* Channel List */
-void draw_nla_channel_list (bAnimContext *ac, SpaceNla *snla, ARegion *ar)
+/* old code for drawing NLA channels using GL only */
+// TODO: depreceate this code...
+static void draw_nla_channel_list_gl (bAnimContext *ac, ListBase *anim_data, View2D *v2d, float y)
{
- ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
- int filter;
-
- View2D *v2d= &ar->v2d;
- float x= 0.0f, y= 0.0f;
- int items, height;
-
- /* build list of channels to draw */
- filter= (ANIMFILTER_VISIBLE|ANIMFILTER_CHANNELS);
- items= ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
-
- /* Update max-extent of channels here (taking into account scrollers):
- * - this is done to allow the channel list to be scrollable, but must be done here
- * to avoid regenerating the list again and/or also because channels list is drawn first
- * - offset of NLACHANNEL_HEIGHT*2 is added to the height of the channels, as first is for
- * start of list offset, and the second is as a correction for the scrollers.
- */
- height= ((items*NLACHANNEL_STEP) + (NLACHANNEL_HEIGHT*2));
- /* 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);
+ float x = 0.0f;
/* loop through channels, and set up drawing depending on their type */
- y= (float)(-NLACHANNEL_HEIGHT);
-
- for (ale= anim_data.first; ale; ale= ale->next) {
+ for (ale= anim_data->first; ale; ale= ale->next) {
const float yminc= (float)(y - NLACHANNEL_HEIGHT_HALF);
const float ymaxc= (float)(y + NLACHANNEL_HEIGHT_HALF);
const float ydatac= (float)(y - 7);
@@ -716,6 +695,7 @@ void draw_nla_channel_list (bAnimContext *ac, SpaceNla *snla, ARegion *ar)
break;
default: /* handled by standard channel-drawing API */
+ // draw backdrops only...
ANIM_channel_draw(ac, ale, yminc, ymaxc);
break;
}
@@ -856,6 +836,66 @@ void draw_nla_channel_list (bAnimContext *ac, SpaceNla *snla, ARegion *ar)
/* adjust y-position for next one */
y -= NLACHANNEL_STEP;
}
+}
+
+void draw_nla_channel_list (bContext *C, bAnimContext *ac, SpaceNla *snla, ARegion *ar)
+{
+ ListBase anim_data = {NULL, NULL};
+ bAnimListElem *ale;
+ int filter;
+
+ View2D *v2d= &ar->v2d;
+ float x= 0.0f, y= 0.0f;
+ int items, height;
+
+ /* build list of channels to draw */
+ filter= (ANIMFILTER_VISIBLE|ANIMFILTER_CHANNELS);
+ items= ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
+
+ /* Update max-extent of channels here (taking into account scrollers):
+ * - this is done to allow the channel list to be scrollable, but must be done here
+ * to avoid regenerating the list again and/or also because channels list is drawn first
+ * - offset of NLACHANNEL_HEIGHT*2 is added to the height of the channels, as first is for
+ * start of list offset, and the second is as a correction for the scrollers.
+ */
+ height= ((items*NLACHANNEL_STEP) + (NLACHANNEL_HEIGHT*2));
+ /* 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);
+
+ /* draw channels */
+ { /* first pass: backdrops + oldstyle drawing */
+ y= (float)(-NLACHANNEL_HEIGHT);
+
+ draw_nla_channel_list_gl(ac, &anim_data, v2d, y);
+ }
+ { /* second pass: UI widgets */
+ uiBlock *block= uiBeginBlock(C, ar, "NLA channel buttons", UI_EMBOSS);
+
+ y= (float)(-NLACHANNEL_HEIGHT);
+
+ /* loop through channels, and set up drawing depending on their type */
+ for (ale= anim_data.first; ale; ale= ale->next) {
+ const float yminc= (float)(y - NLACHANNEL_HEIGHT_HALF);
+ const float ymaxc= (float)(y + NLACHANNEL_HEIGHT_HALF);
+ const float ydatac= (float)(y - 7);
+
+ /* check if visible */
+ if ( IN_RANGE(yminc, v2d->cur.ymin, v2d->cur.ymax) ||
+ IN_RANGE(ymaxc, v2d->cur.ymin, v2d->cur.ymax) )
+ {
+ /* draw all channels using standard channel-drawing API */
+ ANIM_channel_draw_widgets(ac, ale, block, yminc, ymaxc);
+ }
+
+ /* adjust y-position for next one */
+ y -= NLACHANNEL_STEP;
+ }
+
+ uiEndBlock(C, block);
+ uiDrawBlock(C, block);
+ }
/* free tempolary channels */
BLI_freelistN(&anim_data);
diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c
index d476852ef2d..763f4116416 100644
--- a/source/blender/editors/space_nla/nla_edit.c
+++ b/source/blender/editors/space_nla/nla_edit.c
@@ -919,6 +919,58 @@ void NLA_OT_split (wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
+/* ******************** Bake Strips Operator ***************************** */
+/* Bakes the NLA Strips for the active AnimData blocks */
+
+static int nlaedit_bake_exec (bContext *C, wmOperator *op)
+{
+ bAnimContext ac;
+
+ ListBase anim_data = {NULL, NULL};
+ bAnimListElem *ale;
+ int filter;
+
+ /* get editor data */
+ if (ANIM_animdata_get_context(C, &ac) == 0)
+ return OPERATOR_CANCELLED;
+
+ /* get a list of the editable tracks being shown in the NLA */
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_ANIMDATA | ANIMFILTER_FOREDIT);
+ ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
+
+ /* for each AnimData block, bake strips to animdata... */
+ for (ale= anim_data.first; ale; ale= ale->next) {
+ // FIXME
+ }
+
+ /* free temp data */
+ BLI_freelistN(&anim_data);
+
+ /* refresh auto strip properties */
+ ED_nla_postop_refresh(&ac);
+
+ /* set notifier that things have changed */
+ WM_event_add_notifier(C, NC_ANIMATION|ND_NLA_EDIT, NULL);
+
+ /* done */
+ return OPERATOR_FINISHED;
+}
+
+void NLA_OT_bake (wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Bake Strips";
+ ot->idname= "NLA_OT_bake";
+ ot->description= "Bake all strips of selected AnimData blocks.";
+
+ /* api callbacks */
+ ot->exec= nlaedit_bake_exec;
+ ot->poll= nlaop_poll_tweakmode_off;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+}
+
/* *********************************************** */
/* NLA Editing Operations (Modifying) */
diff --git a/source/blender/editors/space_nla/nla_intern.h b/source/blender/editors/space_nla/nla_intern.h
index 7cc09707ba7..e4557ec878f 100644
--- a/source/blender/editors/space_nla/nla_intern.h
+++ b/source/blender/editors/space_nla/nla_intern.h
@@ -45,7 +45,7 @@ void NLA_OT_properties(wmOperatorType *ot);
/* nla_draw.c */
void draw_nla_main_data(bAnimContext *ac, SpaceNla *snla, ARegion *ar);
-void draw_nla_channel_list(bAnimContext *ac, SpaceNla *snla, ARegion *ar);
+void draw_nla_channel_list(bContext *C, bAnimContext *ac, SpaceNla *snla, ARegion *ar);
/* **************************************** */
/* nla_header.c */
diff --git a/source/blender/editors/space_nla/space_nla.c b/source/blender/editors/space_nla/space_nla.c
index 6f377aabd4e..c4f929274c7 100644
--- a/source/blender/editors/space_nla/space_nla.c
+++ b/source/blender/editors/space_nla/space_nla.c
@@ -238,7 +238,7 @@ static void nla_channel_area_draw(const bContext *C, ARegion *ar)
/* data */
if (ANIM_animdata_get_context(C, &ac)) {
- draw_nla_channel_list(&ac, snla, ar);
+ draw_nla_channel_list((bContext *)C, &ac, snla, ar);
}
/* reset view matrix */