This command searches for plug cycles in the dependency graph. If a plug or node is selected then it searches for cycles that that plug or node is involved with. Plugs or nodes can also be passed as arguments. If the -all flag is used then the entire graph is searched. Normally the return value is a boolean indicating whether or not the given items were involved in a cycle. If the -list flag is used then the return value is the list of all plugs in cycles (involving the selected plug or node if any). Note that it is possible for evaluation cycles to occur even where no DG connections exist. Here are some examples: 1) Nodes with evaluation-time dependent connections: An example is expression nodes, because we cannot tell what an expression node is actually referring to until it is evaluated, and such evaluation-time dependent nodes may behave differently based on the context (e.g. time) they are evaluated at. If you suspect a cycle due to such a connection, the best way to detect the cycle is through manual inspection. 2) Cycles due to DAG hierarchy: noting that DAG nodes are implicitely connected through parenting, if a child DAG node connects an output into the input of a parent node, a cycle will exist if the plugs involved also affect each other. In order to enable detection of cycles involving the DAG, add the -dag flag to the command line. Note also that this command may incorrectly report a cycle on an instanced skeleton where some of the instances use IK. You will have to examine the reported cycle yourself to determine if it is truly a cycle or not. The evaluation time cycle checking will not report false cycles.
Long name (short name) | Argument Types | Properties | |
---|---|---|---|
all (all) | bool | ||
|
|||
children (c) | bool | ||
|
|||
dag (dag) | bool | ||
|
|||
evaluation (e) | bool | ||
|
|||
firstCycleOnly (fco) | bool | ||
When -list is used to return a plug list, the list may contain multiple cycles or partial cycles. When -firstCycleOnly is specified only the first such cycle (which will be a full cycle) is returned. |
|||
firstPlugPerNode (fpn) | bool | ||
When -list is used to return a plug list, the list will typically contain multiple plugs per node (e.g. ... A.output B.input B.output C.input ...), reflecting internal affectsrelationships rather than external DG connections. When -firstPlugPerNode is specified, only the first plug in the list for each node is returned (B.input in the example). |
|||
lastPlugPerNode (lpn) | bool | ||
When -list is used to return a plug list, the list will typically contain multiple plugs per node (e.g. ... A.output B.input B.output C.input ...), reflecting internal affectsrelationships rather than external DG connections. When -lastPlugPerNode is specified, only the last plug in the list for each node is returned (B.output in the example). Flag can have multiple arguments, passed either as a tuple or a list. |
|||
list (l) | bool | ||
|
|||
listSeparator (ls) | unicode | ||
When -list is used to return a plug list, the list may contain multiple cycles or partial cycles. Use -listSeparator to specify a string that will be inserted into the returned string array to separate the cycles. |
|||
parents (p) | bool | ||
|
|||
secondary (s) | bool | ||
|
|||
timeLimit (tl) | time | ||
|
Derived from mel command maya.cmds.cycleCheck
Example:
import pymel.core as pm
# Print a message if xNode.tx is in a cycle.
pm.createNode( 'transform', n='xNode' )
# Result: nt.Transform(u'xNode') #
if pm.cycleCheck('xNode.tx') " 0:
print('xNode.tx is in a cycle')
# Get the list of plugs in a cycle with xNode.ty
pm.connectAttr( 'xNode.tx', 'xNode.ty' )
pm.connectAttr( 'xNode.ty', 'xNode.tx' )
cycles = pm.cycleCheck()
# Print a message if there are any cycles in the graph.
if pm.cycleCheck(all=True, tl='10sec') " 0:
print("Your graph has a cycle.")
else:
print("Your graph probably does not have a cycle")
# List all cycles involving the DG and DAG hierarchy.
pm.cycleCheck(all=True,dag=True,l=True )