Simply Maya User Community

Simply Maya User Community (https://simplymaya.com/forum/index.php)
-   Programming (https://simplymaya.com/forum/forumdisplay.php?f=32)
-   -   Geometry Exporter to UnrealEd... (https://simplymaya.com/forum/showthread.php?t=9388)

dave_baer 13-12-2003 04:15 AM

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);
}
}

**********************************************

kbrown 14-12-2003 06:32 PM

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];

dave_baer 15-12-2003 05:20 AM

OMG! I can't believe I missed that! Thank dood. I was going nuts trying to figure that out. :D

Chipper 01-01-2004 08:15 PM

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.

dave_baer 01-01-2004 08:46 PM

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?


All times are GMT. The time now is 01:37 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Simply Maya 2018