Skip to content

Commit

Permalink
Remove unused _ocio_transforms list and replace it with _operators th…
Browse files Browse the repository at this point in the history
…roughout the code for consistency.

- Removed unnecessary _ocio_transforms list
- Replaced instances of _ocio_transforms with _operators throughout the code for consistency
Remove unused _ocio_transforms list and replace it with _operators throughout the code for consistency.

- Removed unnecessary _ocio_transforms list
- Replaced instances of _ocio_transforms with _operators throughout the code for consistency
  • Loading branch information
jakubjezek001 committed Aug 8, 2024
1 parent 32aac90 commit bd6892f
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions lablib/generators/ocio_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ class OCIOConfigFileGenerator:
_views: List[str] = []
_config_path: Path # OCIO Config file
_ocio_config: OCIO.Config # OCIO Config object
_ocio_transforms: List = []
_ocio_search_paths: List[str] = []
_ocio_config_name: str = "config.ocio"
_dest_path: str = ""
Expand Down Expand Up @@ -197,7 +196,6 @@ def set_vars(self, **kwargs) -> None:

def clear_operators(self) -> None:
"""Clear the operators."""
self._ocio_transforms = []
self._operators = []

def clear_views(self):
Expand Down Expand Up @@ -298,7 +296,7 @@ def _sanitize_search_paths(self, paths: List[str]) -> None:
def _get_absolute_search_paths(self) -> None:
"""Get the absolute search paths from the OCIO Config file."""
paths = self._get_search_paths_from_config()
for ocio_transform in self._ocio_transforms:
for ocio_transform in self._operators:
if not hasattr(ocio_transform, "getSrc"):
continue
search_path = Path(ocio_transform.getSrc())
Expand All @@ -314,7 +312,7 @@ def _change_src_paths_to_names(self) -> None:
This will also replace any variables found in the path.
"""
for ocio_transform in self._ocio_transforms:
for ocio_transform in self._operators:
if not hasattr(ocio_transform, "getSrc"):
continue

Expand Down Expand Up @@ -369,18 +367,21 @@ def process_config(self) -> None:
self._ocio_config.addEnvironmentVar(k, v)

self._ocio_config.setDescription(self._description)
group_transform = OCIO.GroupTransform(self._ocio_transforms)
group_transform = OCIO.GroupTransform(self._operators)
look_transform = OCIO.ColorSpaceTransform(
src=self.working_space, dst=self.context
)
colorspace = OCIO.ColorSpace()
colorspace.setName(self.context)
colorspace.setFamily(self.family)
colorspace.setTransform(
group_transform, OCIO.ColorSpaceDirection.COLORSPACE_DIR_FROM_REFERENCE
group_transform,
OCIO.ColorSpaceDirection.COLORSPACE_DIR_FROM_REFERENCE
)
look = OCIO.Look(
name=self.context, processSpace=self.working_space, transform=look_transform
name=self.context,
processSpace=self.working_space,
transform=look_transform
)
self._ocio_config.addColorSpace(colorspace)
self._ocio_config.addLook(look)
Expand Down Expand Up @@ -435,9 +436,6 @@ def create_config(self, dest: str = None) -> str:
dest = Path(dest).resolve().as_posix()
self.load_config_from_file(self._config_path.resolve().as_posix())

for op in self._operators:
self._ocio_transforms.append(op)

self._get_absolute_search_paths()
self._change_src_paths_to_names()
self.process_config()
Expand Down

0 comments on commit bd6892f

Please sign in to comment.