Anim8or Community

General Category => ASL Scripts => Topic started by: csf on February 14, 2009, 05:48:05 am

Title: Spline exporting
Post by: csf on February 14, 2009, 05:48:05 am
Is it possible to export spline data in an export script? Or is only mesh data assessable?
Title: Re: Spline exporting
Post by: Kubajzz on February 14, 2009, 10:54:06 am
Spline data is accessible. If you give me a description of the export format, I can write that script for you.
Title: Re: Spline exporting
Post by: csf on February 16, 2009, 07:56:25 pm
Its called .modxml its a custom xml format, which supports models, textures, animations, and spline data. It was designed for use with the roller coaster tycoon 3 custom scenery importer.

Here is an example of the spline part of the format
<spline name="peepPath02" cyclic="0">
         <position x="6.822311" y="-0.024619" z="0.000000"/>
         <controlPrev x="7.822311" y="-0.024619" z="0.000000"/>
         <controlNext x="5.822311" y="-0.024619" z="0.000000"/>
         <position x="1.481718" y="0.000000" z="0.000000"/>
         <controlPrev x="1.981718" y="0.011800" z="0.000000"/>
         <controlNext x="2.322913" y="-0.016683" z="1.335551"/>
         <position x="1.999660" y="-0.003365" z="4.988674"/>
         <controlPrev x="2.499660" y="0.008435" z="4.988674"/>
         <controlNext x="1.292751" y="-0.020048" z="6.324225"/>

Thank you for any help you can provide.
Title: Re: Spline exporting
Post by: Kubajzz on February 17, 2009, 10:00:54 pm
I gave it a shot and I think I found a possible solution.

Your export format requires 2 things: the node positions and the tangent handles information.

As far as I know neither of these can be directly accessed using ASL and there's no reasonable way to get this data in a script. However if you save your .an8 file and open it in a text editor, you can get all you need. This "manual format conversion" is probably the easiest way, although it's not very comfortable. It's not worth writing a converter unless you need to export a lot of splines...

Here is a sample spline saved in the .an8 format:

Code: [Select]
pathcom {
  name { "path01" }
  extendable { }
  bezier {
    closed { }
    knot { (-34.513 -1.8584 0) (-4.3659 11.74 0) (21.652 0.64896 0)
      corner { }
    knot { (-9.9115 20.088 0) (10.334 0.14643 0) (-10.334 -0.14643 0) }
    knot { (30.442 0.08848 0) (-6.1504 -5.4866 0) (6.1504 5.4866 0) }

If you compare it to the .modxml sample you posted, it's not very difficult to figure out how to convert the formats:

This is what I figured out by reading the .modxml sample you posted and the an8 format specification (, maybe there are more things you have to pay attention to...

I guess I didn't help you much, if you really need to speed up the process and you don't mind waiting several days, I can try writing an external converter for you.
Title: Re: Spline exporting
Post by: csf on February 17, 2009, 10:31:58 pm
Thanks for the information. I had a feeling this would not be possible to make with ASL looking at the spline commands we have to work with.

Thanks for the offer on an external converter, but I really don't need you to go through the trouble. Also if I really need it I could just make a simple one on my own.

I am actually thinking about working on making a program over the summer (right now during the semester I just don't have enough time) that would read and write a few 3D file formats including the ability to go from anim8or to modxml (I also know ASL does not support animation which I can get out of the anim8or file). My goal would be to make the program do allot more then just file conversions but I have to start some where :)