Skip to content

Commit

Permalink
Improve ocioview mac support and simplify dependencies (#1853)
Browse files Browse the repository at this point in the history
* PySide 6, remove imath, add imageio support

Signed-off-by: Rémi Achard <remiachard@gmail.com>

Remove Imath

Signed-off-by: Rémi Achard <remiachard@gmail.com>

Support imageio as fallback for openimageio

Signed-off-by: Rémi Achard <remiachard@gmail.com>

Further adjustments following latest updates

Signed-off-by: Rémi Achard <remiachard@gmail.com>

Fix pixel probe

Signed-off-by: Remi Achard <remiachard@gmail.com>

Add OpenColorIO to requirements

Signed-off-by: Remi Achard <remiachard@gmail.com>

* Fix rebase issue

Signed-off-by: Remi Achard <remiachard@gmail.com>

---------

Signed-off-by: Remi Achard <remiachard@gmail.com>
Signed-off-by: Thomas Mansencal <thomas.mansencal@gmail.com>
Signed-off-by: Michael Dolan <michdolan@gmail.com>
Co-authored-by: Thomas Mansencal <thomas.mansencal@gmail.com>
Co-authored-by: Michael Dolan <michdolan@gmail.com>
  • Loading branch information
3 people committed Oct 30, 2023
1 parent 0d00b2c commit 45544ce
Show file tree
Hide file tree
Showing 76 changed files with 235 additions and 228 deletions.
4 changes: 2 additions & 2 deletions src/apps/ocioview/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ Dependencies

* PyOpenColorIO
* [OpenImageIO (Python bindings)](https://github.com/OpenImageIO/oiio)
* [Imath (Python bindings)](https://github.com/AcademySoftwareFoundation/Imath)
* ``pip install -r requirements.txt``
* [numpy](https://pypi.org/project/numpy/)
* [Pygments](https://pypi.org/project/Pygments/)
* [PyOpenGL](https://pypi.org/project/PyOpenGL/)
* [PySide2](https://pypi.org/project/PySide2/)
* [PySide6](https://pypi.org/project/PySide6/)
* [QtAwesome](https://pypi.org/project/QtAwesome/)
* [imageio](https://pypi.org/project/imageio/)
9 changes: 4 additions & 5 deletions src/apps/ocioview/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from pathlib import Path

import PyOpenColorIO as ocio
from PySide2 import QtCore, QtWidgets, QtOpenGL
from PySide6 import QtCore, QtGui, QtWidgets, QtOpenGL

import ocioview.log_handlers # Import to initialize logging
from ocioview.main_window import OCIOView
Expand All @@ -30,12 +30,11 @@ def excepthook(exc_type, exc_value, exc_tb):
sys.excepthook = excepthook

# OpenGL core profile needed on macOS to access programmatic pipeline
gl_format = QtOpenGL.QGLFormat()
gl_format.setProfile(QtOpenGL.QGLFormat.CoreProfile)
gl_format.setSampleBuffers(True)
gl_format = QtGui.QSurfaceFormat()
gl_format.setProfile(QtGui.QSurfaceFormat.CoreProfile)
gl_format.setSwapInterval(1)
gl_format.setVersion(4, 0)
QtOpenGL.QGLFormat.setDefaultFormat(gl_format)
QtGui.QSurfaceFormat.setDefaultFormat(gl_format)

# Create app
app = QtWidgets.QApplication(sys.argv)
Expand Down
2 changes: 1 addition & 1 deletion src/apps/ocioview/ocioview/config_dock.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from typing import Optional

import PyOpenColorIO as ocio
from PySide2 import QtCore, QtWidgets
from PySide6 import QtCore, QtWidgets

from .items import (
ColorSpaceEdit,
Expand Down
2 changes: 1 addition & 1 deletion src/apps/ocioview/ocioview/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from pathlib import Path

from PySide2 import QtCore, QtGui
from PySide6 import QtCore, QtGui


# Root application directory
Expand Down
6 changes: 3 additions & 3 deletions src/apps/ocioview/ocioview/inspect/code_inspector.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import PyOpenColorIO as ocio
from pygments.formatters import HtmlFormatter
from PySide2 import QtCore, QtGui, QtWidgets
from PySide6 import QtCore, QtGui, QtWidgets

from ..message_router import MessageRouter
from ..utils import get_glyph_icon, processor_to_shader_html
Expand Down Expand Up @@ -40,9 +40,9 @@ def __init__(self, parent: Optional[QtCore.QObject] = None):

html_css = HtmlFormatter(style="material").get_style_defs()
# Update line number colors to match palette
html_css = html_css.replace("#263238", palette.color(palette.Base).name())
html_css = html_css.replace("#263238", palette.color(palette.ColorRole.Base).name())
html_css = html_css.replace(
"#37474F", palette.color(palette.Text).darker(150).name()
"#37474F", palette.color(palette.ColorRole.Text).darker(150).name()
)

# Widgets
Expand Down
6 changes: 3 additions & 3 deletions src/apps/ocioview/ocioview/inspect/curve_inspector.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import numpy as np

import PyOpenColorIO as ocio
from PySide2 import QtCore, QtGui, QtWidgets
from PySide6 import QtCore, QtGui, QtWidgets

from ..constants import R_COLOR, G_COLOR, B_COLOR, GRAY_COLOR
from ..message_router import MessageRouter
Expand Down Expand Up @@ -526,7 +526,7 @@ def drawForeground(self, painter: QtGui.QPainter, rect: QtCore.QRectF) -> None:

if color_name == GRAY_COLOR.name():
palette = self.palette()
painter.setPen(palette.color(palette.Text))
painter.setPen(palette.color(palette.ColorRole.Text))
else:
painter.setPen(QtGui.QColor(color_name))

Expand Down Expand Up @@ -635,7 +635,7 @@ def _on_cpu_processor_ready(self, cpu_proc: ocio.CPUProcessor) -> None:
r_samples, b_samples, atol=self.EPSILON
):
palette = self.palette()
color_name = palette.color(palette.Text).name()
color_name = palette.color(palette.ColorRole.Text).name()

self._samples[color_name] = np.stack((self._x_lin, r_samples), axis=-1)

Expand Down
2 changes: 1 addition & 1 deletion src/apps/ocioview/ocioview/inspect/log_inspector.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from typing import Optional

import PyOpenColorIO as ocio
from PySide2 import QtCore, QtGui, QtWidgets
from PySide6 import QtCore, QtGui, QtWidgets

from ..log_handlers import set_logging_level
from ..message_router import MessageRouter
Expand Down
2 changes: 1 addition & 1 deletion src/apps/ocioview/ocioview/inspect_dock.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from typing import Optional

from PySide2 import QtCore, QtWidgets
from PySide6 import QtCore, QtWidgets

from .inspect.curve_inspector import CurveInspector
from .inspect import LogInspector, CodeInspector
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from typing import Optional

from PySide2 import QtCore, QtGui, QtWidgets
from PySide6 import QtCore, QtGui, QtWidgets

from ..widgets import ItemModelListWidget
from ..utils import get_glyph_icon
Expand Down
4 changes: 2 additions & 2 deletions src/apps/ocioview/ocioview/items/active_display_view_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from typing import Any, Callable, Optional, Type

import PyOpenColorIO as ocio
from PySide2 import QtCore, QtGui, QtWidgets
from PySide6 import QtCore, QtGui

from ..config_cache import ConfigCache
from ..undo import ConfigSnapshotUndoCommand
Expand Down Expand Up @@ -87,7 +87,7 @@ def get_item_names(self) -> list[str]:

def _get_undo_command_type(
self, column_desc: ColumnDesc
) -> Type[QtWidgets.QUndoCommand]:
) -> Type[QtGui.QUndoCommand]:
if column_desc == self.ACTIVE:
# Changing check state of the ACTIVE column has side effects related to
# display/view order, so a config snapshot is needed to revert the change.
Expand Down
2 changes: 1 addition & 1 deletion src/apps/ocioview/ocioview/items/color_space_edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from functools import partial
from typing import Optional

from PySide2 import QtCore, QtWidgets
from PySide6 import QtCore, QtWidgets
import PyOpenColorIO as ocio

from ..config_cache import ConfigCache
Expand Down
2 changes: 1 addition & 1 deletion src/apps/ocioview/ocioview/items/color_space_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from typing import Any, Optional

import PyOpenColorIO as ocio
from PySide2 import QtCore, QtGui
from PySide6 import QtCore, QtGui

from ..config_cache import ConfigCache
from ..ref_space_manager import ReferenceSpaceManager
Expand Down
4 changes: 2 additions & 2 deletions src/apps/ocioview/ocioview/items/config_item_edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from functools import partial
from typing import Optional

from PySide2 import QtCore, QtGui, QtWidgets
from PySide6 import QtCore, QtGui, QtWidgets

from ..constants import MARGIN_WIDTH
from ..transform_manager import TransformManager
Expand Down Expand Up @@ -47,7 +47,7 @@ def __init__(self, parent: Optional[QtWidgets.QWidget] = None):

if self.__has_transforms__:
self.__has_tabs__ = True
no_tf_color = palette.color(palette.Disabled, palette.Text)
no_tf_color = palette.color(palette.ColorGroup.Disabled, palette.ColorRole.Text)
self._from_ref_icon = get_glyph_icon("mdi6.layers-plus")
self._no_from_ref_icon = get_glyph_icon(
"mdi6.layers-plus", color=no_tf_color
Expand Down
4 changes: 2 additions & 2 deletions src/apps/ocioview/ocioview/items/config_item_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from typing import Any, Optional, Type, Union

import PyOpenColorIO as ocio
from PySide2 import QtCore, QtGui, QtWidgets
from PySide6 import QtCore, QtGui, QtWidgets

from ..config_cache import ConfigCache
from ..transform_manager import TransformManager, TransformAgent
Expand Down Expand Up @@ -587,7 +587,7 @@ def _get_item_and_column(

def _get_undo_command_type(
self, column_desc: ColumnDesc
) -> Type[QtWidgets.QUndoCommand]:
) -> Type[QtGui.QUndoCommand]:
"""
Support overriding the undo command type used to
track data changes, per column.
Expand Down
2 changes: 1 addition & 1 deletion src/apps/ocioview/ocioview/items/config_properties_edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from typing import Optional

import PyOpenColorIO as ocio
from PySide2 import QtWidgets
from PySide6 import QtWidgets

from ..constants import RGB
from ..widgets import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from pathlib import Path
from typing import Any, Optional

from PySide2 import QtCore
from PySide6 import QtCore
import PyOpenColorIO as ocio

from .config_item_model import ColumnDesc, BaseConfigItemModel
Expand Down
4 changes: 1 addition & 3 deletions src/apps/ocioview/ocioview/items/delegates.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from typing import Optional

import PyOpenColorIO as ocio
from PySide2 import QtCore, QtWidgets
from PySide6 import QtCore, QtWidgets

from ..config_cache import ConfigCache
from ..widgets import CallbackComboBox
Expand Down Expand Up @@ -34,7 +34,6 @@ def createEditor(
editor = CallbackComboBox(
get_items=ConfigCache.get_color_space_names, editable=True, parent=parent
)
editor.setAutoCompletion(True)
editor.completer().setCompletionMode(QtWidgets.QCompleter.PopupCompletion)
return editor

Expand Down Expand Up @@ -119,7 +118,6 @@ def createEditor(
raise NotImplementedError

widget = CallbackComboBox(get_items=get_items, editable=True, parent=parent)
widget.setAutoCompletion(True)
widget.completer().setCompletionMode(QtWidgets.QCompleter.PopupCompletion)
return widget

Expand Down
2 changes: 1 addition & 1 deletion src/apps/ocioview/ocioview/items/display_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from typing import Any, Optional

import PyOpenColorIO as ocio
from PySide2 import QtCore
from PySide6 import QtCore

from ..config_cache import ConfigCache
from ..utils import next_name
Expand Down
2 changes: 1 addition & 1 deletion src/apps/ocioview/ocioview/items/display_view_edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from typing import Optional

from PySide2 import QtCore, QtGui, QtWidgets
from PySide6 import QtCore, QtGui, QtWidgets

from ..utils import get_glyph_icon
from .active_display_view_edit import ActiveDisplayViewEdit
Expand Down
2 changes: 1 addition & 1 deletion src/apps/ocioview/ocioview/items/file_rule_edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from typing import Optional

from PySide2 import QtCore, QtWidgets
from PySide6 import QtCore, QtWidgets

from ..config_cache import ConfigCache
from ..utils import get_glyph_icon
Expand Down
2 changes: 1 addition & 1 deletion src/apps/ocioview/ocioview/items/file_rule_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from typing import Any, Optional, Union

import PyOpenColorIO as ocio
from PySide2 import QtCore, QtGui
from PySide6 import QtCore, QtGui

from ..config_cache import ConfigCache
from ..undo import ConfigSnapshotUndoCommand
Expand Down
2 changes: 1 addition & 1 deletion src/apps/ocioview/ocioview/items/look_edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from typing import Optional

import PyOpenColorIO as ocio
from PySide2 import QtWidgets
from PySide6 import QtWidgets

from ..config_cache import ConfigCache
from ..widgets import CallbackComboBox, TextEdit
Expand Down
2 changes: 1 addition & 1 deletion src/apps/ocioview/ocioview/items/look_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from typing import Any, Optional

import PyOpenColorIO as ocio
from PySide2 import QtCore, QtGui
from PySide6 import QtCore, QtGui

from ..config_cache import ConfigCache
from ..ref_space_manager import ReferenceSpaceManager
Expand Down
2 changes: 1 addition & 1 deletion src/apps/ocioview/ocioview/items/named_transform_edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from typing import Optional

from PySide2 import QtWidgets
from PySide6 import QtWidgets

from ..config_cache import ConfigCache
from ..utils import get_glyph_icon
Expand Down
2 changes: 1 addition & 1 deletion src/apps/ocioview/ocioview/items/named_transform_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from typing import Any, Optional, Union

import PyOpenColorIO as ocio
from PySide2 import QtCore, QtGui
from PySide6 import QtCore, QtGui

from ..config_cache import ConfigCache
from ..utils import get_glyph_icon
Expand Down
2 changes: 1 addition & 1 deletion src/apps/ocioview/ocioview/items/role_edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from typing import Optional

from PySide2 import QtGui, QtWidgets
from PySide6 import QtGui, QtWidgets

from ..widgets import ItemModelTableWidget
from .delegates import RoleDelegate
Expand Down
2 changes: 1 addition & 1 deletion src/apps/ocioview/ocioview/items/role_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from typing import Any

import PyOpenColorIO as ocio
from PySide2 import QtCore
from PySide6 import QtCore

from ..config_cache import ConfigCache
from .config_item_model import ColumnDesc, BaseConfigItemModel
Expand Down
2 changes: 1 addition & 1 deletion src/apps/ocioview/ocioview/items/rule_edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from typing import Optional

from PySide2 import QtCore, QtGui, QtWidgets
from PySide6 import QtCore, QtGui, QtWidgets

from ..utils import get_glyph_icon
from .file_rule_edit import FileRuleEdit
Expand Down
2 changes: 1 addition & 1 deletion src/apps/ocioview/ocioview/items/shared_view_edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from typing import Optional

import PyOpenColorIO as ocio
from PySide2 import QtWidgets
from PySide6 import QtWidgets

from ..config_cache import ConfigCache
from ..widgets import CallbackComboBox, LineEdit
Expand Down
2 changes: 1 addition & 1 deletion src/apps/ocioview/ocioview/items/shared_view_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from typing import Any, Optional

import PyOpenColorIO as ocio
from PySide2 import QtCore, QtGui
from PySide6 import QtCore, QtGui

from ..config_cache import ConfigCache
from .config_item_model import ColumnDesc, BaseConfigItemModel
Expand Down
2 changes: 1 addition & 1 deletion src/apps/ocioview/ocioview/items/view_edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from typing import Optional

import PyOpenColorIO as ocio
from PySide2 import QtCore, QtWidgets
from PySide6 import QtCore, QtWidgets

from ..config_cache import ConfigCache
from ..transform_manager import TransformManager
Expand Down
2 changes: 1 addition & 1 deletion src/apps/ocioview/ocioview/items/view_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from typing import Any, Optional, Union

import PyOpenColorIO as ocio
from PySide2 import QtCore, QtGui
from PySide6 import QtCore, QtGui

from ..config_cache import ConfigCache
from ..ref_space_manager import ReferenceSpaceManager
Expand Down
2 changes: 1 addition & 1 deletion src/apps/ocioview/ocioview/items/view_transform_edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from functools import partial
from typing import Optional

from PySide2 import QtWidgets
from PySide6 import QtWidgets
import PyOpenColorIO as ocio

from ..config_cache import ConfigCache
Expand Down
2 changes: 1 addition & 1 deletion src/apps/ocioview/ocioview/items/view_transform_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from typing import Any, Optional, Union

import PyOpenColorIO as ocio
from PySide2 import QtCore, QtGui
from PySide6 import QtCore, QtGui

from ..config_cache import ConfigCache
from ..utils import get_enum_member, get_glyph_icon
Expand Down

0 comments on commit 45544ce

Please sign in to comment.