pymel.core.system.importFile

importFile(filepath, **kwargs)

Import the specified file. Returns the name of the imported 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”, “none” and “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 “none” is used with -loadReference, only path validation is performed. This can be used to replace a reference without triggering reload.

  • defaultNamespace:

    Use the default name space for import and referencing. This is an advanced option. If set, then on import or reference, Maya will attempt to place all nodes from the imported or referenced file directly into the root (default) name space, without invoking any name clash resolution algorithms. If the names of any of the new objects already exist in the root namespace, then errors will result. The user of this flag is responsible for creating a name clash resolution mechanism outside of Maya to avoid such errors. Note:This flag is intended only for use with custom file translators written through the API. Use at your own risk.

  • deferReference:

    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.

  • groupReference:

    Used only with the -r or the -i flag. Used to group all the imported/referenced items under a single transform.

  • groupName:

    Used only with the -gr flag. Optionally used to set the name of the transform node that the imported/referenced items will be grouped under.

  • renameAll:

    Only available with -import. If true, rename all newly-created nodes, not just those whose names clash with existing nodes. Only available with -import.

  • renamingPrefix:

    The string to use as a prefix for all objects from this file. This flag has been replaced by -ns/namespace.

  • swapNamespace:

    Can only be used in conjunction with the -r/reference or -i/import flags. This flag will replace any occurrences of a given namespace to an alternate specified namespace. This namespace “swap” will occur as the file is referenced in. It takes in two string arguments. The first argument specifies the namespace to replace. The second argument specifies the replacement namespace. Use of this flag, implicitly enables the use of namespaces and cannot be used with deferReference.

  • 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.

  • preserveReferences:

    When used with the import/export flags this tells the importer/exporter to import/export references as references instead of copies of those references.

Derived from mel command maya.cmds.file

Previous topic

pymel.core.system.imfPlugins

Next topic

pymel.core.system.internalVar

Core

Core Modules

Other Modules

This Page