class MFileIO

Jump to documentation

I/O operations on scene files. (OpenMaya) (OpenMaya.py)

public members:

enum ReferenceMode
kLoadDefault
kLoadAllReferences
kLoadNoReferences
MFileIO ()
MFileIO ( const MString & fileName )
virtual ~MFileIO ()
static MString currentFile ()
static MStatus setCurrentFile ( const MString & fileName )
static MString fileType ()
static MStatus getFileTypes ( MStringArray & types )
static MStatus newFile ( bool force = false )
static MStatus open ( const MString & fileName, const char* type = NULL, bool force = false, ReferenceMode refMode = kLoadDefault )
static MStatus save ( bool force = false )
static MStatus saveAs ( const MString & fileName, const char* type = NULL, bool force = false )
static MStatus importFile ( const MString & fileName, const char* type = NULL, bool preserveReferences = false, const char* nameSpace = NULL)
static MStatus exportSelected ( const MString & fileName, const char* type = NULL, bool preserveReferences = false)
static MStatus exportAll ( const MString & fileName, const char* type = NULL, bool preserveReferences = false)
static MStatus exportAnimFromReference ( const MString & fileName, const char* type = NULL)
static MStatus exportAnimFromReference ( const MString & fileName, const MString & refNodeName, const char* type = NULL)
static MStatus exportSelectedAnimFromReference ( const MString & fileName, const char* type = NULL)
static MStatus exportSelectedAnimFromReference ( const MString & fileName, const MString & refNodeName, const char* type = NULL)
static MStatus exportAnim ( const MString & fileName, const char* type = NULL)
static MStatus exportSelectedAnim ( const MString & fileName, const char* type = NULL)
static MStatus exportAsReference ( const MString & fileName, const char* type = NULL)
static MStatus getReferences ( MStringArray & references )
static MStatus getReferenceNodes ( const MString &fileName, MStringArray & nodes )
static MStatus getReferenceConnectionsMade ( const MString &fileName, MStringArray & connections )
static MStatus getReferenceConnectionsBroken ( const MString & fileName, MStringArray & connections )
static MStatus getReferenceConnectionsBroken ( const MString & fileName, MPlugArray & srcPlugs, MPlugArray & destPlugs )
static MStatus getReferenceConnectionsBroken ( const MObject & node, MStringArray & connections, bool append = false, bool removeDuplicates = true )
static MStatus getReferenceConnectionsBroken ( const MObject & node, MPlugArray & srcPlugs, MPlugArray & destPlugs, bool append = false, bool removeDuplicates = true )
static MStatus reference ( const MString & fileName, bool deferReference = false, bool lockReference = false )
static MStatus removeReference ( const MString & fileName )
static bool isReadingFile ()
static bool isWritingFile ()
static bool isOpeningFile ()
static bool isNewingFile ()
static bool mustRenameToSave ( MStatus *ReturnStatus = NULL)
static MStatus setMustRenameToSave (bool)
static MString mustRenameToSaveMsg ( MStatus *ReturnStatus = NULL)
static MStatus setMustRenameToSaveMsg (const MString &)
static MString beforeOpenFilename ( MStatus * ReturnStatus = NULL)
static MString beforeImportFilename ( MStatus * ReturnStatus = NULL)
static MString beforeSaveFilename ( MStatus * ReturnStatus = NULL)
static MString beforeExportFilename ( MStatus * ReturnStatus = NULL)
static MString beforeReferenceFilename ( MStatus * ReturnStatus = NULL)
static MString getLastTempFile ( MStatus * ReturnStatus = NULL)
static bool getErrorStatus ( MStatus * ReturnStatus = NULL)
static MStatus resetError ()
static MString loadReference (const MString & referenceFileName, MStatus *returnStatus = NULL)
static MString loadReferenceByNode (const MString & referenceNodeName, MStatus *returnStatus = NULL)
static MString loadReferenceByNode ( MObject & referenceNode, MStatus *returnStatus = NULL)
static MString unloadReference (const MString & referenceFileName, MStatus *returnStatus = NULL)
static MString unloadReferenceByNode (const MString & referenceNodeName, MStatus *returnStatus = NULL)
static MString unloadReferenceByNode ( MObject & referenceNode, MStatus *returnStatus = NULL)
static MString getReferenceFileByNode ( MObject & referenceNode, MStatus *returnStatus = NULL)
static MStatus cleanReference (const MString & referenceNodeName, const char* editCommand = NULL, MStatus *returnStatus = NULL)
static MStatus saveReference (const MString & referenceNodeName, MStatus *returnStatus = NULL)
static MString fileCurrentlyLoading ()
static bool isImportingFile ()
static MStatus import ( const MString & fileName, const char* type = NULL, bool preserveReferences = false, const char* nameSpace = NULL)
OBSOLETE & NO SCRIPT SUPPORT

Documentation

Methods for opening, saving, importing, exporting and referencing files.
Description

The MFileIO class provides a set of global functions that can be used to load and store scene elements into maya files. Methods are also provided to import elements from other files into the current scene, and export elements of the current scene into files. As well, references to other files can be created and removed.

This class implements only the most common operations from the full set possible with the MEL command "file." See the documentation of this command for a complete listing of all the possiblities. If more control is required than provided by this class, a MEL command can be constructed according to the instructions for the "file" command, and issued via the executeCommand method of the MGlobal class.

Functions

MFileIO:: MFileIO ()

Description

Default class constructor.

MFileIO:: MFileIO ( const MString & fileName )

Description

Class constructor that sets the current active file.

Arguments

  • fileName name of the new active file

MFileIO:: ~MFileIO ()

Description

The class destructor.

MString MFileIO:: currentFile ()

Description

Return the name of the currently active file.

Return Value

  • An MString containing the file name

MStatus MFileIO:: setCurrentFile ( const MString & fileName )

Description

Set the value of the current active file.

Arguments

  • fileName the name of the new active file.

Return Value

  • MS::kSuccess operation successful
  • MS::kFailure operation failed

MString MFileIO:: fileType ()

Description

Return the type of the current active file.

Arguments

  • types an MString containing the type

Return Value

  • MS::kSuccess operation successful
  • MS::kFailure operation failed

MStatus MFileIO:: getFileTypes ( MStringArray & types)

Description

Returns an array of all the valid type names that Maya currently supports. Only elements from this list are valid arguments for the type arguments to open, saveAs, import, exportSelected, and exportAll.

It should be noted that the results of this function will change as file translators that are implemented as plugins are loaded or unloaded.

The file types mayaAscii and mayaBinary will always be available.

Arguments

  • types a reference to an MStringArray which on return contains the list of supported file types.

Return Value

  • MS::kSuccess operation successful
  • MS::kFailure operation failed

MStatus MFileIO:: newFile ( bool force )

Description

Set everything back to a new file state.

Arguments

  • force succeed even if there are unsaved changes

Return Value

  • MS::kSuccess operation successful
  • MS::kFailure operation failed

MStatus MFileIO:: open ( const MString & fileName, const char* type, bool force, ReferenceMode refMode )

Description

Open the given file, and set the current active file to this file. If there are unsaved changes in the current scene, this operation will fail unless the force flag is set to true.

Arguments

  • fileName name of the file to open
  • type if NULL, Maya will try to deduce the type of the file. if not NULL, it contains a file type to use when opening the file.
  • force succeed even if there are unsaved changes
  • refMode specify whether to load all references, no references, or the references that were loaded when the scene was saved.

Return Value

  • MS::kSuccess operation successful
  • MS::kFailure operation failed

MStatus MFileIO:: save ( bool force )

Description

Save the contents of the current scene to the currently active file. If there have been no changes to the scene since the last save, then this operation will succeed, but not actually rewrite the save file unless the force flag is set to true.

Arguments

  • force succeed even if there have been no changes

Return Value

  • MS::kSuccess operation successful
  • MS::kFailure operation failed

MStatus MFileIO:: saveAs ( const MString & fileName, const char* type, bool force )

Description

Save the contents of the current scene to the given file. If there have been no changes to the scene since the last save, then this operation will succeed, but not actually rewrite the save file unless the force flag is set to true.

Arguments

  • fileName name of the file to write to
  • type if NULL, Maya will write the file in mayaAscii format. if not NULL, it contains a file type to use when writing the file.
  • force succeed even if there have been no changes since the last save operation

Return Value

  • MS::kSuccess operation successful
  • MS::kFailure operation failed

MStatus MFileIO:: importFile ( const MString & fileName, const char* type, bool preserveReferences, const char* nameSpace)

Description

Import the scene elements from the given file into the current scene. This operation is similar to open, but instead of replacing the current scene with the one from the new file, it adds the elements from that file to the existing ones in the current scene.

Arguments

  • fileName name of the file from which to import objects
  • type if NULL, Maya will try to deduce the type of the file. if not NULL, it contains a file type to use when importing the file.
  • preserveReferences Boolean to indicate whether the references need to be preserved.
  • namespace optional name of the namespace to use when importing objects. Use NULL for default of no namespace.

Return Value

  • MS::kSuccess operation successful
  • MS::kFailure operation failed

MStatus MFileIO:: import ( const MString & fileName, const char* type, bool preserveReferences, const char* nameSpace)

Description

This method is OBSOLETE and has NO SCRIPT SUPPORT. Please use the importFile() method instead.

MStatus MFileIO:: exportSelected ( const MString & fileName, const char* type, bool preserveReferences)

Description

Export all currently selected scene elements to the given file.

Arguments

  • fileName name of the file to which to export the objects
  • type if NULL, Maya will write the file in mayaAscii format. if not NULL, it contains a file type to use when writing the file.
  • preserveReferences Boolean to indicate whether the references need to be preserved.

Return Value

  • MS::kSuccess operation successful
  • MS::kFailure operation failed

MStatus MFileIO:: exportAll ( const MString & fileName, const char* type, bool preserveReferences)

Description

Export the current scene to the given file.

Arguments

  • fileName name of the file to which to export the objects
  • type if NULL, Maya will write the file in mayaAscii format. if not NULL, it contains a file type to use when writing the file.
  • preserveReferences Boolean to indicate whether the references need to be preserved.

Return Value

  • MS::kSuccess operation successful
  • MS::kFailure operation failed

MStatus MFileIO:: exportAnimFromReference ( const MString & fileName, const char* type)

Description

Export the animation from reference, to the specified file.

Arguments

  • fileName name of the file to which the animation will be exported.
  • type if NULL, Maya will write the file in mayaAscii format. if not NULL, it contains a file type to use when writing the file.

Return Value

  • MS::kSuccess operation successful
  • MS::kFailure operation failed

MStatus MFileIO:: exportAnimFromReference (const MString & fileName, const MString & refNodeName, const char* type )

Description

Export the animation from the specified reference node, to the specified file.

Arguments

  • fileName name of the file to which the animation will be exported.
  • refNodeName name of the reference whose animation will be exported.
  • type if NULL, Maya will write the file in mayaAscii format. if not NULL, it contains a file type to use when writing the file.

Return Value

  • MS::kSuccess operation successful
  • MS::kFailure operation failed

MStatus MFileIO:: exportSelectedAnimFromReference ( const MString & fileName, const char* type)

Description

Export the selected animation from reference, to the specified file.

Arguments

  • fileName name of the file to which the animation will be exported.
  • type if NULL, Maya will write the file in mayaAscii format. if not NULL, it contains a file type to use when writing the file.

Return Value

  • MS::kSuccess operation successful
  • MS::kFailure operation failed

MStatus MFileIO:: exportSelectedAnimFromReference (const MString & fileName, const MString & refNodeName, const char* type )

Description

Export the selected animation from reference, to the specified file.

Arguments

  • fileName name of the file to which the animation will be exported.
  • refNodeName name of the reference whose animation will be exported.
  • type if NULL, Maya will write the file in mayaAscii format. if not NULL, it contains a file type to use when writing the file.

Return Value

  • MS::kSuccess operation successful
  • MS::kFailure operation failed

MStatus MFileIO:: exportAnim ( const MString & fileName, const char* type)

Description

Export animation to the specified file.

Arguments

  • fileName name of the file to which the animation will be exported.
  • type if NULL, Maya will write the file in mayaAscii format. if not NULL, it contains a file type to use when writing the file.

Return Value

  • MS::kSuccess operation successful
  • MS::kFailure operation failed

MStatus MFileIO:: exportSelectedAnim ( const MString & fileName, const char* type)

Description

Export selected animation to the specified file.

Arguments

  • fileName name of the file to which the animation will be exported.
  • type if NULL, Maya will write the file in mayaAscii format. if not NULL, it contains a file type to use when writing the file.

Return Value

  • MS::kSuccess operation successful
  • MS::kFailure operation failed

MStatus MFileIO:: exportAsReference ( const MString & fileName, const char* type)

Description

Export the selected objects into a reference file.

Arguments

  • fileName name of the file to which the selected objects will be exported as reference.
  • type if NULL, Maya will write the file in mayaAscii format. if not NULL, it contains a file type to use when writing the file.

Return Value

  • MS::kSuccess operation successful
  • MS::kFailure operation failed

MStatus MFileIO:: getReferences ( MStringArray & references )

Description

Return an array of all the files referenced from the currently active file.

Arguments

  • references a reference to an MStringArray which on return contains the list of referenced files.

Return Value

  • MS::kSuccess operation successful
  • MS::kFailure operation failed

MStatus MFileIO:: getReferenceNodes ( const MString &fileName, MStringArray &nodes )

Description

Return an array of all the nodes referenced by the given filename.

Arguments

  • fileName an MString which contains the name of the referenced file.
  • nodes a reference to an MStringArray which on return contains the list of nodes in the referenced file.

Return Value

  • MS::kSuccess operation successful
  • MS::kFailure operation failed

MStatus MFileIO:: getReferenceConnectionsMade ( const MString &fileName, MStringArray &connections )

Description

Return an array of attribute pairs representing connections made to nodes in the given referenced file. The first element of the pair is the source attribute in the connection, and the second is the destination. These pairs correspond to the "connectAttr" statements in a scene file where changes to the referenced file occur after the referenced file has been opened.

Arguments

  • fileName an MString which contains the name of the referenced file.
  • connections a reference to an MStringArray which on return contains the source/destination connection pairs.

Return Value

  • MS::kSuccess operation successful
  • MS::kFailure operation failed

MStatus MFileIO:: getReferenceConnectionsBroken ( const MString & fileName, MStringArray & connections )

Description

Return an array of attribute pairs representing connections broken to nodes in the given referenced file. The first element of the pair is the source attribute in the connection, and the second is the destination. These pairs correspond to the "disconnectAttr" statements in a scene file where changes to the referenced file occur after the referenced file has been opened.

Arguments

  • fileName an MString which contains the name of the referenced file.
  • connections a reference to an MStringArray which on return contains the source/destination connection pairs.

Return Value

  • MS::kSuccess operation successful
  • MS::kFailure operation failed

MStatus MFileIO:: getReferenceConnectionsBroken ( const MObject & node, MStringArray & connections, bool append, bool removeDuplicates )

Description

Returns an array of plug name pairs corresponding to the broken connections from referenced files, where those connections involved the specified node.

To put it another way, if a referenced file contained a connection to the specified node when it was loaded, and that connection was later broken in the main scene, then the names of source and destination plugs for that connection will be returned.

The first element of the pair is the source plug in the connection, and the second is the destination. These pairs correspond to the "disconnectAttr" statements in a scene file where changes to the referenced file occur after the referenced file has been opened.

Arguments

  • node the node whose broken reference connections will be returned.
  • connections a reference to an MStringArray which on return contains the source/destination connection pairs.

Return Value

  • MS::kSuccess operation successful
  • MS::kFailure operation failed

MStatus MFileIO:: getReferenceConnectionsBroken ( const MString & fileName, MPlugArray & srcPlugs, MPlugArray & destPlugs)

Description

Returns the source and destination plugs corresponding to all the connections broken between nodes in the given referenced file. These pairs correspond to the "disconnectAttr" statements in a scene file where changes to the referenced file occur after the referenced file has been opened.

Arguments

  • fileName an MString which contains the name of the referenced file.

  • srcPlugs an MPlugArray which will receive the source plugs of each broken connection.

  • destPlugs an MPlugArray which contains the destination plugs of each broken connection.

Return Value

  • MS::kSuccess operation successful
  • MS::kInvalidParameter fileName is not a referenced file in the current scene.
  • MS::kFailure operation failed

MStatus MFileIO:: getReferenceConnectionsBroken ( const MObject & node, MPlugArray & srcPlugs, MPlugArray & destPlugs, bool append, bool removeDuplicates )

Description

Returns arrays of source and destination plugs corresponding to the broken connections from referenced files, where those connections involved the specified node.

To put it another way, if a referenced file contained a connection to the specified node when it was loaded, and that connection was later broken in the main scene, then the source and destination plugs for that connection will be returned.

Arguments

  • node the node whose broken connections should be returned.

  • srcPlugs an MPlugArray which will receive the source plugs of each broken connection.

  • destPlugs an MPlugArray which will receive the destination plugs of each broken connection.

  • append if true, then srcPlugs and destPlugs will not be initially cleared, meaning that the plugs from any broken connections found will be appended after whatever is already in those arrays. This can be useful for building up an array of connections for several nodes.

  • removeDuplicates if the append parameter is true, then it is possible that some of the broken connections found for node will already exist in plug arrays. For example, if node A and node B have a broken reference connection between them, then they will both return that connection when passed to this method. Setting removeDuplicates true will cause these duplicate connections to only appear in the plug arrays once.

Return Value

  • MS::kSuccess operation successful
  • MS::kFailure operation failed

MStatus MFileIO:: reference ( const MString & fileName, bool deferReference, bool lockReference )

Description

Add the given filename as a reference from the current file. When a new file is opened, the contents of any files it references are read into the scene, however maya remembers that the elements came from the referenced file, and does not write them during a save operation. Instead the reference is written so the contents of the references file (which might have changed) will be read again when the scene is reloaded.

Arguments

  • fileName name of the file to add as a reference
  • deferReference boolean to indicate whether loading has to be deferred.

Return Value

  • MS::kSuccess operation successful
  • MS::kFailure operation failed

MStatus MFileIO:: removeReference ( const MString & fileName )

Description

Remove the named file as a reference from the current file.

Arguments

  • fileName name of the file to remove as a reference

Return Value

  • MS::kSuccess operation successful
  • MS::kFailure operation failed

bool MFileIO:: isReadingFile ()

Description

Determine if Maya is currently in the middle of a file read operation.

Return Value

  • true if maya is currently in the process of writing a file
  • false if maya is not currently writing a file

bool MFileIO:: isWritingFile ()

Description

Determine if Maya is currently in the middle of a file write operation.

Return Value

  • true if maya is currently in the process of writing a file
  • false if maya is not currently writing a file

bool MFileIO:: isImportingFile ()

Description

Determine if Maya is currently in the middle of a file import operation.

Return Value

  • true if Maya is currently in the process of importing a file
  • false if Maya is not currently importing a file

bool MFileIO:: isNewingFile ()

Description

Determine if Maya is currently performing a "new" operation.

Maya performs two types of "new" operations: explicit new on account of a File>New, or "file -new", and implicit new due to file open. The isOpeningFile() method can be used in conjunction with isNewingFile() to determine if a "new" operation is currently being performed on behalf of an "open" operation. The following table lists how the isNewingFile() and isOpeningFile() to determine the current state: <p> <table> <tr> <td></td> <td>isNewingFile() returns false</td> <td>isNewingFile() returns true</td> </tr> <tr> <td>isOpeningFile() returns false</td> <td>Maya is neither in new or open</td> <td>Maya is perfroming an explicit new (a File>New, or file -new)</td> </tr> <tr> <td>isOpeningFile() returns true</td> <td>Maya is opening a file, and is not currently performing a new</td> <td>Maya is opening a file and is performing a new on behalf of the open</td> </tr> </table> <p> Based on the above table, it is easy to see how the four distinct states can easily be detected.

Return Value

  • true if maya is currently in the process of a new operation.
  • false if maya is not currently in new.

bool MFileIO:: isOpeningFile ()

Description

Determine if Maya is currently performing a file open operation.

This condition differs from isReadingFile() which is only true when were are actually reading the contents of the file from disk. In contrast, isOpeningFile() will be true during the pre-read operations such as the new operation to delete the current scene contents as well as post read-operations.

The isOpeningFile() method can be used in conjunction with isNewingFile() to determine if a "new" operation is currently being performed on behalf of an "open" operation.

Maya performs two types of "new" operations: explicit new on account of a File>New, or "file -new", and implicit new due to file open. The isOpeningFile() method can be used in conjunction with isNewingFile() to determine if a "new" operation is currently being performed on behalf of an "open" operation. The following table lists how the isNewingFile() and isOpeningFile() to determine the current state: <p> <table> <tr> <td></td> <td>isNewingFile() returns false</td> <td>isNewingFile() returns true</td> </tr> <tr> <td>isOpeningFile() returns false</td> <td>Maya is neither in new or open</td> <td>Maya is perfroming an explicit new (a File>New, or file -new)</td> </tr> <tr> <td>isOpeningFile() returns true</td> <td>Maya is opening a file, and is not currently performing a new</td> <td>Maya is opening a file and is performing a new on behalf of the open</td> </tr> </table> <p> Based on the above table, it is easy to see how the four distinct states can easily be detected.

Return Value

  • true if maya is currently in the process of opening a file
  • false if maya is not currently opening a file

bool MFileIO:: mustRenameToSave ( MStatus *ReturnStatus )

Description

Scenes may be flagged as needing to be renamed before saving. The purpose is to prevent overwriting the original file, which may have had a significant change. Users will need to use save as to save the scene with a different file name.

This method returns true if the scene must be renamed before it can be saved.

Arguments

  • ReturnStatus The status.

Return Value

  • true if this file must be renamed before saving.

Status Codes

  • MS::kSuccess Operation succeeded
  • MS::kFailure Operation failed

MStatus MFileIO:: setMustRenameToSave (bool rename)

Description

This method enabled or disables a state where the current Maya scene must save to a different file name. This can be used to prevent a user from overwriting the original scene if a particularly dangerous or experimental change was made.

If enabled, the user must use save as to save the scene to a different name.

Once the file is renamed, this state is cleared and the file may be saved.

Arguments

  • bool rename true, if the scene should be saved to a different name.

Return Value

  • Return Status

Status Codes

  • MS::kSuccess operation succeeded
  • MS::kFailure operation failed

MString MFileIO:: mustRenameToSaveMsg ( MStatus *ReturnStatus )

Description

This method returns a string that is displayed when a user attempts to save a scene that was set to not overwrite itself. See the MFileIO::setMustRenameToSave() documentation.

If a custom message was not set, this method will return an empty string.

Arguments

  • ReturnStatus status

Return Value

  • The error message to display.

Status Codes

  • MS::kSuccess Operation succeeded
  • MS::kFailure Operation failed

MStatus MFileIO:: setMustRenameToSaveMsg (const MString &errorMsg)

Description

This method sets a string that is displayed when a user attempts to save a scene that was set to not overwrite itself. See the MFileIO::setMustRenameToSave() documentation.

To use the default error message, pass an empty string to this method.

Arguments

  • errorMsg The message to display when attempting a file save.

Return Value

  • Return Status

Status Codes

  • MS::kSuccess Operation successful
  • MS::kFailure Operation failed

MString MFileIO:: beforeOpenFilename ( MStatus * ReturnStatus)

Description

Retrieves the name of the file requested to be opened. This name can be retrieved from within the beforeOpen callback function before the file is loaded. Valid results are returned when this function is called after a user attempts to open a file.

Arguments

  • ReturnStatus Status code

Return Value

  • The name of the file to be opened

Status Codes

  • MS::kSuccess Operation succeeded
  • MS::kFailure Error in retrieving the file name.

MString MFileIO:: beforeImportFilename ( MStatus * ReturnStatus)

Description

Retrieves the name of the file requested to be imported. This name can be retrieved from within the beforeImport callback function before the file is loaded. Valid results are returned when this function is called after a user attempts to import a file.

Arguments

  • ReturnStatus Status code

Return Value

  • The name of the file to be imported

Status Codes

  • MS::kSuccess Operation succeeded
  • MS::kFailure Error in retrieving the file name.

MString MFileIO:: beforeSaveFilename ( MStatus * ReturnStatus)

Description

Retrieves the name of the file requested to be saved. This name can be retrieved from within the beforeSave callback function that must be registered using MSceneMessage::addCallback() before the file is loaded. Valid results are returned when this function is called after a user attempts to save a file.

Arguments

  • ReturnStatus Status code

Return Value

  • The name of the file to be saved

Status Codes

  • MS::kSuccess Operation succeeded
  • MS::kFailure Error in retrieving the file name.

MString MFileIO:: beforeExportFilename ( MStatus * ReturnStatus)

Description

Retrieves the name of the file requested to be exported. This name can be retrieved from within the beforeExport callback function that must be registered using MSceneMessage::addCallback() before the file is loaded. Valid results are returned when this function is called after a user attempts to exports a file.

Arguments

  • ReturnStatus Status code

Return Value

  • The name of the file to be exported

Status Codes

  • MS::kSuccess Operation succeeded
  • MS::kFailure Error in retrieving the file name.

MString MFileIO:: beforeReferenceFilename ( MStatus * ReturnStatus)

Description

Retrieves the name of the file requested to be referenced. This name can be retrieved from within the beforeRefence callback function that must be registered using MSceneMessage::addCallback() before the file is attempted to be referenced.

Arguments

  • ReturnStatus Status code

Return Value

  • The name of the file to be referenced

Status Codes

  • MS::kSuccess Operation succeeded
  • MS::kFailure Error in retrieving the file name.

MString MFileIO:: getLastTempFile ( MStatus * ReturnStatus)

Description

Returns the temp file used during file save.

Arguments

  • ReturnStatus Status code

Return Value

  • The name of the temp file

Status Codes

  • MS::kSuccess Operation succeeded
  • MS::kFailure Error in retrieving the file name.

bool MFileIO:: getErrorStatus ( MStatus * ReturnStatus)

Description

Returns the error status of the last file read. Returns true if any error occurred during the last file read, else false is returned.

Arguments

  • ReturnStatus Status code

Return Value

  • Boolean value indicating the error status.

Status Codes

  • MS::kSuccess Operation succeeded
  • MS::kFailure Error in retrieving the file name.

MStatus MFileIO:: resetError ()

Description

Resets the error.

Arguments

Return Value

  • MS::kSuccess Operation succeeded
  • MS::kFailure Error in retrieving the file name.

MString MFileIO:: loadReference (const MString & referenceFileName, MStatus *returnStatus)

Description

Loads the reference, referenced by the given reference node name and file name.

Arguments

  • referenceFileName MString containing the name of the reference file.
  • keepRefNodes Boolean indicating whether reference nodes needs to be kept. Default is false.
  • useDefaultNamespace Boolean to indicate whether the default name space to be used. Default is false.

Return Value

  • The name of the loaded reference file

  • MS::kSuccess Operation succeeded
  • MS::kFailure Error in loading the reference.

MString MFileIO:: loadReferenceByNode (const MString & referenceNodeName, MStatus *returnStatus)

Description

Loads the reference, referenced by the given reference node name.

Arguments

  • referenceNode MString, name of the reference node.
  • returnStatus Status of the operation.

Return Value

  • The name of the loaded reference file

  • MS::kSuccess Operation succeeded
  • MS::kFailure Error in loading the reference.

MString MFileIO:: loadReferenceByNode ( MObject & referenceNode, MStatus *returnStatus)

Description

Loads the reference, referenced by the given reference node object.

Arguments

  • referenceNode MObject of the reference node.
  • returnStatus Status of the operation.

Return Value

  • The name of the loaded reference file

  • MS::kSuccess Operation succeeded
  • MS::kFailure Error in loading the reference.

MString MFileIO:: unloadReference (const MString & referenceFileName, MStatus *returnStatus)

Description

Unloads the reference, referenced by the given reference node and file.

Arguments

  • referenceFileName MString containing the name of the reference file.
  • returnStatus Status of the operation.

Return Value

  • The name of the unloaded reference file

  • MS::kSuccess Operation succeeded
  • MS::kFailure Error in unloading the reference.

MString MFileIO:: unloadReferenceByNode (const MString & referenceNodeName, MStatus *returnStatus)

Description

Unloads the reference, referenced by the given reference node.

Arguments

  • referenceNodeName MString containing the name of the reference node.
  • returnStatus Status of the operation.

Return Value

  • The name of the unloaded reference file

  • MS::kSuccess Operation succeeded
  • MS::kFailure Error in unloading the reference.

MString MFileIO:: unloadReferenceByNode ( MObject & referenceNode, MStatus *returnStatus)

Description

Unloads the reference, referenced by the given reference node.

Arguments

  • referenceNodeName MObject containing the reference node.
  • returnStatus Status of the operation.

Return Value

  • The name of the unloaded reference file

  • MS::kSuccess Operation succeeded
  • MS::kFailure Error in unloading the reference.

MString MFileIO:: getReferenceFileByNode ( MObject & referenceNode, MStatus *returnStatus)

Description

Returns the name of the reference file, which contains the given reference node.

Arguments

  • referenceNode MObject containing the reference node.
  • returnStatus Status of the operation.

Return Value

  • The name of the reference file, containing the given node.

  • MS::kSuccess Operation succeeded
  • MS::kFailure

MStatus MFileIO:: cleanReference (const MString & referenceNodeName, const char* editCommand, MStatus *returnStatus)

Description

This function removes the edits from the passed in reference node. The reference must be in an unloaded state.

Arguments

  • referenceNodeName Name of the reference node.
  • editCommand Name of the edit command to be cleaned.
  • returnStatus Status of the operation.

Return Value

  • Status code.

  • MS::kSuccess Operation succeeded
  • MS::kFailure

MStatus MFileIO:: saveReference (const MString & referenceFileName, MStatus *returnStatus)

Description

This function saves reference node edits and connections to reference file

Arguments

  • referenceFileName Name of the reference file.
  • returnStatus Status of the operation.

Return Value

  • Status code.

  • MS::kSuccess Operation succeeded
  • MS::kFailure

MString MFileIO:: fileCurrentlyLoading ()

Description

Return the name of the file currently being loaded.

Return Value

  • An MString containing the name of the file being loaded. An empty string if no load is taking place.

This class has no child classes.


Autodesk® Maya® 2008 © 1997-2007 Autodesk, Inc. All rights reserved. doc++ Copyright