Anim8or Community

Please login or register.

Login with username, password and session length
Advanced search  

News:

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: Spline exporting  (Read 3195 times)

csf

  • Newbie
  • *
  • Posts: 26
    • View Profile
    • CSF On The Web
Spline exporting
« 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?
Logged
AKA coaster sim. fan on the old boards

Kubajzz

  • Flying Platypus
  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 548
  • Little doggie ate my avatar...
    • View Profile
Re: Spline exporting
« Reply #1 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.
Logged

csf

  • Newbie
  • *
  • Posts: 26
    • View Profile
    • CSF On The Web
Re: Spline exporting
« Reply #2 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
Quote
<spline name="peepPath02" cyclic="0">
      <node>
         <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"/>
      </node>
      <node>
         <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"/>
      </node>
      <node>
         <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"/>
      </node>
   </spline>

Thank you for any help you can provide.
Logged
AKA coaster sim. fan on the old boards

Kubajzz

  • Flying Platypus
  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 548
  • Little doggie ate my avatar...
    • View Profile
Re: Spline exporting
« Reply #3 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:
  • every "knot" row represents one "node"
  • the first 3 numbers stand for the position of the node in the (x y z) format
  • the following 2 sets of coordinates represent the "controlPrev" and "controlNext" tangent data in the (x y z) format
  • if the "closed { }" row is present, the value of "cyclic" in the "spline" tag should be "1" (I guess...)
  • all other data (such as "corner { }" and "extendable { }") can be ignored

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.
Logged

csf

  • Newbie
  • *
  • Posts: 26
    • View Profile
    • CSF On The Web
Re: Spline exporting
« Reply #4 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 :)
Logged
AKA coaster sim. fan on the old boards