AL_USDMaya  0.16.6
USD to Maya Bridge
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
AL::maya::FileTranslatorOptions Class Reference

Utility class that constructs the file translator export GUI from the export options you want to support. More...

#include <FileTranslatorOptions.h>

Public Member Functions

 FileTranslatorOptions (const char *fileTranslatorName)
 ctor More...
 
High Level Layout

A collection of file translator options can be grouped into 1 or more GUI frames within the GUI. At a minimum, there must be at least 1 frame added to the GUI prior to any options being added.

bool addFrame (const char *frameName)
 add a new frame layout under which to group a set of controls. There must be at least 1 frame created before you create any options (otherwise the controls will not have a location in which to live) More...
 
Add Exporter Options

Add custom export/import options using the following methods. There must be at least 1 frame layout created prior to creating any new controls.

bool addBool (const char *optionName, bool defaultValue=false)
 Add a boolean value to the translator options. More...
 
bool addInt (const char *optionName, int defaultValue=0)
 Add an integer value to the translator options. More...
 
bool addFloat (const char *optionName, float defaultValue=0.0f)
 Add a float value to the translator options. More...
 
bool addString (const char *optionName, const char *const defaultValue="")
 Add a string value to the translator options. More...
 
bool boolControlsVisibility (const char *controller, const char *controlled, bool invertBehaviour=false)
 For a given boolean option (the controller), if enabled the 'controlled' option will be editable. If the checkbox is uncecked, the controlled option will be disabled in the GUI. The invertBehaviour param reverses this behaviour (i.e. if controller is true, controlled will be disabled). More...
 

MEL script code generation

Once all of the options have been added for the file translator, then you can easily generate the MEL script code via the generateScript method.

MStatus generateScript (OptionsParser &optionParser, MString &defaultOptionString)
 This method generates the MEL script for the import/export GUI, and evaluates it behind the scenes. It also configure the option parser for use by the MPxFileTranslator object, and generates the defaultOptionString required when registering the function. More...
 
bool hasOption (const char *const optionName) const
 
bool hasOption (const MString &optionName) const
 
void generateBoolGlobals (const MString &niceName, const MString &optionName, bool defaultValue)
 
void generateIntGlobals (const MString &niceName, const MString &optionName, int defaultValue)
 
void generateFloatGlobals (const MString &niceName, const MString &optionName, float defaultValue)
 
void generateStringGlobals (const MString &niceName, const MString &optionName, MString defaultValue)
 

Detailed Description

Utility class that constructs the file translator export GUI from the export options you want to support.

Constructor & Destructor Documentation

AL::maya::FileTranslatorOptions::FileTranslatorOptions ( const char *  fileTranslatorName)

ctor

Parameters
fileTranslatorNamethe name of the file translator

Member Function Documentation

bool AL::maya::FileTranslatorOptions::addBool ( const char *  optionName,
bool  defaultValue = false 
)

Add a boolean value to the translator options.

Parameters
optionNamethe name of the option
defaultValuethe default value for the option
Returns
true if the option was successfully added. False if the option is a duplicate
bool AL::maya::FileTranslatorOptions::addFloat ( const char *  optionName,
float  defaultValue = 0.0f 
)

Add a float value to the translator options.

Parameters
optionNamethe name of the option
defaultValuethe default value for the option
Returns
true if the option was successfully added. False if the option is a duplicate
bool AL::maya::FileTranslatorOptions::addFrame ( const char *  frameName)

add a new frame layout under which to group a set of controls. There must be at least 1 frame created before you create any options (otherwise the controls will not have a location in which to live)

Parameters
frameNamethe name of the high level frame to add into the GUI
bool AL::maya::FileTranslatorOptions::addInt ( const char *  optionName,
int  defaultValue = 0 
)

Add an integer value to the translator options.

Parameters
optionNamethe name of the option
defaultValuethe default value for the option
Returns
true if the option was successfully added. False if the option is a duplicate
bool AL::maya::FileTranslatorOptions::addString ( const char *  optionName,
const char *const  defaultValue = "" 
)

Add a string value to the translator options.

Parameters
optionNamethe name of the option
defaultValuethe default value for the option
Returns
true if the option was successfully added. False if the option is a duplicate
bool AL::maya::FileTranslatorOptions::boolControlsVisibility ( const char *  controller,
const char *  controlled,
bool  invertBehaviour = false 
)

For a given boolean option (the controller), if enabled the 'controlled' option will be editable. If the checkbox is uncecked, the controlled option will be disabled in the GUI. The invertBehaviour param reverses this behaviour (i.e. if controller is true, controlled will be disabled).

Parameters
controllerthe name of the option that controls the enabled state of the controlled option.
controlledthe name of the option to enable/disable based on the state of the controlled attribute.
invertBehaviourif true, controlled will be disabled when controller is enabled. if false, controlled will be enabled when controller is enabled.
Returns
true if the visibility relationship could be created. May return false if the controller or controlled options are invalid.
MStatus AL::maya::FileTranslatorOptions::generateScript ( OptionsParser optionParser,
MString &  defaultOptionString 
)

This method generates the MEL script for the import/export GUI, and evaluates it behind the scenes. It also configure the option parser for use by the MPxFileTranslator object, and generates the defaultOptionString required when registering the function.

Parameters
optionParserthe option parser in which the options for the file translator have been specified
defaultOptionStringthe returned default option string for the file translator (which can be used when registering your file translator with the MFnPlugin)
Returns
MS::kSuccess if ok

The documentation for this class was generated from the following file: