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:
- Easily update-able framework.
- An “API” or a library of functions to take advantage of in other scripts or tools.
- 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.
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"
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.