Go to: Synopsis. Return value. Keywords. Related. Flags. MEL examples.
referenceQuery [-child] [-dagPath] [-editAttrs] [-editCommand string] [-editNodes] [-editStrings] [-failedEdits boolean] [-filename] [-isExportEdits] [-isLoaded] [-isNodeReferenced] [-isPreviewOnly] [-liveEdits] [-namespace] [-nodes] [-onReferenceNode string] [-parent] [-parentNamespace] [-referenceNode] [-shortName] [-showDagPath boolean] [-showFullPath boolean] [-showNamespace boolean] [-successfulEdits boolean] [-topReference] [-unresolvedName] [-withoutCopyNumber]
referenceQuery is NOT undoable, NOT queryable, and NOT editable.
Use this command to find out information about references and referenced nodes. A valid target is either a reference node, a reference file, or a referenced node. Some flags don't require a target, see flag descriptions for more information on what effect this has. When a scene contains multiple levels of file references, those edits which affect a nested reference may be stored on several different reference nodes. For example: A.ma has a reference to B.ma which has a reference to C.ma which contains a poly sphere (pSphere1). If you were to open B.ma and translate the sphere, an edit would be stored on CRN which refers to a node named "C:pSphere1". If you were then to open A.ma and parent the sphere, an edit would be stored on BRN which refers to a node named "B:C:pSphere1". It is important to note that when querying edits which affect a nested reference, the edits will be returned in the same format that they were applied. In the above example, opening A.ma and querying all edits which affect C.ma, would return two edits a parent edit affecting "B:C:pSphere1", and a setAttr edit affecting "C:pSphere1". Since there is currently no node named C:pSphere1 (only B:C:pSphere1) care will have to be taken when interpreting the returned information. The same care should be taken when referenced DAG nodes have been parented or instanced. Continuing with the previous example, let's say that you were to open A.ma and, instead of simply parenting pSphere1, you were to instance it. While A.ma is open, "B:C:pSphere1" may now be an amibiguous name, replaced by "|B:C:pSphere1" and "group1|B:C:pSphere1". However querying the edits which affect C.ma would still return a setAttr edit affecting "C:pSphere1" since it was applied prior to B:C:pSphere1 being instanced. Some tips: 1. Use the '-topReference' flag to query only those edits which were applied from the currently open file. 2. Use the '-onReferenceNode' flag to limit the results to those edits where are stored on a given reference node. You can then use various string manipulation techniques to extrapolate the current name of any affected nodes.| string[] | For query execution. |
| Long name (short name) | Argument types | Properties | ||
|---|---|---|---|---|
-child(-ch)
|
|
|
||
|
||||
-isExportEdits(-iee)
|
|
|
||
|
||||
-isLoaded(-il)
|
|
|
||
|
||||
-liveEdits(-le)
|
|
|
||
|
||||
-dagPath(-dp)
|
|
|
||
|
||||
-editAttrs(-ea)
|
|
|
||
|
||||
-editNodes(-en)
|
|
|
||
|
||||
-editStrings(-es)
|
|
|
||
|
||||
-failedEdits(-fld)
|
boolean
|
|
||
|
||||
-filename(-f)
|
|
|
||
|
||||
-isNodeReferenced(-inr)
|
|
|
||
|
||||
-isPreviewOnly(-ipo)
|
|
|
||
|
||||
-namespace(-ns)
|
|
|
||
|
||||
-nodes(-n)
|
|
|
||
|
||||
-parent(-p)
|
|
|
||
|
||||
-parentNamespace(-pns)
|
|
|
||
|
||||
-referenceNode(-rfn)
|
|
|
||
|
||||
-shortName(-shn)
|
|
|
||
|
||||
-showDagPath(-sdp)
|
boolean
|
|
||
|
||||
-showFullPath(-sfp) 2023
|
boolean
|
|
||
|
||||
-showNamespace(-sns)
|
boolean
|
|
||
|
||||
-successfulEdits(-scs)
|
boolean
|
|
||
|
||||
-topReference(-tr)
|
|
|
||
|
||||
-unresolvedName(-un)
|
|
|
||
|
||||
-withoutCopyNumber(-wcn)
|
|
|
||
|
||||
-editCommand(-ec)
|
string
|
|
||
|
||||
-onReferenceNode(-orn)
|
string
|
|
||
|
||||
// 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. // polySphere; file -rename "bot.ma"; file -f -type "mayaAscii" -save; // Create mid.ma with a poly cone. // Reference bot.ma into mid.ma and group // the sphere in bot.ma // file -f -new; file -r -ns "bot" "bot.ma"; polyCone; group bot:pSphere1; file -rename "mid.ma"; file -f -type "mayaAscii" -save; // 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. // file -f -new; file -r -ns "mid" "mid.ma"; select -r mid:pCone1; move -r 5 5 5; polyPlane; connectAttr pPlane1.ty mid:bot:polySphere1.radius; // Now perform some queries: // referenceQuery -filename midRN; // Result: C:/Documents and Settings/user/My Documents/maya/projects/default/scenes/mid.ma referenceQuery -filename -shortName mid:pCone1; // Result: mid.ma referenceQuery -filename -parent mid:botRN; // Result: C:/Documents and Settings/user/My Documents/maya/projects/default/scenes/mid.ma referenceQuery -referenceNode mid.ma; // Result: midRN referenceQuery -referenceNode "C:/Documents and Settings/user/My Documents/maya/projects/default/scenes/bot.ma"; // Result: mid:botRN referenceQuery -referenceNode -parent bot.ma; // Result: midRN referenceQuery -referenceNode -topReference bot.ma; // Result: midRN referenceQuery -nodes mid:botRN; // Result: mid:bot:pSphere1 mid:bot:pSphereShape1 mid:bot:lightLinker1 mid:bot:layerManager mid:bot:defaultLayer mid:bot:renderLayerManager mid:bot:defaultRenderLayer mid:bot:polySphere1 mid:bot:uiConfigurationScriptNode mid:bot:sceneConfigurationScriptNode referenceQuery -isNodeReferenced pPlane1; // Result: 0 referenceQuery -isNodeReferenced mid:pCone1; // Result: 1 referenceQuery -parentNamespace mid:botRN; // Result: mid referenceQuery -parentNamespace mid:bot:pSphere1; // Result: mid referenceQuery -parentNamespace "C:/Documents and Settings/user/My Documents/maya/projects/default/scenes/bot.ma"; // Result: mid referenceQuery -namespace bot.ma; // Result: :mid:bot // referenceQuery -namespace mid:botRN; // Result: :mid:bot // referenceQuery -namespace -shortName bot.ma; // Result: bot // referenceQuery -namespace mid.ma; // Result: :mid // referenceQuery -namespace -shortName mid.ma; // Result: mid //