Open a series of useful different parts of the script, which often need arises.

MEL. Snippets 1. Save and restore the transformation of a group of objects

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
global float $translation[];

global float $rotation[];

int $i = 0;

string $selection[] = `ls -sl -type transform`;

for ($sel in $selection)

{

$translation[$i] = `getAttr ($sel+".translateX")`;

$translation[$i+1] = `getAttr ($sel+".translateY")`;

$translation[$i+2] = `getAttr ($sel+".translateZ")`;

$rotation[$i] = `getAttr ($sel+".rotateX")`;

$rotation[$i+1] = `getAttr ($sel+".rotateY")`;

$rotation[$i+2] = `getAttr ($sel+".rotateZ")`;

$i = $i + 3;

}

}

Now, if necessary, the transformation can be restored.

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
// restore

int $i = 0;

string $selection[] = `ls -sl -type transform`;

for ($sel in $selection)

{

setAttr ($sel+".translateX") $translation[$i];

setAttr ($sel+".translateY") $translation[$i+1];

setAttr ($sel+".translateZ") $translation[$i+2];

setAttr ($sel+".rotateX") $rotation[$i];

setAttr ($sel+".rotateY") $rotation[$i+1];

setAttr ($sel+".rotateZ") $rotation[$i+2];

$i = $i + 3;

}

Download:

MEL Script code PoseManager

MEL Snippet: Pose Manager
Tagged on:         

Leave a Reply

Your email address will not be published. Required fields are marked *