Rules

FileRules

class PyOpenColorIO.FileRules
FileRules()None

Creates FileRules for a Config. File rules will contain the default rule using the default role. The default rule cannot be removed.

decreaseRulePriority(ruleIndex: int)None

Move a rule closer to the end of the list by one position.

getColorSpace(ruleIndex: int)str

Set the rule’s color space (may also be a role).

getCustomKeyName(ruleIndex: int, key: int)str

Get name of key.

getCustomKeyValue(ruleIndex: int, key: int)str

Get value for the key.

getExtension(ruleIndex: int)str

Setting extension will erase regex.

getIndexForRule(ruleName: str)int

Get the index from the rule name.

getName(ruleIndex: int)str

Get name of the rule.

getNumCustomKeys(ruleIndex: int)int

Get number of key/value pairs.

getNumEntries()int

Does include default rule. Result will be at least 1.

getPattern(ruleIndex: int)str

Setting pattern will erase regex.

getRegex(ruleIndex: int)str

Setting a regex will erase pattern & extension.

increaseRulePriority(ruleIndex: int)None

Move a rule closer to the start of the list by one position.

insertPathSearchRule(ruleIndex: int)None

Helper function to insert a rule.

Uses Config:parseColorSpaceFromString to search the path for any of the color spaces named in the config (as per OCIO v1).

insertRule(*args, **kwargs)

Overloaded function.

  1. insertRule(self: PyOpenColorIO.FileRules, ruleIndex: int, name: str, colorSpace: str, pattern: str, extension: str) -> None

Insert a rule at a given ruleIndex.

Rule currently at ruleIndex will be pushed to index: ruleIndex + 1. Name must be unique. - “Default” is a reserved name for the default rule. The default rule is automatically added and can’t be removed. (see FileRules::setDefaultRuleColorSpace ). - “ColorSpaceNamePathSearch” is also a reserved name (see FileRules::insertPathSearchRule ).

Will throw if pattern, extension or regex is a null or empty string.

Will throw if ruleIndex is not less than FileRules::getNumEntries .

  1. insertRule(self: PyOpenColorIO.FileRules, ruleIndex: int, name: str, colorSpace: str, regex: str) -> None

isDefault()bool

Check if there is only the default rule using default role and no custom key. This is the default FileRules state when creating a new config.

removeRule(ruleIndex: int)None

Note

Default rule can’t be removed. Will throw if ruleIndex + 1 is not less than FileRules::getNumEntries .

setColorSpace(ruleIndex: int, colorSpace: str)None
setCustomKey(ruleIndex: int, key: str, value: str)None

Adds a key/value or replace value if key exists. Setting a NULL or an empty value will erase the key.

setDefaultRuleColorSpace(colorSpace: str)None

Helper function to set the color space for the default rule.

setExtension(ruleIndex: int, extension: str)None
setPattern(ruleIndex: int, pattern: str)None
setRegex(ruleIndex: int, regex: str)None

ViewingRules

class PyOpenColorIO.ViewingRules
ViewingRules()None

Creates ViewingRules for a Config.

addColorSpace(ruleIndex: int, colorSpaceName: str)None

Add colorspace name. Will throw if:

  • RuleIndex is invalid.

  • :ref:`ViewingRules::getNumEncodings`() is not 0.

addEncoding(ruleIndex: int, encodingName: str)None

Add encoding name. Will throw if:

  • RuleIndex is invalid.

  • :ref:`ViewingRules::getNumColorSpaces`() is not 0.

getColorSpaces(ruleIndex: int)PyOpenColorIO.ViewingRules.ViewingRuleColorSpaceIterator
getCustomKeyName(ruleIndex: int, key: int)str

Get name of key. Will throw if ruleIndex or keyIndex is invalid.

getCustomKeyValue(ruleIndex: int, key: int)str

Get value for the key. Will throw if ruleIndex or keyIndex is invalid.

getEncodings(ruleIndex: int)PyOpenColorIO.ViewingRules.ViewingRuleEncodingIterator
getIndexForRule(ruleName: str)int

Get the index from the rule name. Will throw if there is no rule named ruleName.

getName(ruleIndex: int)str

Get name of the rule. Will throw if ruleIndex is invalid.

getNumCustomKeys(ruleIndex: int)int

Get number of key/value pairs. Will throw if ruleIndex is invalid.

getNumEntries()int
insertRule(ruleIndex: int, name: str)None

Insert a rule at a given ruleIndex.

Rule currently at ruleIndex will be pushed to index: ruleIndex + 1. If ruleIndex is ViewingRules::getNumEntries() new rule will be added at the end. Will throw if: - RuleIndex is invalid (must be less than or equal to cpp:func:ViewingRules::getNumEntries). - RuleName already exists.

removeColorSpace(ruleIndex: int, colorSpaceIndex: int)None

Remove colorspace. Will throw if ruleIndex or colorSpaceIndex is invalid.

removeEncoding(ruleIndex: int, encodingIndex: int)None

Remove encoding. Will throw if ruleIndex or encodingIndex is invalid.

removeRule(ruleIndex: int)None

Remove a rule. Throws if ruleIndex is not valid.

setCustomKey(ruleIndex: int, key: str, value: str)None

Adds a key/value or replace value if key exists. Setting a NULL or an empty value will erase the key. Will throw if ruleIndex is invalid.

class PyOpenColorIO.ViewingRules.ViewingRuleColorSpaceIterator
self[arg0: int]str
iter(self)PyOpenColorIO.ViewingRules.ViewingRuleColorSpaceIterator
len(self)int
next(self)str
class PyOpenColorIO.ViewingRules.ViewingRuleEncodingIterator
self[arg0: int]str
iter(self)PyOpenColorIO.ViewingRules.ViewingRuleEncodingIterator
len(self)int
next(self)str