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
path: root/source
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2009-06-11 09:02:46 +0400
committerJoshua Leung <aligorith@gmail.com>2009-06-11 09:02:46 +0400
commit0bef8012bc71b1a1d3fae4f5ef82055045ef4752 (patch)
tree9e6b9be66a206d7812524b89f758768e51ee49e3 /source
parentf0f9034966be8692250686aee74048294960aad3 (diff)
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.
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/animation/anim_channels.c8
-rw-r--r--source/blender/editors/animation/anim_filter.c72
-rw-r--r--source/blender/editors/space_nla/nla_buttons.c2
-rw-r--r--source/blender/editors/space_nla/nla_channels.c112
-rw-r--r--source/blender/editors/space_nla/nla_draw.c46
-rw-r--r--source/blender/editors/space_nla/nla_intern.h1
-rw-r--r--source/blender/editors/space_nla/nla_ops.c8
-rw-r--r--source/blender/editors/space_nla/nla_select.c8
-rw-r--r--source/blender/editors/space_nla/space_nla.c45
9 files changed, 108 insertions, 194 deletions
diff --git a/source/blender/editors/animation/anim_channels.c b/source/blender/editors/animation/anim_channels.c
index 59fb56f3c35..2944c9519b9 100644
--- a/source/blender/editors/animation/anim_channels.c
+++ b/source/blender/editors/animation/anim_channels.c
@@ -1216,6 +1216,14 @@ static void borderselect_anim_channels (bAnimContext *ac, rcti *rect, short sele
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;
}
}
diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c
index 6cb24a01711..b47211f35d1 100644
--- a/source/blender/editors/animation/anim_filter.c
+++ b/source/blender/editors/animation/anim_filter.c
@@ -717,36 +717,21 @@ static int animdata_filter_action (ListBase *anim_data, bAction *act, int filter
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,6 +749,45 @@ static int animdata_filter_nla (ListBase *anim_data, AnimData *adt, int filter_m
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 */
diff --git a/source/blender/editors/space_nla/nla_buttons.c b/source/blender/editors/space_nla/nla_buttons.c
index 80982d9feb5..cb21dd66934 100644
--- a/source/blender/editors/space_nla/nla_buttons.c
+++ b/source/blender/editors/space_nla/nla_buttons.c
@@ -141,7 +141,7 @@ static int nla_panel_context(const bContext *C, PointerRNA *nlt_ptr, PointerRNA
/* free temp data */
BLI_freelistN(&anim_data);
- return 1;
+ return found;
}
static int nla_panel_poll(const bContext *C, PanelType *pt)
diff --git a/source/blender/editors/space_nla/nla_channels.c b/source/blender/editors/space_nla/nla_channels.c
index 992c5bfa756..f928daa523b 100644
--- a/source/blender/editors/space_nla/nla_channels.c
+++ b/source/blender/editors/space_nla/nla_channels.c
@@ -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 @@ static int nlachannels_mouseclick_invoke(bContext *C, wmOperator *op, wmEvent *e
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.
*/
diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c
index 4fa27f4bc11..8d417a150aa 100644
--- a/source/blender/editors/space_nla/nla_draw.c
+++ b/source/blender/editors/space_nla/nla_draw.c
@@ -250,15 +250,13 @@ void draw_nla_main_data (bAnimContext *ac, SpaceNla *snla, ARegion *ar)
* start of list offset, and the second is as a correction for the scrollers.
*/
height= ((items*NLACHANNEL_STEP) + (NLACHANNEL_HEIGHT*2));
- 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.ymax= (float)(height);
- }
+ /* 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);
/* loop through channels, and set up drawing depending on their type */
- y= (float)(-NLACHANNEL_FIRST);
+ y= (float)(-NLACHANNEL_HEIGHT);
for (ale= anim_data.first; ale; ale= ale->next) {
const float yminc= (float)(y - NLACHANNEL_HEIGHT_HALF);
@@ -330,7 +328,7 @@ void draw_nla_main_data (bAnimContext *ac, SpaceNla *snla, ARegion *ar)
}
/* adjust y-position for next one */
- y += NLACHANNEL_STEP;
+ y -= NLACHANNEL_STEP;
}
/* free tempolary channels */
@@ -361,15 +359,13 @@ void draw_nla_channel_list (bAnimContext *ac, SpaceNla *snla, ARegion *ar)
* start of list offset, and the second is as a correction for the scrollers.
*/
height= ((items*NLACHANNEL_STEP) + (NLACHANNEL_HEIGHT*2));
- 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.ymax= (float)(height);
- }
+ /* 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);
/* loop through channels, and set up drawing depending on their type */
- y= (float)(-NLACHANNEL_FIRST);
+ y= (float)(-NLACHANNEL_HEIGHT);
for (ale= anim_data.first; ale; ale= ale->next) {
const float yminc= (float)(y - NLACHANNEL_HEIGHT_HALF);
@@ -397,7 +393,7 @@ void draw_nla_channel_list (bAnimContext *ac, SpaceNla *snla, ARegion *ar)
/* only show expand if there are any channels */
if (EXPANDED_SCEC(sce))
- expand= ICON_TRIA_UP;
+ expand= ICON_TRIA_DOWN;
else
expand= ICON_TRIA_RIGHT;
@@ -421,7 +417,7 @@ void draw_nla_channel_list (bAnimContext *ac, SpaceNla *snla, ARegion *ar)
/* only show expand if there are any channels */
if (EXPANDED_OBJC(ob))
- expand= ICON_TRIA_UP;
+ expand= ICON_TRIA_DOWN;
else
expand= ICON_TRIA_RIGHT;
@@ -438,7 +434,7 @@ void draw_nla_channel_list (bAnimContext *ac, SpaceNla *snla, ARegion *ar)
special = ICON_MATERIAL_DATA;
if (FILTER_MAT_OBJC(ob))
- expand = ICON_TRIA_UP;
+ expand = ICON_TRIA_DOWN;
else
expand = ICON_TRIA_RIGHT;
@@ -457,7 +453,7 @@ void draw_nla_channel_list (bAnimContext *ac, SpaceNla *snla, ARegion *ar)
offset = 21;
if (FILTER_MAT_OBJD(ma))
- expand = ICON_TRIA_UP;
+ expand = ICON_TRIA_DOWN;
else
expand = ICON_TRIA_RIGHT;
@@ -473,7 +469,7 @@ void draw_nla_channel_list (bAnimContext *ac, SpaceNla *snla, ARegion *ar)
special = ICON_LAMP_DATA;
if (FILTER_LAM_OBJD(la))
- expand = ICON_TRIA_UP;
+ expand = ICON_TRIA_DOWN;
else
expand = ICON_TRIA_RIGHT;
@@ -489,7 +485,7 @@ void draw_nla_channel_list (bAnimContext *ac, SpaceNla *snla, ARegion *ar)
special = ICON_CAMERA_DATA;
if (FILTER_CAM_OBJD(ca))
- expand = ICON_TRIA_UP;
+ expand = ICON_TRIA_DOWN;
else
expand = ICON_TRIA_RIGHT;
@@ -505,7 +501,7 @@ void draw_nla_channel_list (bAnimContext *ac, SpaceNla *snla, ARegion *ar)
special = ICON_CURVE_DATA;
if (FILTER_CUR_OBJD(cu))
- expand = ICON_TRIA_UP;
+ expand = ICON_TRIA_DOWN;
else
expand = ICON_TRIA_RIGHT;
@@ -521,7 +517,7 @@ void draw_nla_channel_list (bAnimContext *ac, SpaceNla *snla, ARegion *ar)
special = ICON_SHAPEKEY_DATA; // XXX
if (FILTER_SKE_OBJD(key))
- expand = ICON_TRIA_UP;
+ expand = ICON_TRIA_DOWN;
else
expand = ICON_TRIA_RIGHT;
@@ -629,7 +625,7 @@ void draw_nla_channel_list (bAnimContext *ac, SpaceNla *snla, ARegion *ar)
if (ELEM(ale->type, ANIMTYPE_SCENE, ANIMTYPE_OBJECT)) {
/* object channel - darker */
UI_ThemeColor(TH_DOPESHEET_CHANNELOB);
- uiSetRoundBox((expand == ICON_TRIA_UP)? (8):(1|8));
+ uiSetRoundBox((expand == ICON_TRIA_DOWN)? (8):(1|8));
gl_round_box(GL_POLYGON, x+offset, yminc, (float)NLACHANNEL_NAMEWIDTH, ymaxc, 10);
}
else {
@@ -763,7 +759,7 @@ void draw_nla_channel_list (bAnimContext *ac, SpaceNla *snla, ARegion *ar)
}
/* adjust y-position for next one */
- y += NLACHANNEL_STEP;
+ y -= NLACHANNEL_STEP;
}
/* free tempolary channels */
diff --git a/source/blender/editors/space_nla/nla_intern.h b/source/blender/editors/space_nla/nla_intern.h
index b0a9ba5b182..5c6670cfd6f 100644
--- a/source/blender/editors/space_nla/nla_intern.h
+++ b/source/blender/editors/space_nla/nla_intern.h
@@ -99,7 +99,6 @@ void NLAEDIT_OT_split(wmOperatorType *ot);
/* **************************************** */
/* nla_channels.c */
-void NLA_OT_channels_select_border(wmOperatorType *ot);
void NLA_OT_channels_click(wmOperatorType *ot);
void NLA_OT_add_tracks(wmOperatorType *ot);
diff --git a/source/blender/editors/space_nla/nla_ops.c b/source/blender/editors/space_nla/nla_ops.c
index 6cba19bb2cf..981ef9a4f87 100644
--- a/source/blender/editors/space_nla/nla_ops.c
+++ b/source/blender/editors/space_nla/nla_ops.c
@@ -122,7 +122,6 @@ void nla_operatortypes(void)
/* channels */
WM_operatortype_append(NLA_OT_channels_click);
- WM_operatortype_append(NLA_OT_channels_select_border);
WM_operatortype_append(NLA_OT_add_tracks);
@@ -150,15 +149,16 @@ static void nla_keymap_channels (wmWindowManager *wm, ListBase *keymap)
WM_keymap_add_item(keymap, "NLA_OT_channels_click", LEFTMOUSE, KM_PRESS, 0, 0);
RNA_boolean_set(WM_keymap_add_item(keymap, "NLA_OT_channels_click", LEFTMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "extend", 1);
- /* borderselect */
- WM_keymap_add_item(keymap, "NLA_OT_channels_select_border", BKEY, KM_PRESS, 0, 0);
-
/* channel operations */
/* add tracks */
WM_keymap_add_item(keymap, "NLA_OT_add_tracks", AKEY, KM_PRESS, KM_SHIFT, 0);
RNA_boolean_set(WM_keymap_add_item(keymap, "NLA_OT_add_tracks", AKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0)->ptr, "above_selected", 1);
/* General Animation Channels keymap (see anim_channels.c) ----------------------- */
+ /* selection */
+ /* borderselect */
+ WM_keymap_add_item(keymap, "ANIM_OT_channels_select_border", BKEY, KM_PRESS, 0, 0);
+
/* deselect all */
WM_keymap_add_item(keymap, "ANIM_OT_channels_select_all_toggle", AKEY, KM_PRESS, 0, 0);
RNA_boolean_set(WM_keymap_add_item(keymap, "ANIM_OT_channels_select_all_toggle", IKEY, KM_PRESS, KM_CTRL, 0)->ptr, "invert", 1);
diff --git a/source/blender/editors/space_nla/nla_select.c b/source/blender/editors/space_nla/nla_select.c
index 25a876d44f4..b850ec76f82 100644
--- a/source/blender/editors/space_nla/nla_select.c
+++ b/source/blender/editors/space_nla/nla_select.c
@@ -247,7 +247,7 @@ static void borderselect_nla_strips (bAnimContext *ac, rcti rect, short mode, sh
/* loop over data, doing border select */
for (ale= anim_data.first; ale; ale= ale->next) {
- ymax= ymin + NLACHANNEL_STEP;
+ ymin= ymax - NLACHANNEL_STEP;
/* perform vertical suitability check (if applicable) */
if ( (mode == NLA_BORDERSEL_FRAMERANGE) ||
@@ -273,8 +273,8 @@ static void borderselect_nla_strips (bAnimContext *ac, rcti rect, short mode, sh
}
}
- /* set maximum extent to be the minimum of the next channel */
- ymin= ymax;
+ /* set minimum extent to be the maximum of the next channel */
+ ymax= ymin;
}
/* cleanup */
@@ -390,7 +390,7 @@ static void mouse_nla_strips (bAnimContext *ac, int mval[2], short select_mode)
/* use View2D to determine the index of the channel (i.e a row in the list) where keyframe was */
UI_view2d_region_to_view(v2d, mval[0], mval[1], &x, &y);
- UI_view2d_listview_view_to_cell(v2d, 0, NLACHANNEL_STEP, 0, 0, x, y, NULL, &channel_index);
+ UI_view2d_listview_view_to_cell(v2d, 0, NLACHANNEL_STEP, 0, (float)NLACHANNEL_HEIGHT_HALF, x, y, NULL, &channel_index);
/* x-range to check is +/- 7 (in screen/region-space) on either side of mouse click
* (that is the size of keyframe icons, so user should be expecting similar tolerances)
diff --git a/source/blender/editors/space_nla/space_nla.c b/source/blender/editors/space_nla/space_nla.c
index 5490f40eb03..a7e9844726d 100644
--- a/source/blender/editors/space_nla/space_nla.c
+++ b/source/blender/editors/space_nla/space_nla.c
@@ -103,6 +103,7 @@ ARegion *nla_has_buttons_region(ScrArea *sa)
static SpaceLink *nla_new(const bContext *C)
{
+ Scene *scene= CTX_data_scene(C);
ARegion *ar;
SpaceNla *snla;
@@ -132,45 +133,41 @@ static SpaceLink *nla_new(const bContext *C)
ar->v2d.scroll = V2D_SCROLL_BOTTOM;
ar->v2d.flag = V2D_VIEWSYNC_AREA_VERTICAL;
+ /* ui buttons */
+ ar= MEM_callocN(sizeof(ARegion), "buttons area for nla");
+
+ BLI_addtail(&snla->regionbase, ar);
+ ar->regiontype= RGN_TYPE_UI;
+ ar->alignment= RGN_ALIGN_RIGHT;
+ ar->flag = RGN_FLAG_HIDDEN;
+
/* main area */
ar= MEM_callocN(sizeof(ARegion), "main area for nla");
BLI_addtail(&snla->regionbase, ar);
ar->regiontype= RGN_TYPE_WINDOW;
- ar->v2d.tot.xmin= 1.0f;
- ar->v2d.tot.ymin= 0.0f;
- ar->v2d.tot.xmax= 1000.0f;
- ar->v2d.tot.ymax= 500.0f;
+ ar->v2d.tot.xmin= (float)(SFRA-10);
+ ar->v2d.tot.ymin= -500.0f;
+ ar->v2d.tot.xmax= (float)(EFRA+10);
+ ar->v2d.tot.ymax= 0.0f;
- ar->v2d.cur.xmin= -5.0f;
- ar->v2d.cur.ymin= 0.0f;
- ar->v2d.cur.xmax= 65.0f;
- ar->v2d.cur.ymax= 250.0f;
+ ar->v2d.cur = ar->v2d.tot;
ar->v2d.min[0]= 0.0f;
- ar->v2d.min[1]= 0.0f;
+ ar->v2d.min[1]= 0.0f;
ar->v2d.max[0]= MAXFRAMEF;
- ar->v2d.max[1]= 1000.0f;
-
- ar->v2d.minzoom= 0.1f;
- ar->v2d.maxzoom= 50.0f;
-
+ ar->v2d.max[1]= 10000.0f;
+
+ ar->v2d.minzoom= 0.01f;
+ ar->v2d.maxzoom= 50;
ar->v2d.scroll = (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL);
ar->v2d.scroll |= (V2D_SCROLL_RIGHT);
ar->v2d.keepzoom= V2D_LOCKZOOM_Y;
- ar->v2d.align= V2D_ALIGN_NO_NEG_Y;
+ ar->v2d.align= V2D_ALIGN_NO_POS_Y;
ar->v2d.flag = V2D_VIEWSYNC_AREA_VERTICAL;
- /* ui buttons */
- ar= MEM_callocN(sizeof(ARegion), "buttons area for nla");
-
- BLI_addtail(&snla->regionbase, ar);
- ar->regiontype= RGN_TYPE_UI;
- ar->alignment= RGN_ALIGN_RIGHT;
- ar->flag = RGN_FLAG_HIDDEN;
-
return (SpaceLink *)snla;
}
@@ -213,7 +210,7 @@ static void nla_channel_area_init(wmWindowManager *wm, ARegion *ar)
{
ListBase *keymap;
- UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_STACK, ar->winx, ar->winy);
+ UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_LIST, ar->winx, ar->winy);
/* own keymap */
// TODO: cannot use generic copy, need special NLA version