Go to: Synopsis. Return value. Keywords. Flags. Python examples.

Synopsis

filePathEditor([force=boolean], [listDirectories=string], [listFiles=string], [nodeType=string], [preview=boolean], [recursive=boolean], [refresh=boolean], [registeredNodeTypes=boolean], [repath=string], [status=boolean], [typeLabel=string], [withNode=boolean])

Note: Strings representing object names and arguments must be separated by commas. This is not depicted in the synopsis.

filePathEditor is undoable, queryable, and NOT editable.

Maya scene can reference and use external files, for example, texture files, reference other Maya scene files. This command is used to get information about files used in Maya scene. Now four kind of file types are supported: texture file, reference file, audio and image plane file. This command can list directories that contain files used by Maya and list files in each directory. This command can remap files to resolve the files in Maya scene. By specifying a target directory, the old file path can be replaced with the new path.

Return value

None

In query mode, return type is based on queried flag.

Keywords

filepath, editor, repath

Flags

force, listDirectories, listFiles, nodeType, preview, recursive, refresh, registeredNodeTypes, repath, status, typeLabel, withNode
Long name (short name) Argument types Properties
registeredNodeTypes(rnt) boolean query
Query supported Maya node types. This command only processes file paths for supported Maya nodes.
typeLabel(tl) string query
Return localized string label of the specified node type

In query mode, this flag needs a value.

nodeType(nt) string query
Query the type of the node that is associated with a specified file.
status(s) boolean query
Query the existence of a file or files under a directory. Used with flag "listDirectories" and "listFiles". For directory, its status depends on the files directly under it, not related to the files under its subdirectory. There are three status: 0 - file is nonexistent; for directory, the directory is nonexistent or all files under it are nonexistent; 1 - file exists; for directory, all files under it exist; 2 - only for directory. Some files under this directory exist, some are nonexistent.
listDirectories(ld) string query
List all subdirectories that contain files under one directory. If pass an empty string, all directories that contain files are returned.

In query mode, this flag needs a value.

listFiles(lf) string query
List files under one directory. Using flag "listDirectories" to get directory that contains files.

In query mode, this flag needs a value.

withNode(wn) boolean query
Used with flag "listFiles" to return Maya node name that associated with the file. For example, if stone.jpg is connected to node "file1", then the string returned is an ordered pair : "stone.jpg file1".
refresh(rf) boolean create
The information returned by this command will not be automatically refreshed as the scene is modified (although it will be cleared on file new). The refresh flag is used to clear the current path information so that it will be refreshed the next time the command is invoked.
repath(r) string create
Specify the new directory path to map files to.
preview(p) boolean create
Used with flag "repath". Return the status which indicating the existence of the file and the new file path after repathing. The status and the path name will be listed in pairs.
recursive(rc) boolean create
Used with flag "repath". Search files in the remapping target directory and its subdirectories recursively. If it is on, only remap files if file with same name can be found in the target path and its subdirectories. If it is off, remap old file paths with the target path, i.e., simply replace the old file paths with target path.
force(f) boolean create
Used with flag "repath". Specify to do remap for all files, including existing resolved files. If it is off, only remap missing files. Default is off.

Flag can appear in Create mode of command Flag can appear in Edit mode of command
Flag can appear in Query mode of command Flag can have multiple arguments, passed either as a tuple or a list.

Python examples

import maya.cmds as cmds

#List all directories that include files that are used in Maya scene.
#
cmds.filePathEditor(query=True, listDirectories="")
#List all directories that include files that are used in Maya scene
#under specified directory.
#"status" flag will return the status if the files directly under this
#directory exist or are missing.
#
cmds.filePathEditor(query=True, listDirectories="c:/textures/", status=True)
#List files used in Maya scene under the specified directory directly.
#
cmds.filePathEditor(query=True, listFiles="c:/textures/")
#List files under specified directory directly.
#"withNode" flag will return associated Maya node.
#"status" flag will return status to indicate if the file
#exists or is missing.
#For example, if "stone.jpg" exists and is connected to node "file1",
#then the string returned is an ordered pair: "stone.jpg file1 1".
#
cmds.filePathEditor(query=True, listFiles="c:/textures/", withNode=True, status=True)
#Return localized string of registered node type: audio, file,
#reference and imagePlane.
#
cmds.filePathEditor(query=True, typeLabel="imagePlane")
#Currently, we support four kind of file types:
#file(type of texture), reference, audio and imagePlane.
#This flag returns above four types.
#
cmds.filePathEditor(query=True, registeredNodeTypes=True)
#Query the node type of the Maya node, i.e., which kind of file
#the node is associated to.
#This returns one of the types: file(type of texture), reference,
#audio or imagePlane.
#
cmds.filePathEditor("file1", query=True, nodeType=True)
#Refresh all file path information collected from Maya scene.
#
cmds.filePathEditor(refresh=True)
#Get associated files used by the specified Maya nodes, and
#find and remap files in the new path.
#"force" means to remap all specified files.
#"recursive" means to find files in the new path and its subdirectory
#recursively. That is, only remap old file to existent new file with
#same file name.
#
cmds.filePathEditor("file1", "file2", repath="e:/textures/",
						force=True, recursive=True)
#Get associated files used by the specified Maya nodes, and
#remap missing files to the new path.
#
cmds.filePathEditor("file1", "file2", repath="e:/textures/")
#With the "preview" flag, only return the remap result, but do not do
#the remap.
#The result involves the file name and its status flag indicating if the file
#exists. They are listed in pairs.
#
cmds.filePathEditor("file1", "file2", repath="e:/textures/", preview=True)