GML Importer Version 2

I will assume most of you know what GML is, if not check out this post I made some time ago here. In the months that have gone passed we have developed three different version of the GML importer. The first version that was featured in a video here, was a basic hack that we used to get a job done. The second version was an expansion of the first while it was a little better it lacked a few important features:

  1. Easily update-able framework.
  2. An “API” or a library of functions to take advantage of in other scripts or tools.
  3. A single unified User Interface that exposes all of the data in the GML File.

So after taking a moment and addressing these issues we created what we believe to be a great tool. It includes a library of code that other 3ds Max TDs and scripters can take advantage of. We choose to focus more on the data and library that goes with it. In it’s current form the script will only create a spline shape from the GML file. I will be updating it to include a feature to create proper geometry. We currently have it working by creating a sequence of points and using Delaunay Triangulation to create the surface.

The User Interface

The interface at first glance looks quite complicated, however, it is actually very simple. We wanted to expose everything to the artists so there are quite a lot of UI controls, most of which can easily be tucked away for later use. I was going to document what all of the UI controls do below but since each one has a question mark I’ll let you work it out.

GML Importer Version 2

The user interface tries to expose as much info a possible while keeping it uncluttered and easy to use.

The Library

We believe simplicity is the ultimate sophistication so we tried to keep everything as simple as possible. Below is a brief run down of the maxscript structs that make up our GML importer.

  • gml_point GML point is a simple struct the stores x, y, z along with t (time) values. If it was not for the t I would had have just used a point3.
  • gml_sketch This struct represents a whole sketch. It is made up of strokes (s_strokes). Each stroke is an array of gml_point()
  • gml_custom_props This struct just stores some custom data that is not from the gml file.
  • gml_header Stores all the information in the header of the GML file. Mainly stores name, username, version and keyword information. This data is reflected in the GUI in the information rollout.
  • gml_enviro This struct holds all of the environment data in the GML file. This includes the canvas size, up vectors and related data. This information is reflected in the GUI in the Environment rollout.
  • gml_document is the guts of everything, its instantiates every one of the above structs. Through this struct you can interact with all facets of a GML file. The struct also provides three methods to create objects and shapes from the data, these are mainly included as examples of what you could do. These functions are  implemented in the GUI. We are currently working on a new method to create geometry that will be included in new updates.

Looking through the gml_data.ms file will give you a good understanding on what is going on. There is a pretty detailed example in the comments showing you how to create gml_documet to sum up the simplicity there is a snippet below:

a = gml_document()
a.file = "C:\\18763.gml"
a.init()
a.createShape()

You can download the GML importer below:

[download id=”3″ format=”1″]

For everyone that has posted and emailed me asking where is the importer? Well it is here now, thank you for your support and let me know how you go. If you create something cool then please send it in. In the spirit of community if you are making this better then lets make it better for everyone! Send in any changes or updates you find. Feel free to posts bugs in the comments below.

Cheers,

Dave

Comments
One Response to “GML Importer Version 2”
  1. Triet Le says:

    Hi Dave

    I tried out the new plug in and manage to run it in Maxscript. However, after I import a gml file and tried to create a model(i click the “Object” command) of the gml file, all I get is a square cube. Is there an extra step I need to take to create the shape what you have in your 1st video? I tried to create an object, thinking that I have to have an object 1st then let the plug in do the work of shaping the object, but it’s no use.

    Triet Le

Leave A Comment