Anim8or Community

Please login or register.

Login with username, password and session length
Advanced search  


An update to Anim8or, v1.00b, is available with a few bug fixes. Get your copy HERE. See the "ReadMe" file for details.

Author Topic: Importing .MESH files  (Read 4853 times)


  • Newbie
  • *
  • Posts: 1
    • View Profile
Importing .MESH files
« on: June 16, 2009, 04:25:11 pm »

I got this script for the game ROBLOX that converts anim8or meshes to .MESH files,but is there any script that can convert it back to Anim8or meshes?
Here's the script.

Code: [Select]
  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");

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");
$shapes.size = 0;
while($childShapes.size > 0)
while($shapes.size > 0)
    $shape = $shapes.pop();
    $shape = $shape.ConvertToMesh();
$data = $shape.GetTriangleData();
        $numFaces = $data.GetNumTriangles();
$tMatrix = $shape.GetGlobalTransform();
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;


  • Sr. Member
  • ****
  • Posts: 259
    • View Profile
Re: Importing .MESH files
« Reply #1 on: June 16, 2009, 11:39:19 pm »

Import scripts are not supported yet.