jbUnity Tools

Josh Buck | (c)2009 - 2012 | www.cgartistry.com

jbUnity Tools is provided free of charge and is free to use under this license. If you find this script useful please consider donating to help fund further development. Or... if you'd rather buy me a beer, indicate that donated funds are for purpose of "beer" and I personally guarantee that they are allocated as such. Cheers!


Please send bugs, comments and suggestions for features and/or improvements to josh@cgartistry.com

Running the script

  1. Copy jbUnityTools to your User\Documents\Maya\version\scripts directory
  2. Start Maya, open the script editor and type or copy the following text into the Python window:

    import jbUnityTools
    jbUnityTools.jbUnityToolsUI()

  3. Use the "Execute All" button in the script editor OR make a shelf button by selecting the text in the Python window and going to File -> Save Script to Shelf.

** This script currents runs only in Maya versions 2011+.

Grid Settings

Unity Grid : Establishes an optimal Maya grid and camera settings for creating Unity assets. It's recommended to also switch your scene to "Meters" when applying these settings (see below.) **

Default Grid : Switches all grid and camera settings back to the default Maya settings. Please note, this does not also automatically switch your scene back to centimeters. To switch back to cm's toggle Centimeters before pressing "Default Grid" (see below.) **

Meters/Centimeters : Maya defaults to centimeters but Unity is often best served by working in Meters. Toggling this switch and pressing either of the grid selection buttons (Unity Grid/Default Grid) will switch the scene unit settings to one or the other. When you load the jbUnity Tools script it toggles to your current active scene units.

Divisions : Changes the number of grid divisions. Divisions can be cutomized as needed. Turn on grid snap to work with your custom grid. Default for Unity Grid settings are 1, 2, 4, 5, 8 and 10.

Grid Size : Increases and decreses the overall size of the grid.

** jbUnity tools has it's own grid coloring scheme. If you wish to retain your custom grid color settings you can do so by unchecking 'Use jbUnity Tools Grid Colors' in the 'Settings' drop down menu.

Transform Tools

Grid Nudge : Nudges the selected object based on the grid division settings.

Zero : Moves either selected meshes or the pivot point of selected meshes to convenient locations.
Mesh
: Repositions selected objects around the main grid axis. Based on the bounding box of the object and allows for quick repositioning of objects for building modular structures and/or export. The object is positioned in relation to the main grid axis based on the LFB, CFB, CB and C option (see below.)
Pivot : Keeps selected objects at their current locations and repositions their pivot points based on LFB, CFB, CB and C (see below.)
LFB - Left Front Bottom : Left front bottom of the object as viewed looking down the -Z axis.
CFB - Center Front Bottom : Center front bottom of the object as viewed looking down the -Z axis.
CB - Center Bottom : Center bottom of the object as viewed looking down the -Z axis.
C - Center : Center of the object. This is the same as "center pivot" if you're operating on the pivot only.

Rotate : Rotates the object based on float field values. Default is 0, 90, 0.

Stack : True stacking based on selection order and bounding boxes. Select meshes in order starting with the mesh you want to stack on top of. Select the appropriate radio button for the direction you wish to stack in.

References

6ft/182cm Human : Creates a box reference that is 182cm high and 120cm wide. This is considered a good reference for door openings in game references.

Make Your Own : Create a reference based on float field input. Default settings are 5m wide, 3m high and 20cm deep.

Custom : To use your own references, create a folder in your current Maya project named 'UnityReference'. Put Maya Binary files (*.mb) that contain your references in this folder and jbUnity Tools will create a button for each .mb file found when the script is run.

Calculator

The calculator is based on float field input and calculates mm, cm, m, km, inches, feet, yards and miles.

Export

Export features allow you to export from your scene in the FBX format. jbUnity Tools will automatically load the latest FBX export preset file (*.fbxexportpreset) located in the root of your current Maya project. If you do not have a valid FBX export preset file in this location you must manually choose a valid FBX export preset file before exporting (do this in the 'settings' dropdown menu.)

To Create a custom FBX preset :

  1. Open the options box from either File -> Export All... or File -> Export Selection...
  2. Under General Options, change the file type to FBX export
  3. Under File Type Specific Options press Edit Preset...
  4. In the Edit export preset window change the Current Preset to User defined
  5. Change settings as desired
  6. Press Save preset at the bottom of the Edit export preset window
  7. By default the preset file saves to your User\Documents\maya\FBX\Presets\MayaVersionNumber\export

Individual Export : Exports a single selected object -- the object's pivot point in Unity will be the object's pivot point in Maya. You will be prompted for a folder location. The resulting FBX file takes the name from the maya scene mesh.

Batch Export : Opens the Batch Export Window. From the batch export window you can create a list of all objects you want to export from your scene and export the list as separate objects.
Add : Adds to the export list.
Remove : Removes objects either selected in the scene or in the list from the export list.
Remove All : Clears the export list.
Prefix/Suffix : Adds text in these boxes to the beginning and/or end of the mesh names in the export list.
Position Pivot for Export : Automatically positions the pivot of each object based on the LFB, CFB, CB and C setting before export (see Transform Tools for details.) This allows you to export a large number of objects with common pivot points without having to set them prior to export.
Restore After Export : Restores the pivot point of each object after export if 'Position Pivot for Export' was selected. This is on by default -- please note, that if you turn this off and have 'Position Pivot for Export' selected the pivot point for each mesh in your export list will be changed.
EXPORT : Exports the meshes in the batch export list based on settings (see above.) You will be prompted for a folder location. FBX files in this location with the same names as meshes in the export list will be overwritten.

Tip : The export script prints what was exported to the script window -- check this along with the FBX log file for confirmation of export.