Context¶
- class PyOpenColorIO.Context¶
- Context(*args, **kwargs)¶
__init__(*args, **kwargs) Overloaded function.
__init__(self: PyOpenColorIO.Context) -> None
__init__(self: PyOpenColorIO.Context, workingDir: str = ‘’, searchPaths: List[str] = [], stringVars: Dict[str, str] = {}, environmentMode: PyOpenColorIO.EnvironmentMode = <EnvironmentMode.ENV_ENVIRONMENT_LOAD_PREDEFINED: 1>) -> None
- addSearchPath(path: str) None¶
- clearSearchPaths() None¶
- clearStringVars() None¶
- getCacheID() str¶
- getEnvironmentMode() PyOpenColorIO.EnvironmentMode¶
cpp:function:
- getSearchPath() str¶
- getSearchPaths() PyOpenColorIO.Context.SearchPathIterator¶
- getStringVars() PyOpenColorIO.Context.StringVarIterator¶
- getWorkingDir() str¶
- loadEnvironment() None¶
Seed all string vars with the current environment.
- resolveFileLocation(*args, **kwargs)¶
Overloaded function.
resolveFileLocation(self: PyOpenColorIO.Context, filename: str) -> str
Build the resolved and expanded filepath using the search_path when needed, and check if the filepath exists. If it cannot be resolved or found, an exception will be thrown. The method argument is directly from the config file so it can be an absolute or relative file path or a file name.
Note
The filepath existence check could add a performance hit.
Note
The context variable resolution is performed using
resolveStringVar().resolveFileLocation(self: PyOpenColorIO.Context, filename: str, usedContextVars: PyOpenColorIO.Context) -> str
Build the resolved and expanded filepath and return all the context variables used to resolve the filename (empty if no context variables were used).
- resolveStringVar(*args, **kwargs)¶
Overloaded function.
resolveStringVar(self: PyOpenColorIO.Context, string: str) -> str
cpp:function:: Resolve all the context variables from the string. It could be color space
resolveStringVar(self: PyOpenColorIO.Context, string: str, usedContextVars: PyOpenColorIO.Context) -> str
cpp:function:: Resolve all the context variables from the string and return all the context
- setEnvironmentMode(mode: PyOpenColorIO.EnvironmentMode) None¶
cpp:function:
- setSearchPath(path: str) None¶
- setWorkingDir(dirName: str) None¶
- class PyOpenColorIO.Context.StringVarNameIterator¶
- self[arg0: int] str¶
- iter(self) PyOpenColorIO.Context.StringVarNameIterator¶
- len(self) int¶
- next(self) str¶
-
class OpenColorIO_v2_0::Context¶
Public Functions
-
ContextRcPtr createEditableCopy() const¶
-
const char *getCacheID() const¶
-
void setSearchPath(const char *path)¶
-
const char *getSearchPath() const¶
-
int getNumSearchPaths() const¶
-
const char *getSearchPath(int index) const¶
-
void clearSearchPaths()¶
-
void addSearchPath(const char *path)¶
-
void setWorkingDir(const char *dirname)¶
-
const char *getWorkingDir() const¶
-
void setStringVar(const char *name, const char *value) noexcept¶
rst:: .. _ctxvariable_section:
cpp:function:: Add (or update) a context variable. But it removes it if the value argument
-
const char *getStringVar(const char *name) const noexcept¶
Get the context variable value. It returns an empty string if the context variable is null or does not exist.
-
int getNumStringVars() const¶
-
const char *getStringVarNameByIndex(int index) const¶
-
const char *getStringVarByIndex(int index) const¶
cpp:function::
-
void clearStringVars()¶
-
void addStringVars(const ConstContextRcPtr &ctx) noexcept¶
Add to the instance all the context variables from ctx.
-
void setEnvironmentMode(EnvironmentMode mode) noexcept¶
cpp:function::
-
EnvironmentMode getEnvironmentMode() const noexcept¶
cpp:function::
-
void loadEnvironment() noexcept¶
Seed all string vars with the current environment.
-
const char *resolveStringVar(const char *string) const noexcept¶
cpp:function:: Resolve all the context variables from the string. It could be color space
-
const char *resolveStringVar(const char *string, ContextRcPtr &usedContextVars) const noexcept¶
cpp:function:: Resolve all the context variables from the string and return all the context
-
const char *resolveFileLocation(const char *filename) const¶
Build the resolved and expanded filepath using the search_path when needed, and check if the filepath exists. If it cannot be resolved or found, an exception will be thrown. The method argument is directly from the config file so it can be an absolute or relative file path or a file name.
Note
The filepath existence check could add a performance hit.
Note
The context variable resolution is performed using :cpp:func:
resolveStringVar.
-
const char *resolveFileLocation(const char *filename, ContextRcPtr &usedContextVars) const¶
Build the resolved and expanded filepath and return all the context variables used to resolve the filename (empty if no context variables were used).
-
~Context()¶
Do not use (needed only for pybind11).
Public Static Functions
-
static ContextRcPtr Create()¶
-
ContextRcPtr createEditableCopy() const¶