Page 1 of 1

correctly importing pivots

Posted: Thu Dec 09, 2010 11:46 am
by FlorianK
when I import a particle seq into Maya, the pivot in Maya is set to the world space origin. I'd prefer if the pivot was either at the emitters original pivot or at the particle clouds center of mass (final frame).

The latter, I can write for myself in MEL, but it was nice to have the first at least as an option when importing.

Re: correctly importing pivots

Posted: Fri Jan 28, 2011 3:54 pm
by FlorianK
Just in case you need an "Align RF particle sequence" script in Maya, but you are too lazy to code it for yourself:

Code: Select all

string $nodes[]  = `ls -sl`;
vector $scaleSource;
vector $trnlSource;
vector $rotPivotSource;
vector $sclPivotSource;

int $cnt = 0;

for ($n in $nodes)
{
	if (`objectType $n`	== "transform")
		{
			// case source
			if($cnt == 0)
			{
				$scaleSource = `getAttr ($n + ".scale")`;
				$trnlSource = `getAttr ($n + ".translate")`;
				$rotPivotSource = `getAttr ($n + ".rotatePivot")`;
				$sclPivotSource = `getAttr ($n + ".scalePivot")`;
				$cnt += 1;
				continue;
			}
			// case target
			if($cnt == 1)
			{
				// set pivots first
				setAttr ($n + ".rotatePivot") ($rotPivotSource.x) ($rotPivotSource.y) ($rotPivotSource.z);
				setAttr ($n + ".scalePivot") ($sclPivotSource.x) ($sclPivotSource.y) ($sclPivotSource.z);
				setAttr ($n + ".scale") ($scaleSource.x) ($scaleSource.y) ($scaleSource.z);
				setAttr ($n + ".translate") ($trnlSource.x) ($trnlSource.y) ($trnlSource.z);
				
				print ("\n Done.");
				
			}
			else
			{
				print ("no more than two nodes possible!");
				
			}
		}
};

Re: correctly importing pivots

Posted: Fri Feb 04, 2011 10:07 am
by Hector
Thank you very much Florian :)