-
Notifications
You must be signed in to change notification settings - Fork 0
/
NP_curveOffsetRelease.mel
53 lines (47 loc) · 1.28 KB
/
NP_curveOffsetRelease.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
{
string $select[]=`ls -sl`;
if (size ($select)==0)
{
warning "You must at least select an object!";
}
else
{
string $allAttr[] = `listAttr -k -v $select`;
string $objAttrName[];
string $secondKeyableAttr[];
float $secondAttrValue[];
float $result[];
float $time[]= `keyframe -q -at`;
float $secondAttBuffer[];
$time = `sort $time`;
clear $objAttrName;
clear $secondAttrValue;
for ($h=0; $h<size($select); $h++)
{
$secondKeyableAttr = `listAttr -k -v $select[$h]`;
for ($i=0; $i< size ($secondKeyableAttr); $i++)
{
$secondAttBuffer[$i] = `getAttr ($select[$h]+"."+$secondKeyableAttr[$i])`;
$secondAttrValue[size($secondAttrValue)]=$secondAttBuffer[$i];
$objAttrName[size ($objAttrName)] = ($select[$h]+"."+$secondKeyableAttr[$i]);
}
}
if (size ($time)==0)
{
for ($j=0; $j< size ($allAttr); $j++)
{
$result[$j] = -1*($attrValue[$j]-$secondAttrValue[$j]);
keyframe -animation objects -relative -valueChange (0 + $result[$j]) $objAttrName[$j];
}
}
else
{
for ($j=0; $j< size ($allAttr); $j++)
{
$result[$j] = -1*($attrValue[$j]-$secondAttrValue[$j]);
keyframe -animation objects -relative -t ($time[0]+":"+$time[size ($time)-1] ) -valueChange (0 + $result[$j]) $objAttrName[$j];
}
}
}
autoKeyframe -state $autoKeyState;
}