Revision: 20802
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=20802
Author: aligorith
Date: 2009-06-11 07:02:46 +0200 (Thu, 11 Jun 2009)
Log Message:
-----------
NLA SoC: Channel ordering change
In response to user-feedback, I've changed the order in which channels appear.
Now, the channel ordering is:
- Object/AnimData block
-- Active Action
-- Last NLA Track
..
..
-- First NLA Track
It is important to note several things still:
1) Active action is applied AFTER the NLA Tracks have been evaluated, not before
2) In this new order, the tracks+active action are shown in the
evaluation-stack order, i.e. first thing applied is at the bottom, last is at
the top.
As a result, I've switched the view-orientation back so that it works the same
way as for DopeSheet/Graph editors (i.e. expands downwards not upwards). This
may cause problems loading files saved with older builds of this branch. There
are still some lingering problems due to this change which I'll fix in due
course.
Modified Paths:
--------------
branches/soc-2009-aligorith/source/blender/editors/animation/anim_channels.c
branches/soc-2009-aligorith/source/blender/editors/animation/anim_filter.c
branches/soc-2009-aligorith/source/blender/editors/space_nla/nla_buttons.c
branches/soc-2009-aligorith/source/blender/editors/space_nla/nla_channels.c
branches/soc-2009-aligorith/source/blender/editors/space_nla/nla_draw.c
branches/soc-2009-aligorith/source/blender/editors/space_nla/nla_intern.h
branches/soc-2009-aligorith/source/blender/editors/space_nla/nla_ops.c
branches/soc-2009-aligorith/source/blender/editors/space_nla/nla_select.c
branches/soc-2009-aligorith/source/blender/editors/space_nla/space_nla.c
Modified:
branches/soc-2009-aligorith/source/blender/editors/animation/anim_channels.c
===================================================================
---
branches/soc-2009-aligorith/source/blender/editors/animation/anim_channels.c
2009-06-11 03:19:08 UTC (rev 20801)
+++
branches/soc-2009-aligorith/source/blender/editors/animation/anim_channels.c
2009-06-11 05:02:46 UTC (rev 20802)
@@ -1216,6 +1216,14 @@
ACHANNEL_SET_FLAG(gpl, selectmode,
GP_LAYER_SELECT);
}
break;
+
+ case ANIMTYPE_NLATRACK: /* nla-track */
+ {
+ NlaTrack *nlt= (NlaTrack *)ale->data;
+
+ ACHANNEL_SET_FLAG(nlt, selectmode,
NLATRACK_SELECTED);
+ }
+ break;
}
}
Modified:
branches/soc-2009-aligorith/source/blender/editors/animation/anim_filter.c
===================================================================
--- branches/soc-2009-aligorith/source/blender/editors/animation/anim_filter.c
2009-06-11 03:19:08 UTC (rev 20801)
+++ branches/soc-2009-aligorith/source/blender/editors/animation/anim_filter.c
2009-06-11 05:02:46 UTC (rev 20802)
@@ -717,36 +717,21 @@
return items;
}
+/* Include NLA-Data for NLA-Editor:
+ * - when ANIMFILTER_CHANNELS is used, that means we should be filtering
the list for display
+ * Although the evaluation order is from the first track to the last and
then apply the Action on top,
+ * we present this in the UI as the Active Action followed by the last
track to the first so that we
+ * get the evaluation order presented as per a stack.
+ * - for normal filtering (i.e. for editing), we only need the NLA-tracks
but they can be in 'normal' evaluation
+ * order, i.e. first to last. Otherwise, some tools may get screwed up.
+ */
static int animdata_filter_nla (ListBase *anim_data, AnimData *adt, int
filter_mode, void *owner, short ownertype, ID *owner_id)
{
bAnimListElem *ale;
NlaTrack *nlt;
+ NlaTrack *first=NULL, *next=NULL;
int items = 0;
- /* loop over NLA Tracks - assume that the caller of this has already
checked that these should be included */
- for (nlt= adt->nla_tracks.first; nlt; nlt= nlt->next) {
- /* only work with this channel and its subchannels if it is
editable */
- if (!(filter_mode & ANIMFILTER_FOREDIT) || EDITABLE_NLT(nlt)) {
- /* only include this track if selected in a way
consistent with the filtering requirements */
- if ( ANIMCHANNEL_SELOK(SEL_NLT(nlt)) ) {
- /* only include if this track is active */
- if (!(filter_mode & ANIMFILTER_ACTIVE) ||
(nlt->flag & NLATRACK_ACTIVE)) {
- ale= make_new_animlistelem(nlt,
ANIMTYPE_NLATRACK, owner, ownertype, owner_id);
-
- if (ale) {
- BLI_addtail(anim_data, ale);
- items++;
- }
- }
-
- /* if we're in NLA-tweakmode, if this track was
active, that means that it was the last active one */
- // FIXME: the channels after should still get
drawn, just 'differently', and after an active-action channel
- if ((adt->flag & ADT_NLA_EDIT_ON) && (nlt->flag
& NLATRACK_ACTIVE))
- break;
- }
- }
- }
-
/* if showing channels, include active action */
if (filter_mode & ANIMFILTER_CHANNELS) {
/* there isn't really anything editable here, so skip if need
editable */
@@ -764,8 +749,47 @@
items++;
}
}
+
+ /* first track to include will be the last one if we're
filtering by channels */
+ first= adt->nla_tracks.last;
}
+ else {
+ /* first track to include will the the first one (as per
normal) */
+ first= adt->nla_tracks.first;
+ }
+ /* loop over NLA Tracks - assume that the caller of this has already
checked that these should be included */
+ for (nlt= first; nlt; nlt= next) {
+ /* 'next' NLA-Track to use depends on whether we're filtering
for drawing or not */
+ if (filter_mode & ANIMFILTER_CHANNELS)
+ next= nlt->prev;
+ else
+ next= nlt->next;
+
+ /* if we're in NLA-tweakmode, don't show this track if it was
disabled (due to tweaking) for now
+ * - active track should still get shown though (even
though it has disabled flag set)
+ */
+ // FIXME: the channels after should still get drawn, just
'differently', and after an active-action channel
+ if ((adt->flag & ADT_NLA_EDIT_ON) && (nlt->flag &
NLATRACK_DISABLED) && !(nlt->flag & NLATRACK_ACTIVE))
+ continue;
+
+ /* only work with this channel and its subchannels if it is
editable */
+ if (!(filter_mode & ANIMFILTER_FOREDIT) || EDITABLE_NLT(nlt)) {
+ /* only include this track if selected in a way
consistent with the filtering requirements */
+ if ( ANIMCHANNEL_SELOK(SEL_NLT(nlt)) ) {
+ /* only include if this track is active */
+ if (!(filter_mode & ANIMFILTER_ACTIVE) ||
(nlt->flag & NLATRACK_ACTIVE)) {
+ ale= make_new_animlistelem(nlt,
ANIMTYPE_NLATRACK, owner, ownertype, owner_id);
+
+ if (ale) {
+ BLI_addtail(anim_data, ale);
+ items++;
+ }
+ }
+ }
+ }
+ }
+
/* return the number of items added to the list */
return items;
}
Modified:
branches/soc-2009-aligorith/source/blender/editors/space_nla/nla_buttons.c
===================================================================
--- branches/soc-2009-aligorith/source/blender/editors/space_nla/nla_buttons.c
2009-06-11 03:19:08 UTC (rev 20801)
+++ branches/soc-2009-aligorith/source/blender/editors/space_nla/nla_buttons.c
2009-06-11 05:02:46 UTC (rev 20802)
@@ -141,7 +141,7 @@
/* free temp data */
BLI_freelistN(&anim_data);
- return 1;
+ return found;
}
static int nla_panel_poll(const bContext *C, PanelType *pt)
Modified:
branches/soc-2009-aligorith/source/blender/editors/space_nla/nla_channels.c
===================================================================
--- branches/soc-2009-aligorith/source/blender/editors/space_nla/nla_channels.c
2009-06-11 03:19:08 UTC (rev 20801)
+++ branches/soc-2009-aligorith/source/blender/editors/space_nla/nla_channels.c
2009-06-11 05:02:46 UTC (rev 20802)
@@ -82,116 +82,6 @@
/* *********************************************** */
/* Operators for NLA channels-list which need to be different from the
standard Animation Editor ones */
-/* ******************** Borderselect Operator *********************** */
-
-static void borderselect_nla_channels (bAnimContext *ac, rcti *rect, short
selectmode)
-{
- ListBase anim_data = {NULL, NULL};
- bAnimListElem *ale;
- int filter;
-
- View2D *v2d= &ac->ar->v2d;
- rctf rectf;
- float ymin=(float)(-NLACHANNEL_HEIGHT), ymax=0;
-
- /* convert border-region to view coordinates */
- UI_view2d_region_to_view(v2d, rect->xmin, rect->ymin+2, &rectf.xmin,
&rectf.ymin);
- UI_view2d_region_to_view(v2d, rect->xmax, rect->ymax-2, &rectf.xmax,
&rectf.ymax);
-
- /* filter data */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CHANNELS);
- ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
-
- /* loop over data, doing border select */
- for (ale= anim_data.first; ale; ale= ale->next) {
- ymax= ymin + NLACHANNEL_STEP;
-
- /* if channel is within border-select region, alter it */
- if (!((ymax < rectf.ymin) || (ymin > rectf.ymax))) {
- /* only the following types can be selected */
- switch (ale->type) {
- case ANIMTYPE_OBJECT: /* object */
- {
- Base *base= (Base *)ale->data;
- Object *ob= base->object;
-
- ACHANNEL_SET_FLAG(base, selectmode,
SELECT);
- ACHANNEL_SET_FLAG(ob, selectmode,
SELECT);
- }
- break;
- case ANIMTYPE_NLATRACK: /* nla-track */
- {
- NlaTrack *nlt= (NlaTrack *)ale->data;
-
- ACHANNEL_SET_FLAG(nlt, selectmode,
NLATRACK_SELECTED);
- }
- break;
- }
- }
-
- /* set maximum extent to be the minimum of the next channel */
- ymin= ymax;
- }
-
- /* cleanup */
- BLI_freelistN(&anim_data);
-}
-
-/* ------------------- */
-
-static int nlachannels_borderselect_exec(bContext *C, wmOperator *op)
-{
- bAnimContext ac;
- rcti rect;
- short selectmode=0;
- int event;
-
- /* get editor data */
- if (ANIM_animdata_get_context(C, &ac) == 0)
- return OPERATOR_CANCELLED;
-
- /* get settings from operator */
- rect.xmin= RNA_int_get(op->ptr, "xmin");
- rect.ymin= RNA_int_get(op->ptr, "ymin");
- rect.xmax= RNA_int_get(op->ptr, "xmax");
- rect.ymax= RNA_int_get(op->ptr, "ymax");
-
- event= RNA_int_get(op->ptr, "event_type");
- if (event == LEFTMOUSE) // FIXME... hardcoded
- selectmode = ACHANNEL_SETFLAG_ADD;
- else
- selectmode = ACHANNEL_SETFLAG_CLEAR;
-
- /* apply borderselect animation channels */
- borderselect_nla_channels(&ac, &rect, selectmode);
-
- return OPERATOR_FINISHED;
-}
-
-void NLA_OT_channels_select_border(wmOperatorType *ot)
-{
- /* identifiers */
- ot->name= "Border Select";
- ot->idname= "NLA_OT_channels_select_border";
-
- /* api callbacks */
- ot->invoke= WM_border_select_invoke;
- ot->exec= nlachannels_borderselect_exec;
- ot->modal= WM_border_select_modal;
-
- ot->poll= nlaop_poll_tweakmode_off;
-
- /* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-
- /* rna */
- RNA_def_int(ot->srna, "event_type", 0, INT_MIN, INT_MAX, "Event Type",
"", INT_MIN, INT_MAX);
- RNA_def_int(ot->srna, "xmin", 0, INT_MIN, INT_MAX, "X Min", "",
INT_MIN, INT_MAX);
- RNA_def_int(ot->srna, "xmax", 0, INT_MIN, INT_MAX, "X Max", "",
INT_MIN, INT_MAX);
- RNA_def_int(ot->srna, "ymin", 0, INT_MIN, INT_MAX, "Y Min", "",
INT_MIN, INT_MAX);
- RNA_def_int(ot->srna, "ymax", 0, INT_MIN, INT_MAX, "Y Max", "",
INT_MIN, INT_MAX);
-}
-
/* ******************** Mouse-Click Operator *********************** */
/* Depending on the channel that was clicked on, the mouse click will activate
whichever
* part of the channel is relevant.
@@ -425,7 +315,7 @@
selectmode= SELECT_REPLACE;
/* figure out which channel user clicked in
- * Note: although channels technically start at y= ACHANNEL_FIRST, we
need to adjust by half a channel's height
+ * Note: although channels technically start at y= NLACHANNEL_FIRST, we
need to adjust by half a channel's height
* so that the tops of channels get caught ok. Since
NLACHANNEL_FIRST is really NLACHANNEL_HEIGHT, we simply use
* NLACHANNEL_HEIGHT_HALF.
*/
Modified:
branches/soc-2009-aligorith/source/blender/editors/space_nla/nla_draw.c
===================================================================
--- branches/soc-2009-aligorith/source/blender/editors/space_nla/nla_draw.c
2009-06-11 03:19:08 UTC (rev 20801)
+++ branches/soc-2009-aligorith/source/blender/editors/space_nla/nla_draw.c
2009-06-11 05:02:46 UTC (rev 20802)
@@ -250,15 +250,13 @@
* start of list offset, and the second is as a correction for
the scrollers.
@@ Diff output truncated at 10240 characters. @@
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs