ジャンプ先: 概要. 戻り値. 関連項目. フラグ. Python 例.
file( string , [activate=boolean], [activeProxy=boolean], [anyModified=boolean], [applyTo=string], [buildLoadSettings=boolean],
[channels=boolean], [cleanReference=string], [command=[string, string]], [compress=boolean], [constraints=boolean], [constructionHistory=boolean],
[copyNumberList=boolean],
[defaultExtensions=boolean],
[defaultNamespace=boolean],
[deferReference=boolean],
[editCommand=string],
[errorStatus=boolean],
[executeScriptNodes=boolean],
[exists=boolean], [expandName=boolean], [exportAll=boolean], [exportAnim=boolean], [exportAnimFromReference=boolean],
[exportAsReference=boolean],
[exportAsSegment=boolean],
[exportSelected=boolean],
[exportSelectedAnim=boolean],
[exportSelectedAnimFromReference=
boolean], [exportSelectedNoReference=boolean],
[exportUnloadedReferences=boolean],
[expressions=boolean],
[flushReference=string],
[force=boolean], [groupLocator=boolean], [groupName=string], [groupReference=boolean], [i=boolean], [ignoreVersion=boolean], [importReference=boolean],
[lastFileOption=boolean],
[lastTempFile=boolean],
[list=boolean], [loadAllDeferred=boolean],
[loadAllReferences=boolean],
[loadNoReferences=boolean],
[loadReference=string],
[loadReferenceDepth=string],
[loadSettings=string],
[location=boolean], [lockContainerUnpublished=boolean],
[lockFile=boolean], [lockReference=boolean], [mapPlaceHolderNamespace=[string,
string]], [mergeNamespacesOnClash=boolean],
[modified=boolean], [moveSelected=boolean], [namespace=string], [newFile=boolean], [open=boolean], [options=string], [parentNamespace=boolean],
[postSaveScript=string],
[preSaveScript=string],
[preserveName=boolean],
[preserveReferences=boolean],
[prompt=boolean], [proxyManager=string], [proxyTag=string], [reference=boolean], [referenceDepthInfo=uint],
[referenceNode=string],
[removeDuplicateNetworks=boolean],
[removeReference=boolean],
[rename=string], [renameAll=boolean], [renameToSave=boolean], [renamingPrefix=string], [renamingPrefixList=boolean],
[replaceName=[string,
string]], [resetError=boolean], [returnNewNodes=boolean], [save=boolean], [saveDiskCache=string], [saveReference=boolean], [saveReferencesUnloaded=boolean],
[saveTextures=string],
[sceneName=boolean], [segment=string], [selectAll=boolean], [shader=boolean], [sharedNodes=string], [sharedReferenceFile=boolean],
[shortName=boolean], [strict=boolean], [swapNamespace=[string, string]],
[type=string], [uiConfiguration=boolean],
[unloadReference=string],
[unresolvedName=boolean],
[usingNamespaces=boolean],
[withoutCopyNumber=boolean],
[writable=boolean])
注意:
オブジェクト名や引数を表す文字列はカンマで区切ります。これは概要には示されていません。
file は 「元に戻す」が可能、「照会」が可能、「編集」が可能 です。
ファイルのオープン、インポート、エクスポート、参照、保存、名前の変更を行う このコマンドには、実行するアクションを指定するメイン フラグが 1 つ必要です。 一部のメイン フラグには、そのアクションを修正するオプションの 2 次フラグが続くものもあります。 メインフラグを以下に示します。cr | ea | ean | ear | eas | er | esa | es |
esn | ex | fr | i | ir | l | lr | |
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 | ns | rfn | rpr | sns | srf | shd | rnn |
dns | dr | gr | gn | 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) |
boolean |
|||
|
||||
anyModified(amf) |
boolean |
|||
|
||||
buildLoadSettings(bls) |
boolean |
|||
|
||||
command(c) |
[string, string] |
|||
|
||||
constructionHistory(ch) |
boolean |
|||
|
||||
channels(chn) |
boolean |
|||
|
||||
copyNumberList(cnl) |
boolean |
|||
|
||||
constraints(con) |
boolean |
|||
|
||||
cleanReference(cr) |
string |
|||
|
||||
editCommand(ec) |
string |
|||
|
||||
defaultExtensions(de) |
boolean |
|||
|
||||
defaultNamespace(dns) |
boolean |
|||
|
||||
errorStatus(err) |
boolean |
|||
|
||||
deferReference(dr) |
boolean |
|||
|
||||
exportAll(ea) |
boolean |
|||
|
||||
exportAnim(ean) |
boolean |
|||
|
||||
exportSelectedAnim(eas) |
boolean |
|||
|
||||
exportAnimFromReference(
ear) |
boolean |
|||
|
||||
exportAsReference(er) |
boolean |
|||
|
||||
exportSelected(es) |
boolean |
|||
|
||||
exportSelectedAnimFromReference(
esa) |
boolean |
|||
|
||||
executeScriptNodes(esn) |
boolean |
|||
|
||||
exists(ex) |
boolean |
|||
|
||||
expandName(exn) |
boolean |
|||
|
||||
expressions(exp) |
boolean |
|||
|
||||
force(f) |
boolean |
|||
|
||||
flushReference(fr) |
string |
|||
|
||||
groupLocator(gl) |
boolean |
|||
|
||||
groupName(gn) |
string |
|||
|
||||
groupReference(gr) |
boolean |
|||
|
||||
ignoreVersion(iv) |
boolean |
|||
|
||||
lockReference(lck) |
boolean |
|||
|
||||
lockFile(lf) |
boolean |
|||
|
||||
lockContainerUnpublished(
lcu) |
boolean |
|||
|
||||
i(i) |
boolean |
|||
|
||||
importReference(ir) |
boolean |
|||
|
||||
list(l) |
boolean |
|||
|
||||
loadReferenceDepth(lrd) |
string |
|||
|
||||
mergeNamespacesOnClash(
mnc) |
boolean |
|||
|
||||
loadAllDeferred(lad) |
boolean |
|||
|
||||
loadAllReferences(lar) |
boolean |
|||
|
||||
loadNoReferences(lnr) |
boolean |
|||
|
||||
location(loc) |
boolean |
|||
|
||||
loadReference(lr) |
string |
|||
|
||||
loadSettings(ls) |
string |
|||
|
||||
lastTempFile(ltf) |
boolean |
|||
|
||||
modified(mf) |
boolean |
|||
|
||||
newFile(new) |
boolean |
|||
|
||||
namespace(ns) |
string |
|||
|
||||
open(o) |
boolean |
|||
|
||||
options(op) |
string |
|||
|
||||
lastFileOption(lfo) |
boolean |
|||
|
||||
prompt(pmt) |
boolean |
|||
|
||||
parentNamespace(pns) |
boolean |
|||
|
||||
preserveReferences(pr) |
boolean |
|||
|
||||
exportUnloadedReferences(
eur) |
boolean |
|||
|
||||
preSaveScript(prs) |
string |
|||
|
||||
postSaveScript(pos) |
string |
|||
|
||||
proxyManager(pm) |
string |
|||
|
||||
proxyTag(pt) |
string |
|||
|
||||
reference(r) |
boolean |
|||
|
||||
renameAll(ra) |
boolean |
|||
|
||||
referenceDepthInfo(rdi) |
uint |
|||
|
||||
referenceNode(rfn) |
string |
|||
|
||||
rename(rn) |
string |
|||
|
||||
returnNewNodes(rnn) |
boolean |
|||
|
||||
renamingPrefixList(rpl) |
boolean |
|||
|
||||
renamingPrefix(rpr) |
string |
|||
|
||||
removeReference(rr) |
boolean |
|||
|
||||
renameToSave(rts) |
boolean |
|||
|
||||
save(s) |
boolean |
|||
|
||||
saveReference(sr) |
boolean |
|||
|
||||
compress(cmp) |
boolean |
|||
|
||||
preserveName(pn) |
boolean |
|||
|
||||
removeDuplicateNetworks(
rdn) |
boolean |
|||
|
||||
resetError(rer) |
boolean |
|||
|
||||
selectAll(sa) |
boolean |
|||
|
||||
saveDiskCache(sdc) |
string |
|||
|
||||
shader(sh) |
boolean |
|||
|
||||
sharedNodes(shd) |
string |
|||
|
||||
shortName(shn) |
boolean |
|||
|
||||
sceneName(sn) |
boolean |
|||
|
||||
swapNamespace(sns) |
[string, string] |
|||
|
||||
sharedReferenceFile(srf) |
boolean |
|||
|
||||
saveReferencesUnloaded(
sru) |
boolean |
|||
|
||||
strict(str) |
boolean |
|||
|
||||
saveTextures(stx) |
string |
|||
|
||||
type(typ) |
string |
|||
|
||||
uiConfiguration(uc) |
boolean |
|||
|
||||
usingNamespaces(uns) |
boolean |
|||
|
||||
unresolvedName(un) |
boolean |
|||
|
||||
unloadReference(ur) |
string |
|||
|
||||
writable(w) |
boolean |
|||
|
||||
withoutCopyNumber(wcn) |
boolean |
|||
|
||||
segment(seg) |
string |
|||
|
||||
activate(a) |
boolean |
|||
|
||||
exportAsSegment(exs) |
boolean |
|||
|
||||
exportSelectedNoReference(
esr) |
boolean |
|||
|
||||
moveSelected(ms) |
boolean |
|||
|
||||
applyTo(at) |
string |
|||
|
||||
mapPlaceHolderNamespace(
mns) |
[string, string] |
|||
|
||||
replaceName(rep) |
[string, string] |
|||
|
: コマンドの作成モードで使用可能なフラグ | : コマンドの編集モードで使用可能なフラグ |
: コマンドの照会モードで使用可能なフラグ | : タプルまたはリストとして渡された複数の引数を持てるフラグ |
import maya.cmds as cmds # save the current scene to an ascii file named "fred.ma" # cmds.file( rename='fred.ma' ) cmds.file( save=True, type='mayaAscii' ) # save the current scene to an ascii file without the ".ma" extension # cmds.file( rename='tmp' ) cmds.file( save=True, de=False, 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. # cmds.file( 'fred.ma', o=True ) # reference the file wilma.ma # cmds.file( 'C:/mystuff/wilma.mb', r=True ) # reference the file barney.mb into a namespace called "rubble". # cmds.file( 'C:/maya/projects/default/scenes/barney.ma', r=True, type='mayaAscii', namespace='rubble' ) # change the namespace containing barney.mb. # cmds.file( 'C:/maya/projects/default/scenes/barney.ma', e=True, namespace='purpleDinosaur' ) # retrieve a string array of all files referenced in the scene # cmds.file( q=True, l=True ) # 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. # cmds.file( 'c:/mystuff/betty.mb', type='mayaBinary', namespace='rubble', er=True ) # Select all the objects associated with file betty.mb # cmds.file( 'c:/mystuff/betty.mb', sa=True ) # Result: rubble:betty # Remove the reference file betty.mb. All nodes in betty.mb will # be removed from the scene cmds.file( 'c:/mystuff/betty.mb', rr=True ) # Query whether the file named "foo.mb" exists on disk # cmds.file( 'foo.mb', q=True, ex=True ) # Result: 0 # # Query whether the reference node "rubble:betty is deferred loaded. # Note, -rfn flag has to come before -q flag. cmds.file(rfn='rubbleRN', q=True, dr=True ) # Query the last temp file during file save # cmds.file( query=True, lastTempFile=True) ####################################/ #/ Example for the '-buildLoadSettings' and '-loadSettings' flags #/ ####################################/ # Build load settings for "ref.ma" cmds.file( 'ref.ma', o=True, buildLoadSettings=True ) # 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) . # cmds.loadSettings( '2', deferReference=1 ) # Use the edited settings when opening the file cmds.file('ref.ma', o=True, loadSettings='implicitLoadSettings') # # Example for the '-cleanReference' and '-editCommand' flags # # Create a simple reference to a sphere # cmds.file( f=True, new=True ) cmds.polySphere() cmds.file( rename='ref.ma' ) cmds.file( f=True, type='mayaAscii', save=True ) cmds.file( f=True, new=True ) cmds.file( 'ref.ma', r=True, ns='ref' ) # Scale the sphere # cmds.setAttr( 'ref:pSphere1.s', 5, 5, 5 ) cmds.getAttr( 'ref:pSphere1.s' ) # Result: 5 5 5 # # The 'cleanReference' and 'editCommand' flags only work on # unloaded references. # cmds.file( unloadReference='refRN' ) # Query the setAttr edits: # cmds.reference( rfn='refRN', q=True, editCommand=True ) # Result: setAttr ref:pSphere1.s -type "double3" 5 5 5 setAttr ref:lightLinker1.lnk -s 2 # # Remove all setAttr edits on refRN: # cmds.file( cleanReference='refRN', editCommand='setAttr' ) cmds.reference( rfn='refRN', q=True, editCommand=True ) # Note that nothing is returned cmds.file( loadReference='refRN' ) cmds.getAttr( 'ref:pSphere1.s' ) # Result: 1 1 1 # # Note that scale has returned to 1 1 1 # apply the edit file to a reference cmds.file("translateSphere.editMA", r=True, applyTo="refRN") # Result: maps <main> to refRN's namespace # apply the edit file to nodes in the main scene cmds.file("translateSphere.editMA", i=True, applyTo=":") # Result: maps <main> to the root namespace # apply the edit file to a reference, but it also has connections between two refs cmds.file("connectionsBetweenRefs.editMA", r=True, applyTo="refRN", mapPlaceHolderNamespace=("<otherRef>", "otherRefRN")) # Result: maps <main> to refRN's namespace and <otherRef> to otherRefRN's namespace # Change the modified state of the file. cmds.file(modified=True)