diff options
author | Joshua Leung <aligorith@gmail.com> | 2007-03-19 10:32:36 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2007-03-19 10:32:36 +0300 |
commit | 8b4b8d4dd21f277ceb71a89b2ea62f7398f33099 (patch) | |
tree | 0b2cb6817d8710e84167af36e44258f127ca87bb /source/blender/src/edittime.c | |
parent | 819fc06a80269012dcf920b5dc2f79bf4b417149 (diff) |
== Preview Range ==
Preview Range is a useful tool for animating (espcially on longer timelines). It allows you to only run through a limited set of frames to quickly preview the timing of a section of movement without going through the whole timeline. It means you don't have to set/reset start/end frame for rendering everytime you wish to only preview a region of frames.
Hi Ton,
Attached is a patch (I know you've already got lots of them in the tracker ;-) ) for a feature that I've sometimes wanted. It seems that this sort of thing is supported in other packages, but I can't be sure.
Note: I may have left in a few bits and pieces I didn't mean to in the patch (this is off a source tree which had quite a few revisions in it, all of which was experimental)
== Preview Range ==
Preview range is useful for animating (espcially on longer timelines). It allows you to only run through a limited set of frames to quickly preview the timing of a section of movement without going through the whole timeline. It means you don't have to set/reset start/end frame for rendering everytime you wish to only preview a region of frames.
* 'Ctrl P' in Action/NLA/Timeline sets preview range. Click+drag to form selection-box defining region of frames to preview
* 'Alt P' in Action/NLA/Timeline to clear preview range
* 'Pre' button beside Start/End fields in timeline toggles whether start/end fields refer to scene or preview
* 'Ctrl Rightarrow' and 'Ctrl Leftarrow' jump to start/end of preview region when it is set
* 'S' and 'E' set the start/end frames of preview region when it is set (just like normally) in Timeline only
* In Action/NLA editors, frames out of preview region are now drawn darkened when preview-region is set
See the following page for more info later:
http://wiki.blender.org/index.php/User:Aligorith/Preview_Range
Diffstat (limited to 'source/blender/src/edittime.c')
-rw-r--r-- | source/blender/src/edittime.c | 76 |
1 files changed, 74 insertions, 2 deletions
diff --git a/source/blender/src/edittime.c b/source/blender/src/edittime.c index 5bbcd1098bb..29bcbac79df 100644 --- a/source/blender/src/edittime.c +++ b/source/blender/src/edittime.c @@ -577,6 +577,61 @@ static void select_timeline_marker_frame(int frame, unsigned char shift) /* *********** end Markers - TimeLine *************** */ +/* set the animation preview range of scene */ +void anim_previewrange_set() +{ + extern float get_action_frame(Object *ob, float cframe); + rcti rect; + rctf rectf; + short val, mval[2]; + + /* set range by drawing border-select rectangle */ + if ( (val = get_border(&rect, 5)) ) { + /* get frame numbers */ + mval[0]= rect.xmin; + mval[1]= rect.ymin+2; + areamouseco_to_ipoco(G.v2d, mval, &rectf.xmin, &rectf.ymin); + mval[0]= rect.xmax; + mval[1]= rect.ymax-2; + areamouseco_to_ipoco(G.v2d, mval, &rectf.xmax, &rectf.ymax); + + /* check if this is called from the action editor (with scaling) */ + if (curarea->spacetype == SPACE_ACTION) { + /* if action is mapped in NLA, it returns a correction */ + if(G.saction->pin==0 && OBACT) { + rectf.xmin= get_action_frame(OBACT, rectf.xmin); + rectf.xmax= get_action_frame(OBACT, rectf.xmax); + } + } + + /* set preview-range */ + G.scene->r.psfra= rectf.xmin; + G.scene->r.pefra= rectf.xmax; + + BIF_undo_push("Set anim-preview range"); + allqueue(REDRAWTIME, 0); + allqueue(REDRAWACTION, 0); + allqueue(REDRAWNLA, 0); + allqueue(REDRAWBUTSALL, 0); + } +} + +/* clear the animation preview range for scene */ +void anim_previewrange_clear() +{ + G.scene->r.psfra = 0; + G.scene->r.pefra = 0; + + BIF_undo_push("Clear anim-preview range"); + allqueue(REDRAWTIME, 0); + allqueue(REDRAWACTION, 0); + allqueue(REDRAWNLA, 0); + allqueue(REDRAWBUTSALL, 0); +} + +/* ************ end Animation Preview Range ********** */ + + static int float_to_frame(float frame) { int to= (int) floor(0.5 + frame/G.scene->r.framelen ); @@ -875,7 +930,13 @@ void winqreadtimespace(ScrArea *sa, void *spacedata, BWinEvent *evt) transform_markers('g', 0); break; case EKEY: /* set end frame */ - G.scene->r.efra = CFRA; + if (G.scene->r.psfra) { + if (CFRA > G.scene->r.psfra) + G.scene->r.psfra= CFRA; + G.scene->r.pefra= CFRA; + } + else + G.scene->r.efra = CFRA; allqueue(REDRAWBUTSALL, 0); allqueue(REDRAWTIME, 1); break; @@ -890,8 +951,19 @@ void winqreadtimespace(ScrArea *sa, void *spacedata, BWinEvent *evt) allqueue(REDRAWNLA, 0); allqueue(REDRAWSOUND, 0); break; + case PKEY: /* preview-range stuff */ + if (G.qual & LR_CTRLKEY) /* set preview range */ + anim_previewrange_set(); + else if (G.qual & LR_ALTKEY) /* clear preview range */ + anim_previewrange_clear(); + break; case SKEY: /* set start frame */ - G.scene->r.sfra = CFRA; + if (G.scene->r.psfra) { + G.scene->r.psfra= CFRA; + G.scene->r.pefra= (EFRA > CFRA)? (EFRA):(CFRA); + } + else + G.scene->r.sfra = CFRA; allqueue(REDRAWBUTSALL, 0); allqueue(REDRAWTIME, 1); break; |