global proc export2PhysX()
{
string $selobjs[] = `ls -sl`;
string $exampleFileName = `textField -q -tx filen`;
$fileId=`fopen $exampleFileName "w"`;
for ($objs in $selobjs)
{
if ((`substring $objs 2 5`) == "Cube")
{
float $XRotation = `getAttr ($objs + ".rotateX")`;
float $YRotation = `getAttr ($objs + ".rotateY")`;
float $ZRotation = `getAttr ($objs + ".rotateZ")`;
setAttr ($objs + ".rotateX") 0;
setAttr ($objs + ".rotateY") 0;
setAttr ($objs + ".rotateZ") 0;
float $XPosition = `getAttr ($objs + ".boundingBoxCenterX")`;
float $YPosition = `getAttr ($objs + ".boundingBoxCenterY")`;
float $ZPosition = `getAttr ($objs + ".boundingBoxCenterZ")`;
float $XRadius = `getAttr ($objs + ".boundingBoxSizeX")`/2;
float $YRadius = `getAttr ($objs + ".boundingBoxSizeY")`/2;
float $ZRadius = `getAttr ($objs + ".boundingBoxSizeZ")`/2;
$XRotation = floor($XRotation*1000))/1000;
$YRotation = floor($YRotation*1000))/1000;
$ZRotation = floor($ZRotation*1000))/1000;
fprint $fileId ("Name: " + $objs + "\n");
fprint $fileId ("XPos: " + $XPosition + "\n");
fprint $fileId ("YPos: " + $YPosition + "\n");
fprint $fileId ("ZPos: " + $ZPosition + "\n");
fprint $fileId ("XRot: " + $XRotation + "\n");
fprint $fileId ("YRot: " + $YRotation + "\n");
fprint $fileId ("ZRot: " + $ZRotation + "\n");
fprint $fileId ("XRad: " + $XRadius + "\n");
fprint $fileId ("YRad: " + $YRadius + "\n");
fprint $fileId ("ZRad: " + $ZRadius + "\n");
fprint $fileId ("\n");
}
if ((`substring $objs 2 7`) == "Sphere")
{
float $XPosition = `getAttr ($objs + ".boundingBoxCenterX")`;
float $YPosition = `getAttr ($objs + ".boundingBoxCenterY")`;
float $ZPosition = `getAttr ($objs + ".boundingBoxCenterZ")`;
float $Radius = `getAttr ($objs + ".boundingBoxSizeX")`;
$Radius /= 2;
fprint $fileId ("Name: " + $objs + "\n");
fprint $fileId ("XPos: " + $XPosition + "\n");
fprint $fileId ("YPos: " + $YPosition + "\n");
fprint $fileId ("ZPos: " + $ZPosition + "\n");
fprint $fileId ("XRad: " + $Radius + "\n");
fprint $fileId ("\n");
}
}
fclose $fileId;
}
string $exampleFileName = "export.col";
window -height 89 -width 213;
columnLayout -columnWidth 205 -height 63 -width 205;
textField -height 23 -width 200 -tx $exampleFileName filen;
button -align "center" -command "export2PhysX" -height 28 -label "Export" -width 80;
showWindow;