pymel.core.system.FileReference

digraph inheritance4994b45ee5 {
rankdir=TB;
ranksep=0.15;
nodesep=0.15;
size="8.0, 12.0";
  "FileReference" [fontname=Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans,URL="#pymel.core.system.FileReference",style="setlinewidth(0.5)",height=0.25,shape=box,fontsize=8];
}

class FileReference(pathOrRefNode=None, namespace=None, refnode=None, unresolvedPath=None)

A class for manipulating references which inherits Path and path. you can create an instance by supplying the path to a reference file, its namespace, or its reference node to the appropriate keyword. The namespace and reference node of the reference can be retreived via the namespace and refNode properties. The namespace property can also be used to change the namespace of the reference.

Use listRefences command to return a list of references as instances of the FileReference class.

It is important to note that instances of this class will have their copy number stripped off and stored in an _internal variable upon creation. This is to maintain compatibility with the numerous methods inherited from the path class which requires a real file path. When calling built-in methods of FileReference, the path will automatically be suffixed with the copy number before being passed to maya commands, thus ensuring the proper results in maya as well.

clean(**kwargs)

Remove edits from the passed in reference node. The reference must be in an unloaded state. To remove a particular type of edit, use the editCommand flag. If no flag is specified, all edits will be removed.

Flags:
  • editCommand:

    For use with cleanReference. Remove only this type of edit. Supported edits are: setAttr addAttr deleteAttr connectAttr disconnectAttr and parent

Derived from mel command maya.cmds.file

copyNumberList()

When queried, this flag returns a string array containing a number that uniquely identifies each instance the file is used.

Derived from mel command maya.cmds.file

exportAnim(exportPath, **kwargs)

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.

Flags:
  • force:

    Force an action to take place. (new, open, save)

  • referenceNode:

    When queried, this flag returns the name of the reference node associated with the file. If the file is not a reference or does not have a reference node, an empty string is returned. In query mode, this flag can accept a value.

  • type:

    Set the type of this file. By default this can be any one of: mayaAscii, mayaBinary, mel, OBJ, directory, plug-in, audio, move, EPS, Adobe(R) Illustrator(R), imageplug-ins may define their own types as well.Return a string array of file types that match this file.

Derived from mel command maya.cmds.file

exportSelectedAnim(exportPath, **kwargs)

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.

Flags:
  • force:

    Force an action to take place. (new, open, save)

  • referenceNode:

    When queried, this flag returns the name of the reference node associated with the file. If the file is not a reference or does not have a reference node, an empty string is returned. In query mode, this flag can accept a value.

  • type:

    Set the type of this file. By default this can be any one of: mayaAscii, mayaBinary, mel, OBJ, directory, plug-in, audio, move, EPS, Adobe(R) Illustrator(R), imageplug-ins may define their own types as well.Return a string array of file types that match this file.

Derived from mel command maya.cmds.file

fullNamespace
getReferenceEdits(**kwargs)
referenceQuery -editString -onReferenceNode <self.refNode>
importContents(removeNamespace=False)

Remove the encapsulation of the reference around the data within the specified file. This makes the contents of the specified file part of the current scene and all references to the original file are lost. Returns the name of the reference that was imported.

Derived from mel command maya.cmds.file

isDeferred()

When used in conjunction with the -reference flag, this flag determines if the reference is loaded, or if loading is deferred.C: The default is false.Q: When queried, this flag returns true if the reference is deferred, or false if the reference is not deferred. If this is used with -rfn/referenceNode, the -rfn flag must come before -q.

Derived from mel command maya.cmds.file

isLoaded()

When used in conjunction with the -reference flag, this flag determines if the reference is loaded, or if loading is deferred.C: The default is false.Q: When queried, this flag returns true if the reference is deferred, or false if the reference is not deferred. If this is used with -rfn/referenceNode, the -rfn flag must come before -q.

Derived from mel command maya.cmds.file

isUsingNamespaces()

Returns boolean. Queries whether the specified reference file uses namespaces or renaming prefixes.

Derived from mel command maya.cmds.file

load(newFile=None, **kwargs)

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.

Flags:
  • loadNoReferences:

    This flag is obsolete and has been replaced witht the loadReferenceDepth flag. When used with the -open flag, no references will be loaded. When used with -import, -reference or -loadReference flags, will load the top-most reference only.

  • loadReferenceDepth:

    Used to specify which references should be loaded. Valid types are all, noneand topOnly, which will load all references, no references and top-level references only, respectively. Must be used with the -open, -import, -reference or -loadReference flags. When noneis used with -loadReference, only path validation is performed. This can be used to replace a reference without triggering reload.

  • returnNewNodes:

    Used to control the return value in open, import, loadReference, and reference operations. It will force file command to return a list of new nodes added to the current scene.

Derived from mel command maya.cmds.file

lock()

Locks attributes and nodes from the referenced file.

Derived from mel command maya.cmds.file

namespace
namespaceExists()

Returns true if the specified namespace exists, false if not.

Derived from mel command maya.cmds.namespace

nodes()

Returns string array. A main flag used to query the contents of the target reference.

Derived from mel command maya.cmds.referenceQuery

path
refNode
remove()

Remove the given file reference from its parent. This will also Remove everything this file references. Returns the name of the file removed.

Derived from mel command maya.cmds.file

removeReferenceEdits(editCommand=None, force=False)
Remove edits from the reference. @param editCommand: If specified, remove only edits of a particular type: addAttr, setAttr, connectAttr, disconnectAttr or parent @param force: Unload the reference if it is not unloaded already
replaceWith(newFile)

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.

Flags:
  • loadNoReferences:

    This flag is obsolete and has been replaced witht the loadReferenceDepth flag. When used with the -open flag, no references will be loaded. When used with -import, -reference or -loadReference flags, will load the top-most reference only.

  • loadReferenceDepth:

    Used to specify which references should be loaded. Valid types are all, noneand topOnly, which will load all references, no references and top-level references only, respectively. Must be used with the -open, -import, -reference or -loadReference flags. When noneis used with -loadReference, only path validation is performed. This can be used to replace a reference without triggering reload.

  • returnNewNodes:

    Used to control the return value in open, import, loadReference, and reference operations. It will force file command to return a list of new nodes added to the current scene.

Derived from mel command maya.cmds.file

selectAll()

Select all the components of this file as well as its child files. Note that the file specified must be one that is already opened in this Maya session.

Derived from mel command maya.cmds.file

subReferences()
unload()

This flag will unload the reference file associated with the passed reference node.

Derived from mel command maya.cmds.file

unlock()

Locks attributes and nodes from the referenced file.

Derived from mel command maya.cmds.file

unresolvedPath()
withCopyNumber()
return the with the copy number at the end

Previous topic

pymel.core.system.FileInfo

Next topic

pymel.core.system.Namespace

Core

Core Modules

Other Modules

This Page