Go to: Return value. Related commands. Flags. Examples.

Synopsis

reference [-filename string] [-longName toggle] [-shortName toggle] [-isNodeReferenced toggle] [-node string] [-dagPath toggle] [-connectionsBroken toggle] [-connectionsMade toggle] [-referenceNode string] [-editCommand string]

reference is undoable, queryable, and NOT editable .

Obsolete Command. Use referenceEdit and referenceQuery instead. Use this command to find out which nodes in the scene come from a given referenced file, or which file a given referenced node comes from.

Return value

string[] For query execution.

Keywords

reference, attribute, node

Related commands

listAttr, file, connectAttr, disconnectAttr, referenceQuery

Flags

connectionsBroken, connectionsMade, dagPath, editCommand, filename, isNodeReferenced, longName, node, referenceNode, shortName

Long name (short name)[argument types]Properties
-filename (-f) stringquerycreate
Obsolete Flag. Use 'referenceQuery -filename' instead. Query returns string for the name of the referenced file in which the target node is defined. Querying this flag for a node that is not referenced results in an error. Querfying this flag with the referenceNode specified returns the name of the file associated with the reference node.
-longName (-ln) query
Obsolete Flag. Use 'referenceQuery -longName' instead. Modifier for -filename to return the full path.
-shortName (-sn) query
Obsolete Flag. Use 'referenceQuery -shortName' instead. Modifier for -filename to return just the file name.
-isNodeReferenced (-inr) query
Obsolete Flag. Use 'referenceQuery -isNodeReferenced' instead. Query returns boolean: true if the target node comes from a referenced file, false if not.
-node (-n) stringquery
Obsolete Flag. Use 'referenceQuery -nodes' instead. Query returns string[] for names of nodes referenced (in a given file, for instance).
-dagPath (-dp) query
Obsolete Flag. Use 'referenceQuery -dagPath' instead. Modifier for -node, -connectionsBroken, and -connectionsMade. Returns the nodes' full dag paths.
-connectionsBroken (-cb) query
Obsolete Flag. Use 'referenceQuery -editStrings -editCommand "disconnectAttr"' instead. Query returns string[] consisting of attribute pairs representing the connections broken on a node from a referenced file. The first element of the pair is the source attribute, the second is the destination attribute. These pairs correspond to the "disconnectAttr" statements in a scene file where changes to a referenced file occur after the referenced file has been opened.
-connectionsMade (-cm) query
Obsolete Flag. Use 'referenceQuery -editStrings -editCommand "connectAttr"' instead. Query returns string[] consisting of attribute pairs representing the connections made on a node from a referenced file. The first element of the pair is the source attribute, the second is the destination attribute. These pairs correspond to the "connectAttr" statements in a scene file where changes to a referenced file occur after the referenced file has been opened.
-referenceNode (-rfn) stringquerycreate
Obsolete Flag. Use 'referenceQuery -referenceNode' instead. Limit the query to the reference objects associated with this reference node. Querying this flag with an invalid reference node will result in an error.
-editCommand (-ec) stringquerycreate
Obsolete Flag. Use 'referenceQuery -editStrings -editCommand' instead. Query returns string[] of edit commands of the specified type associated with this reference node. Querying this flag without a valid reference node will result in an error.

Flag can appear in Create mode of command Flag can appear in Edit mode of command
Flag can appear in Query mode of command Flag can be used more than once in a command

Examples


// List all the nodes that come referenced file "myReferencedFile.ma"
//
reference -f "myReferencedFile.ma" -q -node;
// Find out which file a given referenced node comes from.
//
reference -q -f "nurbsSphere1";
// Find out if "nurbsSphere1" comes from a referenced file
//
reference -q -inr "nurbsSphere1";
// Some practical examples of getting information about a referenced file.
//
// Create an animated cone
//
cone;
setKeyframe -at t -t 1 -t 10 -v 0;
setKeyframe -at t -t 5 -v 10;
// Save it under the name "animatedCone.ma"
//
file -rename "animatedCone.ma";
file -f -type "mayaAscii" -save;
// Create a new file that will reference "animatedCone.ma"
//
file -f -new;
file -reference "animatedCone.ma";
// Objects in the "animatedCone.ma" file now have the "animatedCone_"
// prefix on their names.
//
// Modify the translate attributes after "animatedCone.ma" was imported
// as a reference.
//
select "animatedCone_nurbsCone1";
move 5 5 5;
// Disconnect an attribute
//
disconnectAttr "animatedCone_nurbsCone1_translateY.output" "animatedCone_nurbsCone1.ty";
// Make a new node and connect it to the referenced cone.
//
sphere;
connectAttr "nurbsSphere1.rx" "animatedCone_nurbsCone1.rx";
// INFO: Which nodes came from a given referenced file.
//
reference -f animatedCone.ma -q -n;
// Result:
//	animatedCone_nurbsCone1
//	animatedCone_nurbsConeShape1
//	animatedCone_lightLinker1
//	animatedCone_layerManager
//	animatedCone_defaultLayer
//	animatedCone_renderLayerManager
//	animatedCone_defaultRenderLayer
//	animatedCone_makeNurbCone1
//	animatedCone_nurbsCone1_translateX
//	animatedCone_nurbsCone1_translateY
//	animatedCone_nurbsCone1_translateZ
//	animatedCone_uiConfigurationScriptNode
//	animatedCone_animationScriptNode
// INFO: Which file does a given referenced node come from?
//
reference -q -f animatedCone_nurbsCone1;
// Result: animatedCone.ma //
// INFO: Which attributes have changed on a referenced node since
// the referenced file was opened?
//
listAttr -changedSinceFileOpen animatedCone_nurbsCone1;
// Result:
// 	translate
// INFO: Return the connections broken on a node
//
reference -q -connectionsBroken animatedCone_nurbsCone1;
// Result:
//	animatedCone_nurbsCone1_translateY.output
// 	animatedCone_nurbsCone1.translateY
// INFO: Return the connections broken in the entire referenced file.
// (In this case, the result is the same as the example above.)
//
reference -f "animatedCone.ma" -q -connectionsBroken;
// Result:
//	animatedCone_nurbsCone1_translateY.output
// 	animatedCone_nurbsCone1.translateY
// INFO: Return the input (destination) connections made on a ref node
//
reference -q -connectionsMade animatedCone_nurbsCone1;
// Result:
// 	nurbsSphere1.rotateX
//	animatedCone_nurbsCone1.rotateX
// INFO: Return the list of the node names from the reference file
// associated with the reference node "refNodeName"
//
reference -rfn "refNodeName" -q -node;
// INFO: Find out if refNodeName is a valid reference node name.
//
reference -rfn "refNodeName" -q;
// Result:
//      refNodeName
// INFO: Return the name of the reference file associated with the reference
// node "refNodeName", if any.
//
reference -rfn "refNodeName" -q -filename;
// Result:
//      "myReferencedFile.ma"
// INFO: Find all the setAttr edits on the reference node
//
reference -ec "setAttr" -rfn "refNodeName" -q;
// Result:
//      string array with setAttr commands applied to nodes from the given reference