Anim8tor exporter script: Difference between revisions
>NXTBoy |
>NXTBoy No edit summary |
||
Line 2: | Line 2: | ||
==Install Instructions== | ==Install Instructions== | ||
:''Note: This tutorial was designed to be used on Windows XP. However, if you have a similar operating system, like Windows Vista or Windows 7, it shouldn't be too hard to figure out. There is also a [[#speed_tutorial]] and [[#debugging_guide]].'' | :''Note: This tutorial was designed to be used on Windows XP. However, if you have a similar operating system, like Windows Vista or Windows 7, it shouldn't be too hard to figure out. There is also a [[#speed_tutorial|speed tutorial]] and a [[#debugging_guide|debugging guide]].'' | ||
===Part One: Setting Up Anim8or=== | ===Part One: Setting Up Anim8or=== | ||
Line 145: | Line 145: | ||
$result = 1;</pre> | $result = 1;</pre> | ||
[[Category:Tutorials]] |
Revision as of 02:33, 15 August 2010
This is Gamer3D's Anim8or script for exporting to the Roblox *.mesh format. With this update, the exporter officially works.
Install Instructions
- Note: This tutorial was designed to be used on Windows XP. However, if you have a similar operating system, like Windows Vista or Windows 7, it shouldn't be too hard to figure out. There is also a speed tutorial and a debugging guide.
Part One: Setting Up Anim8or
- You can download Anim8or at the official site.
- If you need help setting up Anim8or, please see the debugging guide at the bottom. I assume that many people can do this on their own, and the process does not need its own section of the tutorial to explain it.
Part Two: Setting Up the Script
- Open Notepad. If you do not know how, it can be found by clicking the Start button in the lower left corner. Click All Programs and then the Accessories folder, which is usually close to the top in the far left column. Finally, click Notepad in that folder.
- Copy and paste the script below. Be sure to click and drag starting from the beginning of /* all the way to the very end of $result=1;. Nothing more, nothing less. Press Control-C to copy when you have it all highlighted and Control-V to paste the script into Notepad.
- Do not change anything, just go to File > Save As... at the top.
- Name it something that you'll remember is an export script so you don't accidentally delete it later, like anim8or_export or export_script.
- This is important! Where it says Choose File Type: next to a drop-down menu, choose All Files. Type .a8s after the name of the script. So, "anim8or_export" becomes "anim8or_export.a8s".
- Save it in a location you'll remember, like My Documents, because you'll need to know it later.
- Launch Anim8or.
- At the top, go to File > Configure... A dialog box will pop up with several boxes.
- Click the ... button next to the Scripts:, choose the folder you saved the script into, and click OK.
- This is important! Tick the check box next to Preload Scripts on the configuration window and click OK.
- Close and reopen Anim8or. If, after reopening Anim8or, a window titled "Anim8or Debug Output" opens and says
Compiling "C:\[location folders]\[script name].a8s": 61 lines 0 errors
then you have successfully configured the script! Congratulations!
Part Three: Making a Mesh
If you are like most people, you probably have no experience with 3D modeling programs. Anim8or is a very basic 3D modeling program; if you thought it looked hard to use when you first opened it, take a look at other very advanced 3D modeling programs like 3DS MAX (the program ROBLOX staff uses to make hats) or Blender. But don't worry, you don't need those to make your very first mesh. Your first mesh will be a "primitive."
- To insert a "primitive mesh," which is just a basic shape like a cube or pyramid, go to Build > Primitives at the top. There you will find different basic 3D figures; click any of them.
- Click anywhere (I recommend clicking in the middle, the intersection of the two white lines) and drag in any direction to change the size of the shape. Release when you are satisfied. You have just inserted your first 3D model!
- You can select the mesh and move it around if you want by clicking the Select tool (shortcut key is a), selecting the mesh, and moving it with the Move tool (shortcut key is m).
- Since the file type Anim8or saves to is .an8, we have to export the 3D model to a .mesh file, which ROBLOX uses as the format for all meshes. To do this, go to Object > Export... at the top. Save it to a memorable location with any name and be sure to change the "Save as type:" drop-down menu to Roblox Mesh:plug-in (*.mesh). Click Save. Congratulations! You have just created a mesh you can use in ROBLOX!
Part Four: Putting Your Mesh in ROBLOX
- Open ROBLOX or ROBLOX Studio. Log in and visit your place in Build (for normal ROBLOX) or Edit mode (for ROBLOX Studio).
- Either click Insert at the top left and insert any brick, or use any another method to get a brick.
- Click Tools at the top far left (optional: close Insert).
- Select the brick you will use. Go to Insert > Object... and click SpecialMesh. Click OK.
- In Properties, change the MeshType to FileMesh.
- This is the moment of truth! In the MeshId field, type the file path of your mesh (this looks something like this: C:\Documents and Settings\...). At the end, don't forget to type the name of your mesh with the ".mesh" after it. Press Enter.
- If everything worked out properly, your mesh should appear! If it does not appear, this either means that the mesh could not be loaded (some just can't be for some reason) or you did something wrong. If you created a primitive mesh when you exported, then it will almost definitely appear, unless you made a mistake. If it does appear, congratulations for the fourth time! You have just finished the tutorial and created your first working mesh!
- Note: see the debugging guide, Part Four, for more information.
Speed Tutorial
- Download Anim8or here. Links are on the left.
- Extract the file from the .zip to anywhere.
- Copy and paste the script into Notepad.
- Go to File > Save As... Remember where you save the script.
- Change "Save as type:" to all files.
- Type the name you want to save as and put .a8s after it.
- Open Anim8or.
- Go to File > Configure...
- Change "Scripts:" to the directory where you saved the script.
- Be sure that "Preload Scripts" is checked.
- Restart Anim8or and make sure that an "Anim8or Debug Output" window opens.
- Create a starter model by going to Build > Primitives and choosing any of them.
- Click anywhere (center is recommended) and drag in any direction to scale the mesh.
- Shortcut key a to select, and then m to move by dragging.
- Go to Object > Export... and save as type Roblox Mesh:plugin (*.mesh).
- Open your place in Build mode on ROBLOX or Edit mode on ROBLOX Studio.
- Insert > Object... to insert a SpecialMesh into a brick.
- Change MeshType to FileMesh.
- Enter the file path of the mesh into the MeshId field and press Enter.
Debugging Guide
In case you didn't know, debugging is finding out what's wrong with a problem and fixing it. This section will help you find out where you went wrong if something isn't working. Feel free to PM me on ROBLOX if this still doesn't help or if you want to suggest something to add here.
Part One
- I can't find the link to download Anim8or. The download links are on the left side. You can click either the "Download" or the "0.97 Preview" link. Be sure to download the latest version; for the first link, it's a link titled animv095c.zip, and for the second link (you have to scroll down to find it), the file is a link titled anim8or_v097d_preview.zip.
- The folder icon looks weird. That's because it's a .zip file. Double-click it and extract the files to anywhere you choose (preferably "Desktop") by clicking Extract all files on the left side.
- A weird program opens up when I double-click the file. If you know how to use it, you can use it, but if you don't, close the program and right-click the file. Change the Open With setting so that it opens with the default "Compressed (zipped) Folders" program.
Part Two
- The "Anim8or Debug Output" window doesn't appear! Two things could have happened: you probably forgot to change the file extension when you saved the script, or you chose the wrong folder for the "Scripts:" box.
- The window used to appear, but now it doesn't. Check the folder that is entered in the "Scripts:" box and ensure that it (as well as the script) still exists. This is why it's important to save to a folder you won't delete as a name that you won't delete.
- I get this in the Anim8or Debug Output:
internal error on line 28: ScriptObject::InitExecution<>: missing file descriptor
I haven't determined the exact cause of this problem, but it may be related to the first problem under Part Two. Try recopying and resaving the script (as an .a8s file, of course).
Part Three
- The tools don't work! If the tools don't work, it means you probably changed the mode. The mode is shown in the upper left with four icons: a cursor, an eye, three lines, and three dots. The mode should be set to the cursor (shortcut key is Shift-a).
Part Four
- Why doesn't my mesh appear in online mode? Player-made meshes do not appear normally in online mode. They just look invisible. If you want people to see your meshes, you will have to make an uncopylocked place with the meshes inside and instruct players to visit it if they cannot see the meshes. This is so the players will "download" the meshes in the place, and when they go to your place, they will be able to see the meshes.
Thanks for reading!
This concludes the tutorial. Have fun making meshes, and I hope you learned something from the tutorial! This tutorial was written by leg0builder with a big thanks going out to NXTBoy from the wiki's editing team.
Script
/* Description: Add this to your Anim8or scripts directory and start Anim8or. The script MUST have the ".a8s" extension and be in the Anim8or Scripts folder. Make sure that "Preload Scripts" is set to ON (this is NECCESSARY). This script has been tested for 0.95 and 0.97 preview. */ #plugin("object", "export", "Roblox Mesh", ".mesh"); #file($output, "text"); #return($result); file $output; int $result; object $obj; shape $shape, $shapes[1], $childShapes[1]; tridata $data; material $mat; int $numFaces; point3 $point, $normal, $color; point2 $uv; int $i; int $j; int $index, $mIndex; int $count; float $gCol; string $nm; string $newName; float4x4 $tMatrix; $nm = $output.GetRoot(); $obj = project.curObject; $output.print("version 1.00\n"); $obj.GetShapes($childShapes); $shapes.size = 0; while($childShapes.size > 0) { $shapes.push($childShapes.pop()); } while($shapes.size > 0) { $shape = $shapes.pop(); $shape = $shape.ConvertToMesh(); $data = $shape.GetTriangleData(); $numFaces = $data.GetNumTriangles(); $tMatrix = $shape.GetGlobalTransform(); $output.print("%d\n",$numFaces); for $i = 0 to $numFaces - 1 do { for $j = 0 to 2 step 1 do { $index = $data.GetIndex(($i*3)+$j); $point = $data.GetPoint($index); $point = $tMatrix.Project($point); $normal = $data.GetNormal($index); $uv = $data.GetTexCoord($index); $output.print("[%.6g, %.6g, %.6g]", $point.x, $point.y, $point.z); $output.print("[%.5f, %.5f, %.5f]", $normal.x, $normal.y, $normal.z); $output.print("[%.5f, %.5f, 0]", $uv.x, $uv.y); } } } $result = 1;