-
Notifications
You must be signed in to change notification settings - Fork 0
/
mr_frame_timesliderRange.mel
74 lines (59 loc) · 3.11 KB
/
mr_frame_timesliderRange.mel
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
// ------------------------------------------------------------------------------------------------------------------------------------------------
// SCRIPT: frameTimeslider
// VERSION: 0001
//
// CREATORS: Maria Robertson
//
// -------------------------------------------------------------------
//
// DESCRIPTION:
// A version of FrameSelectedWithoutChildren.
// - Only frames within the Time Slider range, rather than the entire scene.
// - Only shows animCurves of highlighted animation animLayer.
//
// EXAMPLE USES:
// Can be helpful as a hotkey, if wanting to focus on a range and not select relevant keys each time you want to frame it.
//
// -------------------------------------------------------------------
//
// RUN COMMAND:
// FrameInsidePlaybackRange() ;
//
// ------------------------------------------------------------------------------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
// -------------------------------------------------------------------- //
// //
// FOCUS GRAPH EDITOR INSIDE PLAYBACK RANGE //
// //
// -------------------------------------------------------------------- //
//////////////////////////////////////////////////////////////////////////
global proc FrameInsidePlaybackRange() {
// -------------------------------------------------------------------
// 01. INITIALIZE VARIABLES
// -------------------------------------------------------------------
// define timeslider range
float $start = `playbackOptions -q -min` ;
float $end = `playbackOptions -q -max` ;
// define difference (use abs to account for negative frame numbers)
$range = `abs ($start - $end)` ;
// value to multiply timeslider range, to set a comfortable buffer amount
float $bufferDivider = 0.1 ;
// define buffer
float $frameBuffer = $range * $bufferDivider ;
// -------------------------------------------------------------------
// 01. REFRAME GRAPH EDITOR
// -------------------------------------------------------------------
// reframe the Graph Editor
animView -startTime (`playbackOptions -query -minTime` - $frameBuffer) -endTime (`playbackOptions -query -maxTime` + $frameBuffer) graphEditor1GraphEd ;
// -------------------------------------------------------------------
// 01. SHOW ONLY ANIM CURVES ON HIGHLIGHTED ANIMATION LAYERS
// -------------------------------------------------------------------
// create array of highlighted animation animLayer
string $animLayer[] = getSelectedAnimLayer("AnimLayerTab") ;
// for every animation layer
for ($item in $animLayer) {
// rehighlight it, to refresh the Graph Editor anim curves
animLayerEditorOnSelect($item, 1) ;
}
}