ジャンプ先: 概要. 戻り値. 関連. フラグ. MEL 例.
file [-activate] [-activeProxy] [-add] [-anyModified] [-applyTo string] [-buildLoadSettings] [-channels boolean] [-cleanReference string] [-command string string] [-compress] [-constraints boolean] [-constructionHistory boolean] [-copyNumberList] [-defaultExtensions boolean] [-defaultNamespace] [-deferReference boolean] [-editCommand string] [-errorStatus] [-executeScriptNodes boolean] [-exists] [-expandName] [-exportAll] [-exportAnim] [-exportAnimFromReference] [-exportAsReference] [-exportAsSegment] [-exportSelected] [-exportSelectedAnim] [-exportSelectedAnimFromReference] [-exportSelectedNoReference] [-exportUnloadedReferences] [-expressions boolean] [-flushReference string] [-force] [-groupLocator] [-groupName string] [-groupReference] [-ignoreVersion] [-import] [-importReference] [-lastFileOption] [-lastTempFile] [-list] [-loadAllDeferred boolean] [-loadAllReferences] [-loadNoReferences] [-loadReference string] [-loadReferenceDepth string] [-loadReferencePreview string] [-loadSettings string] [-location] [-lockContainerUnpublished boolean] [-lockFile boolean] [-lockReference] [-mapPlaceHolderNamespace string string] [-mergeNamespaceWithParent] [-mergeNamespaceWithRoot] [-mergeNamespacesOnClash] [-modified boolean] [-moveSelected] [-namespace string] [-newFile] [-open] [-options string] [-parentNamespace] [-postSaveScript string] [-preSaveScript string] [-preserveName] [-preserveReferences] [-preview] [-prompt boolean] [-proxyManager string] [-proxyTag string] [-reference] [-referenceDepthInfo uint] [-referenceNode string] [-relativeNamespace string] [-removeDuplicateNetworks] [-removeReference] [-rename string] [-renameAll boolean] [-renameToSave boolean] [-renamingPrefix string] [-renamingPrefixList] [-replaceName string string] [-resetError] [-returnNewNodes] [-save] [-saveDiskCache string] [-saveReference] [-saveReferencesUnloaded] [-saveTextures string] [-sceneName] [-segment string] [-selectAll] [-shader boolean] [-sharedNodes string] [-sharedReferenceFile] [-shortName] [-strict boolean] [-swapNamespace string string] [-type string] [-uiConfiguration boolean] [-unloadReference string] [-unresolvedName] [-usingNamespaces] [-withoutCopyNumber] [-writable]
string
file は、取り消し可能、照会可能、および 編集可能 です。
| cr | ea | ean | ear | eas | er | esa | es |
| esn | ex | fr | i | ir | l | lr | lrp |
| loc | ltf | mf | new | o | op | ot | pmt |
| r | rdi | rn | rr | rts | s | sa | sdx |
| st | stx | typ | uc | ur | w |
| f | lad | lad | lnr | rnn |
| ch | chn | con | exp | sh |
| dns | dr | gr | gl | gn | mnc | ns | rfn | rpr | sns | srf | shd | rnn |
| dns | dr | gr | gn | mnc | pr | ra | rdn | rnn | rpr | sns |
| f |
| ns | rpr |
| f | pr |
| f |
| f | rfn |
| amf | ch | chn | con | dr | err | ex | exn |
| exp | l | loc | ltf | mf | ns | op | ot |
| pmt | pns | r | rfn | rpl | rpr | rts | sdc |
| sh | sn | stx | typ | uc | w |
| rfn |
| un | shn | wcn |
| string | 大部分のアクションでは、指定したファイルの名前です。returnNewNodes フラグを使用すると、読み込まれたノードの名前を示す文字配列が返されます。 |
照会モードでは、戻り値のタイプは照会されたフラグに基づきます。
| ロング ネーム(ショート ネーム) | 引数タイプ | プロパティ | ||
|---|---|---|---|---|
-activeProxy(-ap)
|
|
|
||
|
||||
-anyModified(-amf)
|
|
|
||
|
||||
-buildLoadSettings(-bls)
|
|
|
||
|
||||
-command(-c)
|
string string
|
|
||
|
||||
-constructionHistory(-ch)
|
boolean
|
|
||
|
||||
-channels(-chn)
|
boolean
|
|
||
|
||||
-copyNumberList(-cnl)
|
|
|
||
|
||||
-constraints(-con)
|
boolean
|
|
||
|
||||
-cleanReference(-cr)
|
string
|
|
||
|
||||
-editCommand(-ec)
|
string
|
|
||
|
||||
-defaultExtensions(-de)
|
boolean
|
|
||
|
||||
-defaultNamespace(-dns)
|
|
|
||
|
||||
-errorStatus(-err)
|
|
|
||
|
||||
-deferReference(-dr)
|
boolean
|
|
||
|
||||
-exportAll(-ea)
|
|
|
||
|
||||
-exportAnim(-ean)
|
|
|
||
|
||||
-exportSelectedAnim(-eas)
|
|
|
||
|
||||
-exportAnimFromReference(-ear)
|
|
|
||
|
||||
-exportAsReference(-er)
|
|
|
||
|
||||
-exportSelected(-es)
|
|
|
||
|
||||
-exportSelectedAnimFromReference(-esa)
|
|
|
||
|
||||
-executeScriptNodes(-esn)
|
boolean
|
|
||
|
||||
-exists(-ex)
|
|
|
||
|
||||
-expandName(-exn)
|
|
|
||
|
||||
-expressions(-exp)
|
boolean
|
|
||
|
||||
-force(-f)
|
|
|
||
|
||||
-flushReference(-fr)
|
string
|
|
||
|
||||
-groupLocator(-gl)
|
|
|
||
|
||||
-groupName(-gn)
|
string
|
|
||
|
||||
-groupReference(-gr)
|
|
|
||
|
||||
-ignoreVersion(-iv)
|
|
|
||
|
||||
-lockReference(-lck)
|
|
|
||
|
||||
-lockFile(-lf)
|
boolean
|
|
||
|
||||
-lockContainerUnpublished(-lcu)
|
boolean
|
|
||
|
||||
-import(-i)
|
|
|
||
|
||||
-importReference(-ir)
|
|
|
||
|
||||
-list(-l)
|
|
|
||
|
||||
-loadReferenceDepth(-lrd)
|
string
|
|
||
|
||||
-mergeNamespacesOnClash(-mnc)
|
|
|
||
|
||||
-mergeNamespaceWithParent(-mnp)
|
|
|
||
|
||||
-mergeNamespaceWithRoot(-mnr)
|
|
|
||
|
||||
-loadAllDeferred(-lad)
|
boolean
|
|
||
|
||||
-loadAllReferences(-lar)
|
|
|
||
|
||||
-loadNoReferences(-lnr)
|
|
|
||
|
||||
-location(-loc)
|
|
|
||
|
||||
-loadReference(-lr)
|
string
|
|
||
|
||||
-loadReferencePreview(-lrp)
|
string
|
|
||
|
||||
-loadSettings(-ls)
|
string
|
|
||
|
||||
-lastTempFile(-ltf)
|
|
|
||
|
||||
-modified(-mf)
|
boolean
|
|
||
|
||||
-newFile(-new)
|
|
|
||
|
||||
-namespace(-ns)
|
string
|
|
||
|
||||
-open(-o)
|
|
|
||
|
||||
-options(-op)
|
string
|
|
||
|
||||
-lastFileOption(-lfo)
|
|
|
||
|
||||
-preview(-pv)
|
|
|
||
|
||||
-prompt(-pmt)
|
boolean
|
|
||
|
||||
-parentNamespace(-pns)
|
|
|
||
|
||||
-preserveReferences(-pr)
|
|
|
||
|
||||
-exportUnloadedReferences(-eur)
|
|
|
||
|
||||
-preSaveScript(-prs)
|
string
|
|
||
|
||||
-postSaveScript(-pos)
|
string
|
|
||
|
||||
-proxyManager(-pm)
|
string
|
|
||
|
||||
-proxyTag(-pt)
|
string
|
|
||
|
||||
-reference(-r)
|
|
|
||
|
||||
-renameAll(-ra)
|
boolean
|
|
||
|
||||
-referenceDepthInfo(-rdi)
|
uint
|
|
||
|
||||
-referenceNode(-rfn)
|
string
|
|
||
|
||||
-rename(-rn)
|
string
|
|
||
|
||||
-returnNewNodes(-rnn)
|
|
|
||
|
||||
-renamingPrefixList(-rpl)
|
|
|
||
|
||||
-renamingPrefix(-rpr)
|
string
|
|
||
|
||||
-removeReference(-rr)
|
|
|
||
|
||||
-renameToSave(-rts)
|
boolean
|
|
||
|
||||
-save(-s)
|
|
|
||
|
||||
-saveReference(-sr)
|
|
|
||
|
||||
-compress(-cmp)
|
|
|
||
|
||||
-preserveName(-pn)
|
|
|
||
|
||||
-removeDuplicateNetworks(-rdn)
|
|
|
||
|
||||
-resetError(-rer)
|
|
|
||
|
||||
-selectAll(-sa)
|
|
|
||
|
||||
-add(-add)
|
|
|
||
|
||||
-saveDiskCache(-sdc)
|
string
|
|
||
|
||||
-shader(-sh)
|
boolean
|
|
||
|
||||
-sharedNodes(-shd)
|
string
|
|
||
|
||||
-shortName(-shn)
|
|
|
||
|
||||
-sceneName(-sn)
|
|
|
||
|
||||
-swapNamespace(-sns)
|
string string
|
|
||
|
||||
-sharedReferenceFile(-srf)
|
|
|
||
|
||||
-saveReferencesUnloaded(-sru)
|
|
|
||
|
||||
-strict(-str)
|
boolean
|
|
||
|
||||
-saveTextures(-stx)
|
string
|
|
||
|
||||
-type(-typ)
|
string
|
|
||
|
||||
-uiConfiguration(-uc)
|
boolean
|
|
||
|
||||
-usingNamespaces(-uns)
|
|
|
||
|
||||
-unresolvedName(-un)
|
|
|
||
|
||||
-unloadReference(-ur)
|
string
|
|
||
|
||||
-writable(-w)
|
|
|
||
|
||||
-withoutCopyNumber(-wcn)
|
|
|
||
|
||||
-segment(-seg)
|
string
|
|||
|
||||
-activate(-a)
|
|
|||
|
||||
-exportAsSegment(-exs)
|
|
|||
|
||||
-exportSelectedNoReference(-esr)
|
|
|||
|
||||
-moveSelected(-ms)
|
|
|
||
|
||||
-applyTo(-at)
|
string
|
|
||
|
||||
-mapPlaceHolderNamespace(-mns)
|
string string
|
|
||
|
||||
-replaceName(-rep)
|
string string
|
|
||
|
||||
-relativeNamespace(-rns)
|
string
|
|
||
|
||||
// save the current scene to an ascii file named "fred.ma"
//
file -rename "fred.ma"; file -save -type "mayaAscii";
// save the current scene to an ascii file without the ".ma" extension
//
file -rename "tmp"; file -save -defaultExtensions 0 -type "mayaAscii";
// open the file fred.ma, using the default load settings. Any references will
// be brought in in the same state they were in when fred.ma was last saved.
//
file -open "fred.ma";
// reference the file wilma.ma
//
file -reference "C:/mystuff/wilma.mb";
// reference the file barney.mb into a namespace called "rubble".
//
file -reference -type "mayaAscii" -namespace "rubble" "C:/maya/projects/default/scenes/barney.ma";
// change the namespace containing barney.mb.
//
file -edit -namespace "purpleDinosaur" "C:/maya/projects/default/scenes/barney.ma";
// retrieve a string array of all files such as main scene and reference files in the scene
//
file -query -list;
// Result: C:/maya/projects/default/scenes/fred.ma C:/mystuff/wilma.mb C:/maya/projects/default/scenes/barney.ma
// Select "betty" and export betty to a separate file called "betty.mb".
// Reference the new betty file into this scene, replacing the
// previous betty object from this scene with the reference to betty.
//
file -type "mayaBinary" -namespace "rubble" -exportAsReference "c:/mystuff/betty.mb";
// Select all the objects associated with file betty.mb
//
file -selectAll "c:/mystuff/betty.mb";
// Result: rubble:betty
// Remove the reference file betty.mb. All nodes in betty.mb will
// be removed from the scene
file -removeReference "c:/mystuff/betty.mb";
// Query whether the file named "foo.mb" exists on disk
//
file -query -exists "foo.mb";
// Result: 0 //
// Query whether the reference node "rubble:betty is deferred loaded.
// Note, -referenceNode flag has to come before -query flag.
file -referenceNode rubble:betty -query -deferReference;
// Query the last temp file during file save
//
file -query -lastTempFile;
/////////////////////////////////////////////////////////////////////////
/// Example for the '-buildLoadSettings' and '-loadSettings' flags ///
/////////////////////////////////////////////////////////////////////////
// Build load settings for "ref.ma"
file -open -buildLoadSettings "ref.ma"
// Edit those settings, to indicate that some reference should
// be brought in unloaded.
// Note: the following command is primarily intended for internal
// use. It may not be easy to determine the numeric ID of a given
// reference ("2" in this case) .
file -loadSettings -edit -deferReference 1 "2"
// Use the edited settings when opening the file
file -open -loadSettings "implicitLoadSettings" "ref.ma";
/////////////////////////////////////////////////////////////////////////
/// Example for the '-cleanReference' and '-editCommand' flags ///
/////////////////////////////////////////////////////////////////////////
// Create a simple reference to a sphere
//
file -force -new;
polySphere;
file -rename "ref.ma";
file -force -type "mayaAscii" -save;
file -force -new;
file -reference -namespace "ref" "ref.ma";
// Scale the sphere
//
setAttr ref:pSphere1.s 5 5 5;
getAttr ref:pSphere1.s;
// Result: 5 5 5 //
// The 'cleanReference' and 'editCommand' flags only work on
// unloaded references.
//
file -unloadReference "refRN";
// Query the setAttr edits:
//
reference -referenceNode "refRN" -query -editCommand;
// Result: setAttr ref:pSphere1.s -type "double3" 5 5 5 setAttr ref:lightLinker1.lnk -s 2 //
// Remove all setAttr edits on refRN:
//
file -cleanReference "refRN" -editCommand "setAttr";
reference -referenceNode "refRN" -query -editCommand;
// Note that nothing is returned
file -loadReference "refRN";
getAttr ref:pSphere1.s;
// Result: 1 1 1 //
// Note that scale has returned to 1 1 1
// apply the edit file to a reference
file -reference -applyTo "refRN" "translateSphere.editMA";
// Result: maps <main> to refRN's namespace
// apply the edit file to nodes in the main scene
file -import -applyTo ":" "translateSphere.editMA";
// Result: maps <main> to the root namespace
// apply the edit file to a reference, but it also has connections between two refs
file -reference -applyTo "refRN" -mapPlaceHolderNamespace "<otherRef>" "otherRefRN" "connectionsBetweenRefs.editMA";
// Result: maps <main> to refRN's namespace and <otherRef> to otherRefRN's namespace
// Change the modified state of the file.
file -modified true;
//Set the file options
file -force -save -options "v=1;p=17" -type "mayaAscii";
//Result:The saved file uses full names for attributes on nodes and flags in command.Also the precision of values in file is 17.
// Load Reference Preview
// Create a nested reference with a child reference under a parent reference.
file -force -new;
polySphere;
file -rename "child.ma";
file -force -type "mayaAscii" -save;
file -force -new;
file -reference -namespace "child_namespace" "child.ma";
file -rename "parent.ma";
file -force -type "mayaAscii" -save;
// Preview the unloaded child reference under the unloaded parent reference.
file -force -new;
file -reference -namespace "parent_namespace" "parent.ma";
file -unloadReference "parent_namespaceRN";
file -loadReferencePreview "parent.ma";
//
// Example for '-mergeNamespacesOnClash'
//
// Create a reference
file -force -new;
namespace -add "bar";
namespace -set "bar";
polySphere;
file -rename "ref.ma";
file - force -type "mayaAscii" -save;
// Create a scene with some namespaces and objects
file -force -new;
namespace -add "ref:foo:bar";
namespace -set "ref:foo:bar";
polySphere;
// Merge into root
file -reference -mergeNamespacesOnClash true -namespace ":" "ref.ma";
// Import and merge into nested namespace
file -import -mergeNamespacesOnClash true -namespace ":ref:foo" "ref.ma";
// Don't merge namespace
file -reference -mergeNamespacesOnClash false -namespace ":ref:foo" "ref.ma";
// Now edit the namespace of the reference and merge it
file -edit -mergeNamespacesOnClash true -namespace ":ref:foo" "ref.ma";