-
Notifications
You must be signed in to change notification settings - Fork 0
/
NP_curveLocalScale_start.mel
49 lines (45 loc) · 1.19 KB
/
NP_curveLocalScale_start.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
global proc start()
{
string $select[]= `ls -sl`;
string $keyAttr[]=`keyframe -q -sl -n`;
string $radioButton = `radioCollection -q -sl radioCo`;
float $scalValue = `floatSliderButtonGrp -q -v scaleSlider`;
float $pivot;
float $keyValue[];
float $keyIndex[];
float $factor;
float $value;
float $range;
float $rangeFactor;
int $damping = `checkBox -q -v dampCheck`;
int $reverseDamp =`checkBox -q -v reverseDamp`;
int $t;
bufferCurve -animation keys -swap;
bufferCurve -animation keys -overwrite true;
for ($j=0; $j<size($keyAttr);$j++){
$keyValue=(`keyframe -q -sl -vc $keyAttr[$j]`);
$keyIndex=(`keyframe -q -sl -tc $keyAttr[$j]`);
if (size ($keyIndex)!=1){
$pivot=$keyValue[0];
$range = $keyIndex[size($keyIndex)-1]-$keyIndex[0];
$factor=(1.0/($range));
$rangeFactor=$keyIndex[1]-$keyIndex[0];
$t=($range);
for ($i=0; $i<$range+1; $i++){
if ($damping == 1){
if ($reverseDamp ==1){
$value=($factor*$i)+($factor*$t*$scalValue)+($rangeFactor*$factor*($scalValue-1));
}
else{
$value=($factor*$t)+($factor*$i*$scalValue);
}
}
else{
$value=$scalValue;
}
scaleKey -t ($keyIndex[0]+$i) -vs $value -vp $pivot $keyAttr[$j];
$t-=1;
}
}
}
}