diff options
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/space_graph/space_graph.c | 10 | ||||
-rw-r--r-- | source/blender/editors/space_nla/nla_edit.c | 59 |
2 files changed, 44 insertions, 25 deletions
diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c index a5578e88076..c36d790f0be 100644 --- a/source/blender/editors/space_graph/space_graph.c +++ b/source/blender/editors/space_graph/space_graph.c @@ -68,14 +68,16 @@ ARegion *graph_has_buttons_region(ScrArea *sa) { ARegion *ar, *arnew; - for(ar= sa->regionbase.first; ar; ar= ar->next) + for (ar= sa->regionbase.first; ar; ar= ar->next) { if(ar->regiontype==RGN_TYPE_UI) return ar; + } /* add subdiv level; after main window */ - for(ar= sa->regionbase.first; ar; ar= ar->next) + for (ar= sa->regionbase.first; ar; ar= ar->next) { if(ar->regiontype==RGN_TYPE_WINDOW) break; + } /* is error! */ if(ar==NULL) return NULL; @@ -246,7 +248,9 @@ static void graph_main_area_draw(const bContext *C, ARegion *ar) /* XXX the slow way to set tot rect... but for nice sliders needed (ton) */ get_graph_keyframe_extents(&ac, &v2d->tot.xmin, &v2d->tot.xmax, &v2d->tot.ymin, &v2d->tot.ymax); - + /* extra offset so that these items are visible */ + v2d->tot.xmin -= 10.0f; + v2d->tot.xmax += 10.0f; } /* only free grid after drawing data, as we need to use it to determine sampling rate */ diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c index 9ddd8daab0d..01871d3d9d5 100644 --- a/source/blender/editors/space_nla/nla_edit.c +++ b/source/blender/editors/space_nla/nla_edit.c @@ -747,25 +747,37 @@ void NLA_OT_delete (wmOperatorType *ot) // - variable-length splits? /* split a given Action-Clip strip */ -static void nlaedit_split_strip_actclip (AnimData *adt, NlaTrack *nlt, NlaStrip *strip) +static void nlaedit_split_strip_actclip (AnimData *adt, NlaTrack *nlt, NlaStrip *strip, float cfra) { NlaStrip *nstrip; - float midframe, midaframe, len; + float splitframe, splitaframe; - /* calculate the frames to do the splitting at */ - /* strip extents */ - len= strip->end - strip->start; - if (IS_EQ(len, 0.0f)) - return; - else - midframe= strip->start + (len / 2.0f); - - /* action range */ - len= strip->actend - strip->actstart; - if (IS_EQ(len, 0.0f)) - midaframe= strip->actend; - else - midaframe= strip->actstart + (len / 2.0f); + /* calculate the frames to do the splitting at + * - use current frame if within extents of strip + */ + if ((cfra > strip->start) && (cfra < strip->end)) { + /* use the current frame */ + splitframe= cfra; + splitaframe= nlastrip_get_frame(strip, cfra, NLATIME_CONVERT_UNMAP); + } + else { + /* split in the middle */ + float len; + + /* strip extents */ + len= strip->end - strip->start; + if (IS_EQ(len, 0.0f)) + return; + else + splitframe= strip->start + (len / 2.0f); + + /* action range */ + len= strip->actend - strip->actstart; + if (IS_EQ(len, 0.0f)) + splitaframe= strip->actend; + else + splitaframe= strip->actstart + (len / 2.0f); + } /* make a copy (assume that this is possible) and append * it immediately after the current strip @@ -774,13 +786,16 @@ static void nlaedit_split_strip_actclip (AnimData *adt, NlaTrack *nlt, NlaStrip BLI_insertlinkafter(&nlt->strips, strip, nstrip); /* set the endpoint of the first strip and the start of the new strip - * to the midframe values calculated above + * to the splitframe values calculated above */ - strip->end= midframe; - nstrip->start= midframe; + strip->end= splitframe; + nstrip->start= splitframe; - strip->actend= midaframe; - nstrip->actstart= midaframe; + if ((splitaframe > strip->actstart) && (splitaframe < strip->actend)) { + /* only do this if we're splitting down the middle... */ + strip->actend= splitaframe; + nstrip->actstart= splitaframe; + } /* clear the active flag from the copy */ nstrip->flag &= ~NLASTRIP_FLAG_ACTIVE; @@ -828,7 +843,7 @@ static int nlaedit_split_exec (bContext *C, wmOperator *op) /* splitting method depends on the type of strip */ switch (strip->type) { case NLASTRIP_TYPE_CLIP: /* action-clip */ - nlaedit_split_strip_actclip(adt, nlt, strip); + nlaedit_split_strip_actclip(adt, nlt, strip, (float)ac.scene->r.cfra); break; case NLASTRIP_TYPE_META: /* meta-strips need special handling */ |