ジャンプ先: 概要. 戻り値. キーワード. 関連. フラグ. Python 例.
referenceQuery([child=boolean], [dagPath=boolean], [editAttrs=boolean], [editCommand=string], [editNodes=boolean], [editStrings=boolean], [failedEdits=boolean], [filename=boolean], [isExportEdits=boolean], [isLoaded=boolean], [isNodeReferenced=boolean], [isPreviewOnly=boolean], [liveEdits=boolean], [namespace=boolean], [nodes=boolean], [onReferenceNode=string], [parent=boolean], [parentNamespace=boolean], [referenceNode=boolean], [shortName=boolean], [showDagPath=boolean], [showFullPath=boolean], [showNamespace=boolean], [successfulEdits=boolean], [topReference=boolean], [unresolvedName=boolean], [withoutCopyNumber=boolean])
注: オブジェクトの名前と引数を表す文字列は、カンマで区切る必要があります。これはシノプシスに示されていません。
referenceQuery は、取り消し不可能、照会不可能、および編集不可能です。
このコマンドを使用して、リファレンスと参照されたノードに関する情報を検索します。有効なターゲットは、リファレンス ノード、リファレンス ファイル、参照されたノードのいずれかです。一部のフラグはターゲットを必要としません。フラグの効果の詳細については、フラグの説明を参照してください。シーンが複数レベルのファイル リファレンスを含む場合、ネストしたリファレンスに影響する編集は、複数のリファレンス ノードに格納される場合があります。例: A.ma は B.ma を参照し、B.ma はポリゴン球(pSphere1)を含む C.ma を参照すると仮定します。B.ma を開いて球を移動した場合、編集は「C:pSphere1」という名のノードを参照する CRN に格納されます。A.ma を開いて球をペアレント化した場合、編集は「B:C:pSphere1」という名のノードを参照する BRN に格納されます。ネストしたリファレンスに影響する編集を照会する場合、編集は適用時と同じフォーマットで返されるので、注意してください。上記例では、A.ma を開いて C.ma に影響するすべての編集を照会すると、「B:C:pSphere1」に作用する親編集と「C:pSphere1」に影響する setAttr 編集の 2 つの編集を返します。しかし C:pSphere1 という名前のノードはもう存在しないため(存在するのは B:C:pSphere1)、返された情報の解釈には注意が必要です。参照された DAG ノードをペアレント化またはインスタンス化した場合にも、同様の注意が必要です。上記例で、A.ma を開き、pSphere1 をペアレント化する代わりにインスタンス化したと仮定します。A.ma を開いた状態で、紛らわしい「B:C:pSphere1」という名前が、「|B:C:pSphere1」と「group1|B:C:pSphere1」に置換されます。しかし C.ma に影響する編集を照会しても、「C:pSphere1」に影響する setAttr 編集は B:C:pSphere1 のインスタンス化の前に適用されているため、この編集を返します。ヒント: 1. -topReference フラグを使用して、現在開いているファイルから適用された編集のみを照会します。2. -onReferenceNode フラグを使用して、結果を特定のリファレンス ノードに格納された編集のみに制限します。文字列の各種操作方法を使用して、影響を受けたノードの現在の名前を補外することができます。
reference, attribute, node
file, referenceEdit
child, dagPath, editAttrs, editCommand, editNodes, editStrings, failedEdits, filename, isExportEdits, isLoaded, isNodeReferenced, isPreviewOnly, liveEdits, namespace, nodes, onReferenceNode, parent, parentNamespace, referenceNode, shortName, showDagPath, showFullPath, showNamespace, successfulEdits, topReference, unresolvedName, withoutCopyNumber
フラグはコマンドの作成モードで表示できます
|
フラグはコマンドの編集モードで表示できます
|
フラグはコマンドの照会モードで表示できます
|
フラグに複数の引数を指定し、タプルまたはリストとして渡すことができます。
|
import maya.cmds as cmds
# Build a sample scene:
# main scene contains a reference to mid.ma.
# mid.ma contains a reference to bot.ma.
# Create bot.ma with a poly sphere.
#
cmds.polySphere()
cmds.file( rename='bot.ma' )
cmds.file( f=True, s=True, type='mayaAscii')
# Create mid.ma with a poly cone.
# Reference bot.ma into mid.ma and group
# the sphere in bot.ma
#
cmds.file( f=True, new=True )
cmds.file( 'bot.ma', r=True,ns='bot' )
cmds.polyCone()
cmds.group( 'bot:pSphere1' )
cmds.file( rename='mid.ma' )
cmds.file( f=True, s=True, type='mayaAscii')
# Create a poly plane.
# Reference mid.ma into the main scene,
# move the cone in mid.ma, and connect
# the plane to the sphere in bot.ma.
#
cmds.file( f=True, new=True )
cmds.file( 'mid.ma', r=True, ns='mid' )
cmds.select( 'mid:pCone1', r=True )
cmds.move( 5, 5, 5, r=True )
cmds.polyPlane()
cmds.connectAttr( 'pPlane1.ty', 'mid:bot:polySphere1.radius' )
# Now perform some queries:
#
cmds.referenceQuery( 'midRN',filename=True )
# Result: C:/Documents and Settings/user/My Documents/maya/projects/default/scenes/mid.ma
cmds.referenceQuery( 'mid:pCone1', filename=True, shortName=True )
# Result: mid.ma
cmds.referenceQuery( 'mid:botRN', filename=True, parent=True )
# Result: C:/Documents and Settings/user/My Documents/maya/projects/default/scenes/mid.ma
cmds.referenceQuery( 'mid.ma', referenceNode=True )
# Result: midRN
cmds.referenceQuery( 'C:/Documents and Settings/user/My Documents/maya/projects/default/scenes/bot.ma', referenceNode=True)
# Result: mid:botRN
cmds.referenceQuery( 'bot.ma', referenceNode=True, parent=True )
# Result: midRN
cmds.referenceQuery( 'bot.ma', referenceNode=True, topReference=True )
# Result: midRN
cmds.referenceQuery( 'mid:botRN',nodes=True )
# Result:[u'mid:bot:pPlane1', u'mid:bot:pPlaneShape1', u'mid:bot:outputCloth1', u'mid:bot:nCloth1', u'mid:bot:nClothShape1', u'mid:bot:dynamicConstraint1', u'mid:bot:dynamicConstraintShape1', u'mid:bot:nurbsSphere1', u'mid:bot:nurbsSphereShape1', u'mid:bot:pSphere1', u'mid:bot:pSphereShape1', u'mid:bot:lightLinker1', u'mid:bot:layerManager', u'mid:bot:defaultLayer', u'mid:bot:renderLayerManager', u'mid:bot:defaultRenderLayer', u'mid:bot:polyPlane1', u'mid:bot:nucleus1', u'mid:bot:nComponent1', u'mid:bot:uiConfigurationScriptNode', u'mid:bot:sceneConfigurationScriptNode', u'mid:bot:nClothShape1Cache1Start', u'mid:bot:cacheBlend1', u'mid:bot:nClothShape1Cache2', u'mid:bot:nClothShape1Cache1End', u'mid:bot:makeNurbSphere1', u'mid:bot:polySphere1'] #
cmds.referenceQuery( 'pPlane1', isNodeReferenced=True )
# Result: 0
cmds.referenceQuery( 'mid:pCone1', isNodeReferenced=True )
# Result: 1
cmds.referenceQuery( 'mid:botRN', parentNamespace=True )
# Result: mid
cmds.referenceQuery( 'mid:bot:pSphere1', parentNamespace=True )
# Result: mid
cmds.referenceQuery( 'C:/Documents and Settings/user/My Documents/maya/projects/default/scenes/bot.ma', parentNamespace=True )
# Result: mid
print cmds.referenceQuery( 'bot.ma', namespace=True )
# Result: :mid:bot
print cmds.referenceQuery( 'mid:botRN', namespace=True )
# Result: :mid:bot
print cmds.referenceQuery( 'bot.ma', namespace=True, shortName=True )
# Result: bot
print cmds.referenceQuery( 'mid.ma', namespace=True )
# Result: :mid
print cmds.referenceQuery( 'mid.ma', namespace=True, shortName=True )
# Result: mid