pymel.core.system

Functions and classes relating to files, references, and system calls.

In particular, the system module contains the functionality of maya.cmds.file. The file command should not be imported into the default namespace because it conflicts with python’s builtin file class. Since the file command has so many flags, we decided to kill two birds with one stone: by breaking the file command down into multiple functions – one for each primary flag – the resulting functions are more readable and allow the file command’s functionality to be used directly within the pymel namespace.

for example, instead of this:

>>> expFile = cmds.file( '/var/tmp/test.ma', exportAll=1, preserveReferences=1, type='mayaAscii', force=1 )

you can do this:

>>> expFile = exportAll( '/var/tmp/test.ma', preserveReferences=1, force=1)
>>> expFile
Path('/var/tmp/test.ma')

some of the new commands were changed slightly from their flag name to avoid name clashes and to add to readability:

>>> importFile( expFile )  # flag was called import, but that's a python keyword
>>> createReference( expFile )
FileReference(u'testRN', u'/var/tmp/test.ma')

Also, note that the ‘type’ flag is set automatically for you when your path includes a ‘.mb’ or ‘.ma’ extension.

Functions

assignInputDevice This command associates a command string (i.e.
attachDeviceAttr This command associates a device/axis pair with a node/attribute pair.
attrCompatibility This command is used to handle compatibility issues between file format versions by providing a mechanism to describe differences between two versions.
cacheFile Creates one or more cache files on disk to store attribute data for a span of frames.
cacheFileCombine Creates a cacheBlend node that can be used to combine, layer or blend multiple cacheFiles for a given object.
cacheFileMerge If selected/specified caches can be successfully merged, will return the start/end frames of the new cache followed by the start/end frames of any gaps in the merged cache for which no data should be written to file.
cacheFileTrack This command is used for inserting and removing tracks related to the caches displayed in the trax editor.
clearCache Even though dependency graph values are computed or dirty they may still occupy space temporarily within the nodes.
cmdFileOutput This command will open a text file to receive all of the commands and results that normally get printed to the Script Editor window or console. The file will stay open until an explicit -close with the correct file descriptor or a -closeAll, so care should be taken not to leave a file open. To enable logging to commence as soon as Maya starts up, the environment variable MAYA_CMD_FILE_OUTPUT may be specified prior to launching Maya. Setting MAYA_CMD_FILE_OUTPUT to a filename will create and output to that given file. To access the descriptor after Maya has started, use the -query and -open flags together.
convertUnit This command converts values between different units of measure.
createReference
  • Create a reference to the specified file. Returns the name of the file referenced.Query all file references from the specified file.
date Returns information about current time and date.
decorator Decorator for decorators.
detachDeviceAttr This command detaches connections between device axes and node attributes.
deviceEditor This creates an editor for creating/modifying attachments to input devices.
devicePanel This creates a panel containing an editor for creating/modifying attachments to input devices.
dgInfo This command prints information about the DG in a text-oriented manner. The scope of the information printed is the entire graph if the -all flag is used, the nodes/plugs on the command line if they were specified, and the selection list, in that order.
dgdirty The dgdirtycommand is used to force a dependency graph dirty message on a node or plug.
dgeval The dgevalcommand is used to force a dependency graph evaluate of a node or plug.
dgtimer This command measures dependency graph node performance by managing timers on a per-node basis.
dirmap Use this command to map a directory to another directory.
diskCache Command to create, clear, or close disk cache(s).
displayString Assign a string value to a string identifier.
dynamicLoad Dynamically load the DLL passed as argument. In query mode, return type is based on queried flag.
exportAll
  • Export everything into a single file. Returns the name of the exported file.
exportAnim
  • Export all animation nodes and animation helper nodes from all objects in the scene. The resulting animation export file will contain connections to objects that are not included in the animation file. As a result, importing/referencing this file back in will require objects of the same name to be present, else errors will occur. The -sns/swapNamespace flag is available for swapping the namespaces of given objects to another namespace. This use of namespaces can be used to re-purpose the animation file to multiple targets using a consistent naming scheme.
exportAnimFromReference
  • Export the main scene animation nodes and animation helper nodes from all referenced objects. This flag, when used in conjunction with the -rfn/referenceNode flag, can be constrained to only export animation nodes from the specified reference file. See -ean/exportAnim flag description for details on usage of animation files.
exportAsReference
  • Export the selected objects into a reference file with the given name. The file is saved on disk during the process. Returns the name of the reference created.
exportSelected
  • Export the selected items into the specified file. Returns the name of the exported file.
exportSelectedAnim
  • Export all animation nodes and animation helper nodes from the selected objects in the scene. See -ean/exportAnim flag description for details on usage of animation files.
exportSelectedAnimFromReference
  • Export the main scene animation nodes and animation helper nodes from the selected referenced objects. This flag, when used in conjunction with the -rfn/referenceNode flag, can be constrained to only export animation nodes from the selected nodes of a specified reference file. See -ean/exportAnim flag description for details on usage of animation files.
fcheck Invokes the fcheck program to display images in a separate window.
feof Reproduces the behavior of the mel command of the same name.
fileBrowserDialog The fileBrowserDialog command offers more control of the windows file browser dialog. See the fileDialog command for cross platform file dialog support.
fileDialog
finder Create, Query, Edit a finder control. Each finder control has a drop icon pocket, an edit line and a history button. The argument defines the name of the finder control. In query mode, return type is based on queried flag.
flushUndo Removes everything from the undo queue, freeing up memory.
fscanf fscanf(inputFile, formatString) -> tuple
getFileList Returns a list of files matching an optional wildcard pattern.
getInputDeviceRange This command lists the minimum and maximum values the device axis can return.
getModifiers This command returns the current state of the modifier keys.
getReferences
hardware Return description of the hardware available in the machine.
hitTest The hitTestcommand hit-tests a point in the named control and returns a list of items underneath the point. The point is specified in pixels with the origin (0,0) at the top-left corner. This position is compatible with the coordinates provided by a drop-callback. The types of items that may be returned depends upon the specific control; not all controls currently support hit-testing.
imfPlugins This command queries all the available imf plugins for its name, keyword or image file extension.
importFile
  • Import the specified file. Returns the name of the imported file.
internalVar This command returns the values of internal variables.
iterReferences returns references in the scene as a list of value tuples. The values in the tuples can be namespaces, refNodes (as PyNodes),
launch Launch the appropriate application to open the document specified.
launchImageEditor Launch the appropriate application to edit/view the image files specified.
listDeviceAttachments This command lists the current set of device attachments.
listInputDeviceAxes This command lists all of the axes of the specified input device.
listInputDeviceButtons This command lists all of the buttons of the specified input device specified as an argument.
listInputDevices This command lists all input devices that maya knows about.
listNamespaces Returns a list of the namespaces of referenced files.
listNamespaces_new Returns a list of the namespaces in the scene
listReferences Like iterReferences, except returns a list instead of an iterator.
loadPlugin Load plug-ins into Maya. The parameter(s) to this command are either the names or pathnames of plug-in files. The convention for naming plug-ins is to use a .so extension on Linux, a .mll extension on Windows and .bundle extension on Mac OS X. MAYA_PLUG_IN_PATH will be searched looking for a file with the given name. If you specified the plug-in without an extension, the appropriate one for the platform will be automatically appended. When the plug-in is loaded, the name used in Maya’s internal plug-in registry for the plug-in information will be the file name with the extension removed. For example, if you load the plug-in newNode.mllthe name used in the Maya’s registry will be newNode. This value as well as that value with either a .so, .mllor .bundleextension can be used as valid arguments to either the unloadPlugin or pluginInfo commands.
loadReference
  • This flag loads a file and associates it with the passed reference node. If the reference node does not exist, the command will fail. If the file is already loaded, then this flag will reload the same file.If a file is not given, the command will load (or reload) the last used reference file.
memory Used to query essential statistics on memory availability and usage
mouse This command allows to configure mouse.
namespace This command allows a namespace to be created or set or removed.
namespaceInfo This command displays information about the current namespace.
newFile
  • Initialize the scene. Returns untitled scene with default location.
openFile
  • Open the specified file. Returns the name of the opened file.
openGLExtension Command returns the extension name depending on whether a given OpenGL extension is supported or not. The input is the extension string to the -extension flag. If the -extension flag is not used, or if the string argument to this flag is an empty string than all extension names are returned in a single string. If the extension exists it is not necessary true that the extension is supported. This command can only be used when a modeling view has been created. Otherwise no extensions will have been initialized and the resulting string will always be the empty string.
openMayaPref Set or query API preferences.
pluginInfo This command provides access to the plugin registry of the application.
preloadRefEd This creates an editor for managing which references will be read in (loaded) and which deferred (unloaded) upon opening a file.
projFileViewer This command creates a viewer that lists the project files in the current working directory.
recordAttr This command sets up an attribute to be recorded.
redo Takes the most recently undone command from the undo list and redoes it.
reference Flags:
referenceEdit Use this command to remove and change the modifications which have been applied to references.
referenceQuery Use this command to find out information about references and referenced nodes.
rehash Derived from mel command maya.cmds.rehash
reloadImage This command reloads an xpm image from disk.
renameFile
  • Rename the scene. Used mostly during save to set the saveAs name. Returns the new name of the scene.
requires This command is used during file I/O to specify the requirements needed to load the given file. It defines what file format version was used to write the file, or what plug-ins are required to load the scene. The first string names a product (either maya, or a plug-in name) The second string gives the version. This command is only useful during file I/O, so users should not have any need to use this command themselves.
saveAs
saveImage This command creates a static image control for non-xpm files used to display a thumbnail image of the scene file.
sceneEditor This creates an editor for managing the files in a scene.
sceneName
  • return the name of the current scene.
sceneUIReplacement This command returns existing scene based UI that can be utilized by the scene that is being loaded. It can also delete any such UI that is not used by the loading scene.
scriptNode scriptNodes contain scripts that are executed when a file is loaded or when the script node is deleted. The scriptNode command is used to create, edit, query, and test scriptNodes. In query mode, return type is based on queried flag.
selLoadSettings This command is used to edit and query information about the implicit load settings.
setAttrMapping This command applies an offset and scale to a specified device attachment.
setInputDeviceMapping The command sets a scale and offset for all attachments made to a specified device axis.
showHelp Invokes a web browser to open the on-line documentation and help files.
suspendReferenceUpdates Original Arguments: (func)
sysFile This command provides a system independent way to create a directory or to rename or delete a file.
timerX Used to calculate elapsed time.
translator Set or query parameters associated with the file translators specified in as the argument.
unassignInputDevice This command deletes all command strings associated with this device.
undo Takes the most recent command from the undo list and undoes it.
undoInfo This command controls the undo/redo parameters.
unloadPlugin Unload plug-ins from Maya. After the successful execution of this command, plug-in services will no longer be available.

Classes

FileInfo store and get custom data specific to this file:
FileReference A class for manipulating references which inherits Path and path. you can create an
Namespace
Path A basic Maya file class. it gets most of its power from the path class written by Jason Orendorff.
ReferenceCache For the sake of speeding up the process of identifying File References in the scene
ReferenceEdit Parses a reference edit command string into various components based on the edit type.
Translator
>>> ascii = Translator('mayaAscii')
Workspace This class is designed to lend more readability to the often confusing workspace command.
WorkspaceEntryDict
path path.py - An object representing a path to a file or directory.

Table Of Contents

Commands

Modules

This Page