pymel.core.general.colorManagementFileRules¶
- colorManagementFileRules(*args, **kwargs)¶
This non-undoable action manages the list of rules that Maya uses to assign an initial input color space to dependency graph nodes that read in color information from a file. Rules are structured in a chain of responsibility, from highest priority rule to lowest priority rule, each rule matching a file path pattern and extension. If a rule matches a given file path, its color space is returned as the result of rules evaluation, and no further rule is considered. The lowest priority rule will always return a match. Rules can be added, removed, and changed in priority in the list. Each rule can have its file path pattern, extension, and color space changed. The rule list can be saved to user preferences, and loaded from user preferences. In query mode, return type is based on queried flag.
Flags:
Long Name / Short Name Argument Types Properties addRule / add unicode Add a rule with the argument name to the list of rules, as the highest-priority rule. If this flag is used, the pattern, extension, and colorSpace flags must be used as well, to specify the file rule pattern, extension, and color space, respectively. colorSpace / cs unicode The input color space for the rule. If the rule matches a file path, this is the color space that is returned. This color space must match an existing color space in the input color space list. down / dwn unicode Move the rule with the argument name down one position towards lower priority. evaluate / ev unicode Evaluates the list of rules and returns the input color space name that corresponds to the argument file path. extension / ext unicode The file extension for the rule is case insensitive listRules / lsr bool Returns an array of rule name strings, in order, from lowest-priority (rule 0) to highest-priority (last rule in array). load / ld bool Read the rules from Maya preferences. Any existing rules are cleared. moveUp / up unicode Move the rule with the argument name up one position towards higher priority. pattern / pat unicode The file path pattern for the rule. This is the substring to match in the file path, expressed as a glob pattern: for example, ‘*’ matches all files. For more information about glob pattern syntax, see http://en.wikipedia.org/wiki/Glob_%28programming%29. remove / rm unicode Remove the rule with the argument name from the list of rules. restoreDefaults / rde bool Restore the list of rules to the default ones only. save / sav bool Save the rules to Maya preferences. Flag can have multiple arguments, passed either as a tuple or a list. Derived from mel command maya.cmds.colorManagementFileRules
Example:
- ::
import pymel.core as pm
import maya.cmds as cmds
pm.colorManagementFileRules(add=’ruleName’, pattern=’filePattern’, extension=’extension’, colorSpace=’colorSpace’) pm.colorManagementFileRules(remove=’ruleName’) pm.colorManagementFileRules(up=’ruleName’) pm.colorManagementFileRules(down=’ruleName’)
pm.colorManagementFileRules(‘ruleName’, edit=True, pattern=’filePattern’) pm.colorManagementFileRules(‘ruleName’, edit=True, extension=’extension’) pm.colorManagementFileRules(‘ruleName’, edit=True, colorSpace=’colorSpace’) pm.colorManagementFileRules(‘ruleName’, query=True, pattern=True) pm.colorManagementFileRules(‘ruleName’, query=True, extension=True) pm.colorManagementFileRules(‘ruleName’, query=True, colorSpace=True)
pm.colorManagementFileRules(save=True) pm.colorManagementFileRules(load=True)
# Return array of rule name strings. pm.colorManagementFileRules(listRules=True)
# Return input space corresponding to file path. pm.colorManagementFileRules(evaluate=filePath)