pymel.core.animation.evaluator¶
- evaluator(*args, **kwargs)¶
Handles turning on and off custom evaluation overrides used by the evaluation manager. Query no flag to see all available custom evaluators. Query the ‘enable’ flag to check if an evaluator is currently enabled. If the ‘name’ flag isn’t used then return all modes and their current active state.
Flags:
Long Name / Short Name Argument Types Properties clusters / cl bool This flag queries the list of clusters currently assigned to the named custom evaluator. The return value will be an array of strings where the array consists of a set of (number, string[]) groups. e.g. If an evaluator has 2 clusters with 2 and 3 nodes in them respectively the output would be something like: (2, ‘transform2’, ‘transform3’, 3, ‘joint1’, ‘joint2’, ‘joint3’) configuration / c unicode Sends configuration information to a custom evaluator. It’s up to the evaluator to understand what they mean. Multiple configuration messages can be sent in a single command. Query this flag for a given evaluator to find out what configuration messages it accepts. enable / en bool Enables or disables a specific graph evaluation runtime, depending on the state of the flag. In order to use this flag you must also specify the name in the ‘name’ argument. When the ‘enable’ flag is used in conjunction with the ‘nodeType’ flag then it is used to selectively turn on or off the ability of the given evaluator to handle nodes of the given type (i.e. it no longer toggles the evaluator enabled state). When the ‘enable’ flag is used in conjunction with the ‘configuration’ flag then it is passed along with the configuration message interpreted by the custom evaluator. info / i bool Queries the evaluator information. Only valid in query mode since the information is generated by the evaluator’s internal state and cannot be changed. In order to use this flag, the ‘name’ argument must also be specified. name / n unicode Names a particular DG evaluation override evaluator. Evaluators are registered automatically by name. Query this flag to get a list of available runtimes. When a runtime is registered it is enabled by default. Use the ‘enable’ flag to change its enabled state. In query mode, this flag can accept a value. nodeType / nt unicode Names a particular node type to be passed to the evaluator request. Evaluators can either use or ignore the node type information as passed. In query mode, this flag can accept a value. nodeTypeChildren / ntc bool If enabled when using the ‘nodeType’ flag then handle all of the node types derived from the given one as well. Default is to only handle the named node type. priority / p int Query or set the evaluator priority. Custom evaluator with highest priority order will get the chance to claim the nodes first. Evaluators must have unique priority values. In order to use this flag you must also specify the name in the ‘name’ argument. valueName / vn unicode Queries a value from a given evaluator. Evaluators can define a set of values for which they answer. In query mode, this flag can accept a value.Flag can have multiple arguments, passed either as a tuple or a list. Derived from mel command maya.cmds.evaluator
Example:
- ::
import pymel.core as pm
import maya.cmds as cmds
# Load a custom evaluator plug-in (not a real plug-in, just an example) pm.loadPlugin( ‘MY_CUSTOM_EVALUATOR’ ); MY_CUSTOM_EVALUATOR
# List the available evaluators pm.evaluator( query=True ); [u’MY_CUSTOM_EVALUATOR’]
# Is ‘MY_CUSTOM_EVALUATOR’ disabled? pm.evaluator( query=True, name=’MY_CUSTOM_EVALUATOR’ ) False
# Check which evaluators are disabled pm.evaluator( enable=False, query=True ) [u’MY_CUSTOM_EVALUATOR’]
# Turn on ‘MY_CUSTOM_EVALUATOR’ pm.evaluator( enable=True, name=’MY_CUSTOM_EVALUATOR’ ) False
# Check to see which evaluators are enabled pm.evaluator( enable=True, query=True ) [u’MY_CUSTOM_EVALUATOR’]
# Make ‘MY_CUSTOM_EVALUATOR’ handle nodes of type ‘transform’ pm.evaluator( enable=True, name=’MY_CUSTOM_EVALUATOR’, nodeType=’transform’ ) [u’transform’]
# Make ‘MY_CUSTOM_EVALUATOR’ handle nodes of type ‘transform’ and all derived types pm.evaluator( enable=True, name=’MY_CUSTOM_EVALUATOR’, nodeType=’transform’, nodeTypeChildren=True ) [u’transform’, u’joint’, “large list omitted”]
# Get the list of clustered nodes handled by ‘MY_CUSTOM_EVALUATOR’ in the current scene. pm.evaluator( name=’MY_CUSTOM_EVALUATOR’, query=True, clusters=True ) [‘2’, ‘transform1’, ‘transform2’, ‘3’, ‘joint3’, ‘joint4’, ‘joint5’ ]
# Send a configuration message to ‘MY_CUSTOM_EVALUATOR’ pm.evaluator( name=’MY_CUSTOM_EVALUATOR’, configuration=’cluster=subgraph’ )
# Query information about ‘MY_CUSTOM_EVALUATOR’ pm.evaluator( query=True, name=’MY_CUSTOM_EVALUATOR’, info=True )
# Query ‘pruneRoots’ priority pm.evaluator( query=True, name=’pruneRoots’, priority=True ) # Result: 1000
# Set “pruneRoots” priority to 2500 pm.evaluator( name=’pruneRoots’, priority=2500 ) # Result: True