Maya for 3D Printing - Rapid Prototyping
In this course we're going to look at something a little different, creating technically accurate 3D printed parts.
# 1 13-12-2003 , 04:15 AM
dave_baer's Avatar
Moderator
Join Date: Sep 2002
Location: Plantation, Florida
Posts: 1,568

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
# 2 14-12-2003 , 06:32 PM
kbrown's Avatar
Moderator
Join Date: Sep 2002
Location: London, UK
Posts: 3,198
Well, I can't test this fully 'cause I don't have UT nor UnrealEd but it seems that you have a semicolon missing in the script.

select -r $objSelected[0]

should be

select -r $objSelected[0];


Kari
- My Website
- My IMDB

Do a lot, Fail a lot and Learn a lot!
# 3 15-12-2003 , 05:20 AM
dave_baer's Avatar
Moderator
Join Date: Sep 2002
Location: Plantation, Florida
Posts: 1,568
OMG! I can't believe I missed that! Thank dood. I was going nuts trying to figure that out. user added image


Dave Baer
Professor of Digital Arts
Digital Media Arts College
Boca Raton, Florida
dbaer@dmac.edu
# 4 01-01-2004 , 08:15 PM
Chipper's Avatar
Subscriber
Join Date: Jan 2003
Location: U.K.
Posts: 136
I found it much easier just to use the actorx plugin and "axmesh" command (in maya 4.5 or 5)...i did use the script first for the ple version of maya (shipped with game) and it worked oki except for the textures had to be flipped first horizontally an vertically before they mapped oki in unrealed.
Also using the script method you have to then add the texture to the mesh in unrealed by pointing to where you have put your imported texture...with the axmesh way it will appear textured right away in mesh browser if you have imported your textures previously to that of your mesh (if named properly).
Then theres the scaling thing although you can add to the script to tell it to multiply by sixteen to get scale right at export (even though you scale grid in maya as ueds)....and also this not a prob using the later method as it will scale to your grid settings correctly.
Hope that makes sense as i was previously making 3rd party levels for ut2003 but havent in a good while now.


"Hear That Thunder"!!
# 5 01-01-2004 , 08:46 PM
dave_baer's Avatar
Moderator
Join Date: Sep 2002
Location: Plantation, Florida
Posts: 1,568
Thanks for the info, Chipper.

Nope. Haven't had any of those problems. Although I do have to point the textures to the right place, but I still have to do that with axmesh as well. Must be a bug or something. I can't get my same settings to load each time in UnrealEd. I always have to reload my imported mesh into the mesh browser. myLevel never shows up if I reload UnrealEd. Any ideas?


Dave Baer
Professor of Digital Arts
Digital Media Arts College
Boca Raton, Florida
dbaer@dmac.edu
Posting Rules Forum Rules
You may not post new threads | You may not post replies | You may not post attachments | You may not edit your posts | BB code is On | Smilies are On | [IMG] code is On | HTML code is Off

Similar Threads