Go to: Synopsis. Return value. Keywords. Flags. Python examples.
dgfilter([attribute=string], [list=boolean], [logicalAnd=[string, string]], [logicalNot=string], [logicalOr=[string, string]], [name=string], [node=string], [nodeType=string], [plug=string])
Note: Strings representing object names and arguments must be separated by commas. This is not depicted in the synopsis.
dgfilter is NOT undoable, NOT queryable, and NOT editable.
The dgfilter command is used to define Dependency Graph filters
that select DG objects based on certain criteria. The command itself
can be used to filter objects or it can be attached to a
dbtrace object to selectively filter what output is traced.
If objects are specified then apply the filter to those objects and
return a boolean indicating whether they passed or not, otherwise
return then name of the filter. An invalid filter will pass all
objects. For multiple objects the return value is the logical
"AND" of all object's return values.
string | if creating filter or getting filter info |
string[] | if listing filters |
boolean | if applying filter |
dg, dependency, graph, alias, attribute, name
attribute, list, logicalAnd, logicalNot, logicalOr, name, node, nodeType, plug
Long name (short name) |
Argument types |
Properties |
attribute(atr)
|
string
|
|
|
Select objects whose attribute names match the pattern.
|
|
list(l)
|
boolean
|
|
|
List the available filters. If used in conjunction with the -name
flag it will show a description of what the filter is.
|
|
logicalAnd(logicalAnd)
|
[string, string]
|
|
|
Logical AND of two filters.
|
|
logicalNot(logicalNot)
|
string
|
|
|
Logical inverse of filter.
|
|
logicalOr(logicalOr)
|
[string, string]
|
|
|
Logical OR of two filters.
|
|
name(n)
|
string
|
|
|
Use filter named FILTER (or create new filter with that name).
If no objects are specified then the name given to the filter
will be returned.
|
|
node(nd)
|
string
|
|
|
Select objects whose node names match the pattern.
|
|
nodeType(nt)
|
string
|
|
|
Select objects whose node type names match the pattern.
|
|
plug(p)
|
string
|
|
|
Select objects whose plug names match the pattern.
|
|
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.
|
import maya.cmds as cmds
# Define attribute filter on translateX
cmds.dgfilter( atr='translateX', n='TX' )
# Result: "TX"
# Define plug filter on node.ty
cmds.dgfilter( plug='node.ty', n='TY' )
# Result: "TY"
# Define logical 'OR' filter.
cmds.dgfilter( logicalOr=('TX', 'TY'), n='OR' )
# Result: "OR"
cmds.polyCube()
# Result: [u'pCube1', u'polyCube1'] #
cmds.polyCube()
# Result: [u'pCube2', u'polyCube2'] #
# Filter passes since attribute matches
cmds.dgfilter( 'pCube1.tx', n='TX' )
# Result: 1
# Filter passes since TX portion succeeds
cmds.dgfilter( 'pCube1.tx', n='OR' )
# Result: 1
# Filter fails ; wrong attributes
cmds.dgfilter( 'pCube1.tz', n='OR' )
# Result: 0
# Filter fails ; wrong node
cmds.dgfilter( 'pCube2.ty', n='TY' )
# Result: 0
# Filter passes
cmds.dgfilter( 'pCube1.ty', n='TY' )
# Result: 1
# List filters available
cmds.dgfilter( list=True )
# Result: [u'TX', u'TY', u'OR'] #
# Show filter information
cmds.dgfilter( list=True, n='OR' )
# Result: LogicalOr( AttributeName(translateX), PlugName(node.ty) )