JockeP
11-02-2008, 07:31 PM
I made a script that will transfer the pivot for one object to another. What I would like to know is how to find out how many objects I have selected. That would make the script better :) Here is the script
string $selection[] = `ls -sl`;
float $SPx = `getAttr ($selection[0] +".scalePivotX")`;
float $SPy = `getAttr ($selection[0] +".scalePivotY")`;
float $SPz = `getAttr ($selection[0] +".scalePivotZ")`;
float $RPx = `getAttr ($selection[0] +".rotatePivotX")`;
float $RPy = `getAttr ($selection[0] +".rotatePivotY")`;
float $RPz = `getAttr ($selection[0] +".rotatePivotZ")`;
int $i=0;
for ($i;$i<5;$i++)
{
setAttr ($selection[$i] +".scalePivotX") ($SPx);
setAttr ($selection[$i] +".scalePivotY") ($SPy);
setAttr ($selection[$i] +".scalePivotZ") ($SPz);
setAttr ($selection[$i] +".rotatePivotX") ($RPx);
setAttr ($selection[$i] +".rotatePivotY") ($RPy);
setAttr ($selection[$i] +".rotatePivotZ") ($RPz);
}
This will only work on 5 objects(or whatever number you set it to). And you will also need to select the object you want to transfer the pivot from first. And if I knew how to find out how many objects you select, I could make it work for every object selected and you could also select the object that you wish to have the pivot from last.
string $selection[] = `ls -sl`;
float $SPx = `getAttr ($selection[0] +".scalePivotX")`;
float $SPy = `getAttr ($selection[0] +".scalePivotY")`;
float $SPz = `getAttr ($selection[0] +".scalePivotZ")`;
float $RPx = `getAttr ($selection[0] +".rotatePivotX")`;
float $RPy = `getAttr ($selection[0] +".rotatePivotY")`;
float $RPz = `getAttr ($selection[0] +".rotatePivotZ")`;
int $i=0;
for ($i;$i<5;$i++)
{
setAttr ($selection[$i] +".scalePivotX") ($SPx);
setAttr ($selection[$i] +".scalePivotY") ($SPy);
setAttr ($selection[$i] +".scalePivotZ") ($SPz);
setAttr ($selection[$i] +".rotatePivotX") ($RPx);
setAttr ($selection[$i] +".rotatePivotY") ($RPy);
setAttr ($selection[$i] +".rotatePivotZ") ($RPz);
}
This will only work on 5 objects(or whatever number you set it to). And you will also need to select the object you want to transfer the pivot from first. And if I knew how to find out how many objects you select, I could make it work for every object selected and you could also select the object that you wish to have the pivot from last.
