Go to: Synopsis. Return value. Flags. Python examples.

Synopsis

defaultNavigation([connectToExisting=boolean], [createNew=boolean], [defaultAttribute=boolean], [defaultTraversal=boolean], [defaultWorkingNode=boolean], [delete=boolean], [destination=name], [force=boolean], [ignore=boolean], [navigatorDecisionString=string], [quiet=boolean], [relatedNodes=boolean], [source=name], [unignore=boolean])

Note: Strings representing object names and arguments must be separated by commas. This is not depicted in the synopsis.

defaultNavigation is undoable, NOT queryable, and NOT editable.

The defaultNavigation command defines default behaviours when creating or manipulating connections between nodes and when navigating between nodes via those connections. This command is primarily used by attribute editors.

Return value

string or array of strings

Flags

connectToExisting, createNew, defaultAttribute, defaultTraversal, defaultWorkingNode, delete, destination, force, ignore, navigatorDecisionString, quiet, relatedNodes, source, unignore
Long name (short name) Argument types Properties
quiet(qt) boolean create
If set to true, then under no circumstances should the user be prompted for more information. Default value is false.
force(f) boolean create
If set to true, then an attempt to connect a source attribute to a destination attribute which already has a source will cause the existing source to be disconnected and the new source to be connected in its place. Default value is true.
destination(d) name create
Specifies an existing destination attribute for a createNew or connectToExisting.
source(s) name create
Specifies an existing source attribute for a connectToExisting.
createNew(cn) boolean create
Create a new node and connect it to the node.attribute specified using the destination flag.
connectToExisting(ce) boolean create
Connect the destination (which is a node.attribute or simply node) to an existing source. If the source is specified (as node.attribute or simply as node), the command will proceed immediately. If the source is not specified, the user will be prompted to specify one. Once a source has been specified, a best guess will be made about what the user is trying to accomplish by connecting the two, based on the type of source and type of destination. The command will connect the nodes/attributes according to the best guess. The destination is specified using the destination flag and the source specified using the source flag.
ignore(i) boolean create
Ignore any connections flowing into the node.attribute specified by the destination flag.
unignore(u) boolean create
Stop ignoring any connections flowing into the node.attribute specified by the destination flag.
delete(delete) boolean create
Delete nodes with connections flowing into the node.attribute specified by the destination flag.
relatedNodes(ren) boolean create
List nodes which are conceptually related to the node.attribute specified by the destination. Related nodes may include, but are not limited to, nodes which are directly or indirectly connected to the destination. The destination is specified using the destination flag. Returns an array of strings.
defaultWorkingNode(dwn) boolean create
Returns the name of the node which the user is most likely to want to work with if they are interested in the attributes of the destination node. The destination is specified using the destination flag. Returns a string.
defaultTraversal(dtv) boolean create
Returns the name of the node to which it would make the most sense to navigate to from the destination node.attribute specified. The destination is specified using the destination flag. Returns a string.
defaultAttribute(da) boolean create
Returns the name of the attribute to which a connectNodeToNode would connect, given the source (attribute) and destination (node) flags. Returns a string.
navigatorDecisionString( nds) string create
This is your opportunity to pass the navigator a string that can help it decide what behaviour to execute.

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 have multiple arguments, passed either as a tuple or a list.

Python examples

import maya.cmds as cmds

# Create a poly plane
cmds.polyPlane(w=10, h=10, sx=10, sy=10, n='pPlane1')

# This will open the Create Render Node window from which you can select a node that you want to connect to the existing lambert1.color attribute
cmds.defaultNavigation(createNew=True, destination='lambert1.color')

# Select the Checker Node, you will find "checker1.outColor" is connected to "lambert1.color"

# Break the connection between "checker1.outColor" and "lambert1.color" you have just established
cmds.disconnectAttr('checker1.outColor', 'lambert1.color')

# Connect "checker1" to "lambert1". Only node is specified here, but the command will make a best guess.
# So "checker1.outColor" and "lambert1.color" are connected
cmds.defaultNavigation(connectToExisting=True, source='checker1', destination='lambert1')