Scripts > SpeedTree SWA Importer for Maya

This Maya plug-in loads world-building data in SWA format. Its primary purpose is to reconstruct SpeedTree-generated forests in Maya.

Maya SpeedTree Forest Plug-In Location

The Maya SpeedTree SWA Importer plug-in is located in a subdirectory of the SpeedTree Modeler installation folder:
[SpeedTree Modeler Install Dir]/Scripts/Maya/SpeedSWAImporter.py

Overview

The SpeedTree SWA Importer plug-in is ideal for populating large amounts of instances, for objects such as trees, grass, rocks, or really any static or animated mesh object. The data is interpreted into a particle cloud, and objects are instanced onto these particles. This is an efficient way to instance objects, since each instance does not require an individual node.

SpeedTree SWA Importer works by loading a simple utility for getting the world-building data from the SpeedTree Modeler into Maya. World-building data is imported as 'SWA' (SpeedTree World-Building ASCII) files. The 'SWA' data is translated into Maya particles. The named entries do not necessarily correspond to names of objects in the scene. 'SWA' files are generated from the SpeedTree Modeler (exported from the “File” menu), or alternatively can be generated in other third party 3D applications such as Autodesk's 3ds Max.

Supported Versions of Maya:

Maya 2009-2014 are supported (requires a version of Maya that supports the Python API).


Installation

Installing The Plug-In

To install the plug-in, open up the Maya Plug-In Manager (menu item Window→Settings/Preferences→Plug-In Manager). Select the “Browse” button along the bottom and select this file – “[SpeedTree Modeler Install Dir]/Scripts/Maya/SpeedTreeSWAImporter.py”.

All associated files needed for the plug-in to function are added to Maya's search paths upon loading. The necessary associated files are listed below:

SpeedTreeSWAImporter.py

icons/out_SpeedTreeSWAImporter.xpm
icons/render_SpeedTreeSWAImporter.xpm
icons/SpeedTreeAbout.bmp
icons/SpeedTreeSWAImporter.png
templates/AESpeedTreeSWAImporterTemplate.mel

SpeedTree FBX Plug-In

If this is your first time loading the plug-in, the SpeedTree FBX plug-in will be automatically loaded as well. This is to avoid double manual loading of each.

Automatic Loading

It is advisable to set the SpeedTree SWA Importer plug-in to auto-load with Maya. Enable the “Auto-Load” option in the 'Plug-In Manager' for this behavior.

In order for the plug-in to be listed in the 'Plug-In Manager' the next time Maya loads, the SpeedTree SWA Importer plug-in location is appended to the “Maya.env” file located in the documents folder for the installed version of Maya. If the plug-in fails to locate “Maya.env”, the plug-in can either be manually moved (with all associated files) to a location that is scanned by Maya on load, or the plug-in location can be added manually to your “Maya.env” file. Note that sometimes, the line will only register in “Maya.env” if it is listed first.



Importing Forest Data

Using the Plug-In To Import Forest Data

Once the plug-in has been loaded, import a SpeedTree SWA file using the menu item File→Import…. In the “Files of type” selector, choose “SpeedTree SWA Importer”.

Importing With Commands

Additionally, SWA files can be imported using the MEL command “ImportSpeedTreeSWAImporter”, or the python command “maya.cmds.importSpeedTreeSWAImporter()” (note: for python, maya.cmds must first be imported into the main module).


Assigning Items To The Forest

The process of adding objects to the forest entries requires that the desired objects be selected first. After the desired objects are selected, SHIFT + select the desired particle set in the viewport, or CTRL + select the SpeedTree SWA Importer node in the 'Outliner'. This selection order is important.

Once an object has been assigned, the default behavior is to hide the object automatically. This is because the source object will still render unless it is hidden. The plug-in automates this process, and lets you hide and unhide all of the source nodes for an entire forest at once via the “Hide source objects” option. Object visibility is restored after an object has been removed from a forest entry.

Populating Objects During Import

Objects that are selected directly prior to the import of a 'SWA' file are automatically registered to the forest. Here again, the pick order matters. For a forest with three entries, the first three selected objects in the active list will be assigned to the three forest entries in the order that they were selected.

Removing Objects From A Forest

To remove an assignment to a forest entry, either press the “Remove” button next to the entry label, or simply replace the assigned object. If replaced, the old object is released back into the scnene, and made visible if it were hidden by the plug-in.


Options & Attributes

Below is a description of the various options available for the plug-in.

SWA File

The 'SWA' file, which contains the forest data. Use the “browse” button to load a different 'SWA' file (or to update the contents of the current forest by reselecting the same file). Press the “Reload” button to load the data from the current 'SWA' file again, if it was edited externally.

When the forest data is changed, any assigned objects will be maintained and assigned to the new data.

Reloading of the 'SWA' file is disabled in Maya 2009 and 2010. The old interface did not allow for dynamic list population in the editor template.

Hide Source Objects

When enabled, source objects are set to “hidden” after forest entry assignment. Otherwise, the source objects would remain visible in the viewport and renders. When an object is removed, its visibility is restored.

Display As Bounding Boxes

When enabled, forest data is visualized in the viewport as boxes, instead of as full meshes. Full meshes can quickly bog down the interactivity of the viewport.

Forest Visible

Controls the visibility of the instanced objects. When disabled, only points will be visible in the viewport and renders.

Forest Entries

The following options are available for each forest entry found in the 'SWA' file:



Usage Tips

When Using The SpeedTree SWA Importer Plug-In

Please read the following suggestions for best use of the SpeedTree SWA Importer plug-in:

Avoid:




Version History

SpeedTreeForest 1.01

SpeedTreeForest 1.0

SpeedTree Forest plug-in for Maya released with SpeedTree Cinema and Studio v6.1.3.

Known Issues: