pymel.core.language.melOptions¶
- melOptions(*args, **kwargs)¶
Set and query options that affect the behavior of Maya’s Embedded Language (MEL). In query mode, return type is based on queried flag.
Flags:
Long Name / Short Name Argument Types Properties duplicateVariableWarnings / dvw bool When turned on, this option will cause a warning to be generated whenever a MEL variable is declared within the same scope as another variable with the same name. The warnings will be generated when the script is sourced, not when it is executed. Usually these warnings indicate an error in the script. On query the current setting of the option will be returned. The corresponding preference optionVar is melDuplicateVariableWarnings. Flag can have multiple arguments, passed either as a tuple or a list. Derived from mel command maya.cmds.melOptions
Example:
- ::
import pymel.core as pm
# To find out if there are any duplicate variable declarations in # a script:
# Save the current setting of the duplicateVariableWarnings option. optionVal = pm.melOptions(q=True, duplicateVariableWarnings=True)
# Turn the option on. pm.melOptions(duplicateVariableWarnings=True)
# Source the script and see all the warnings generated. import maya.mel as mm mm.eval(‘source “myScript.mel”’)
// Warning: int $i; // // Warning: “myScript.mel” line 5.8 : Redeclaration of variable “$i” shadows previous declaration at line 3. Previous value will be retained. //
# Restore the option to its original value. pm.melOptions(duplicateVariableWarnings=optionVal)