Author Topic: Anim8or Exporter Required (.an8 script example)  (Read 1485 times)

Is it possible, if so, then how would I go about doing it?
To be honest I like Anim8or better than Blender,  Milkshape (because I'm broke) and 3dsmax (because I'm broke).
Anim8or allows you to create scripts.
This is a script to export to ROBLOX-compatible meshes:
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 File", ".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;
Maybe someone could use this as a template for a .dts explorter if such a thing doesn't already exist?
« Last Edit: August 13, 2010, 11:25:53 PM by DarkShadow6 »

.mesh and .dts are completely different file formats. The way this script works looks like .mesh is just a notepad openable list of vertices/faces. DTS isn't.
You can't just change a few things and have a working dts exporter.

Just find something that Anim8or can export to that Blender can import, and then export to dts with Blender
« Last Edit: August 14, 2010, 12:26:52 PM by Headcrab Zombie »

.mesh and .dts are completely different file formats. The way this script works looks like .mesh is just a notepad openable list of vertices/faces. DTS isn't.
You can't just change a few things and have a working dts exporter.

Just find something that Anim8or can export to that Blender can import, and then export to dts with Blender
That's what I was thinking right after I posted this...
:3