Geometry Exporter to UnrealEd...
Hey guys, got one for ya...
I've been learning UnrealEd, the editor used to make levels for the game UNREAL Tournament 2003. I've been following the video tutorials over at 3DBuzz but have come to an obstacle. I've copied, word for word, and script they wrote used to export geometry from Maya to UnrealEd. But there are two errors which I can't seem to trouble shoot. It appears, to me anyway, that the errors lie with a closed bracket - } - and an else variable. Below is the code as it appeared in the tutorial. See if any of you can get it to work.
Of course if you don't have UnrealEd, it won't export and will give you an error for it. But it's not necessary to have it to trouble shoot. Just see if you can get past the two errors I mentioned.
Thanks in advance.
**********************************************
//Declare my variables
string $myWindow = "exportAssist";
string $mainLayout = "cLayout";
//Check to see if the window exists
if (`window -ex $myWindow`)
deleteUI $myWindow;
//Create a window
window -wh 169 165 -mxb false -sizeable false -title "Static Mesh Exporter" $myWindow;
//Add layouts and controls.
frameLayout -l "";
columnLayout $mainLayout;
rowColumnLayout -nc 2 -cw 1 55;
text -l "MeshName:";
textField -text "changeMe" tMeshName;
text -l "Package:";
textField -text "myLevel" tPackage;
text -l "Group:";
textField tGroup;
text -l "Scale:";
floatField -pre 0 -v 16 fScale;
setParent $mainLayout;
separator -style none;
separator -w 165;
separator -style none;
button -w 155 -l "Export" -c "exportToMaya";
showWindow;
//Procedures
proc exportToMaya()
{
string $objSelected[] = `ls -sl`;
string $meshName = `textField -q -text tMeshName`;
string $sPackage = `textField -q -text tPackage`;
string $sGroup = `textField -q -text tGroup`;
float $fScale = `floatField -q -value fScale`;
if (size($objSelected)!=1)
{
confirmDialog -title "Selection Error" -message "Error in Selection!";
}
else
{
//Did the user Triangulate?
string $result = `confirmDialog -title "Confirm" -message "Did you Triangulate?"
-button "Yes" -button "No" -defaultButton "Yes"
-cancelButton "No" -dismissString "No"`;
if ($result == "No")
{
string $result = `confirmDialog -title "Confirm" -message "Triangulate Now?"
-button "Yes" -button "No" -defaultButton "Yes"
-cancelButton "No" -dismissString "No"`;
if ($result == "Yes")
{
polyPerformAction polyTriangulate f 0;
changeSelectMode -object;
select -r $objSelected[0]
}
}
//Does the set exist?
if (!`objExists $meshName`)
confirmDialog -message "Set Exists!";
else
{
$createSetResult = `sets -name $meshName`;
addAttr -ln scale -at double $meshName;
addAttr -ln package -dt "string" $meshName;
addAttr -ln group -dt "string" $meshName;
}
//Set the custom Attributes values
setAttr ($meshName + ".package") -type "string" $sPackage;
if ($sGroup)
{
setAttr ($meshName + ".group") -type "string" $sGroup;
}
setAttr ($meshName + ".scale") $fScale;
//Export to UnrealEd
eval ("unEditor mesh " + $meshName);
}
}
**********************************************
Dave Baer
Professor of Digital Arts
Digital Media Arts College
Boca Raton, Florida
dbaer@dmac.edu