Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Settings: Move imageio from project anatomy to project settings [pypeclub] #3959

Merged
merged 13 commits into from
Oct 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions openpype/hosts/flame/hooks/pre_flame_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,9 @@ def execute(self):
volume_name = _env.get("FLAME_WIRETAP_VOLUME")

# get image io
project_anatomy = self.data["anatomy"]

# make sure anatomy settings are having flame key
if not project_anatomy["imageio"].get("flame"):
raise ApplicationLaunchFailed((
"Anatomy project settings are missing `flame` key. "
"Please make sure you remove project overides on "
"Anatomy Image io")
)
project_settings = self.data["project_settings"]

imageio_flame = project_anatomy["imageio"]["flame"]
imageio_flame = project_settings["flame"]["imageio"]

# get user name and host name
user_name = get_openpype_username()
Expand Down
8 changes: 1 addition & 7 deletions openpype/hosts/fusion/hooks/pre_fusion_ocio_hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,7 @@ def execute(self):
project_settings = self.data["project_settings"]

# make sure anatomy settings are having flame key
imageio_fusion = project_settings.get("fusion", {}).get("imageio")
if not imageio_fusion:
raise ApplicationLaunchFailed((
"Anatomy project settings are missing `fusion` key. "
"Please make sure you remove project overrides on "
"Anatomy ImageIO")
)
imageio_fusion = project_settings["fusion"]["imageio"]

ocio = imageio_fusion.get("ocio")
enabled = ocio.get("enabled", False)
Expand Down
8 changes: 3 additions & 5 deletions openpype/hosts/hiero/api/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from Qt import QtWidgets

from openpype.client import get_project
from openpype.settings import get_anatomy_settings
from openpype.settings import get_project_settings
from openpype.pipeline import legacy_io, Anatomy
from openpype.pipeline.load import filter_containers
from openpype.lib import Logger
Expand Down Expand Up @@ -878,8 +878,7 @@ def apply_colorspace_project():
project.close()

# get presets for hiero
imageio = get_anatomy_settings(
project_name)["imageio"].get("hiero", None)
imageio = get_project_settings(project_name)["hiero"]["imageio"]
presets = imageio.get("workfile")

# save the workfile as subversion "comment:_colorspaceChange"
Expand Down Expand Up @@ -932,8 +931,7 @@ def apply_colorspace_clips():
clips = project.clips()

# get presets for hiero
imageio = get_anatomy_settings(
project_name)["imageio"].get("hiero", None)
imageio = get_project_settings(project_name)["hiero"]["imageio"]
from pprint import pprint

presets = imageio.get("regexInputs", {}).get("inputs", {})
Expand Down
4 changes: 2 additions & 2 deletions openpype/hosts/maya/api/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
get_last_versions,
get_representation_by_name
)
from openpype.settings import get_anatomy_settings
from openpype.settings import get_project_settings
from openpype.pipeline import (
legacy_io,
discover_loader_plugins,
Expand Down Expand Up @@ -3159,7 +3159,7 @@ def set_colorspace():
"""Set Colorspace from project configuration
"""
project_name = os.getenv("AVALON_PROJECT")
imageio = get_anatomy_settings(project_name)["imageio"]["maya"]
imageio = get_project_settings(project_name)["maya"]["imageio"]

# Maya 2022+ introduces new OCIO v2 color management settings that
# can override the old color managenement preferences. OpenPype has
Expand Down
10 changes: 9 additions & 1 deletion openpype/hosts/nuke/api/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,15 @@ def get_node_path(path, padding=4):


def get_nuke_imageio_settings():
return get_anatomy_settings(Context.project_name)["imageio"]["nuke"]
project_imageio = get_project_settings(
Context.project_name)["nuke"]["imageio"]

# backward compatibility for project started before 3.10
jakubjezek001 marked this conversation as resolved.
Show resolved Hide resolved
# those are still having `__legacy__` knob types
if not project_imageio["enabled"]:
return get_anatomy_settings(Context.project_name)["imageio"]["nuke"]

return get_project_settings(Context.project_name)["nuke"]["imageio"]


def get_created_node_imageio_setting_legacy(nodeclass, creator, subset):
Expand Down
2 changes: 1 addition & 1 deletion openpype/hosts/nuke/plugins/load/load_clip.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ def _set_colorspace(self, node, version_data, repre_data, path=None):
colorspace = repre_data.get("colorspace")
colorspace = colorspace or version_data.get("colorspace")

# colorspace from `project_anatomy/imageio/nuke/regexInputs`
# colorspace from `project_settings/nuke/imageio/regexInputs`
iio_colorspace = get_imageio_input_colorspace(path)

# Set colorspace defined in version data
Expand Down
13 changes: 8 additions & 5 deletions openpype/hosts/nuke/plugins/publish/validate_write_nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,14 @@ def process(self, instance):

# fix type differences
if type(node_value) in (int, float):
if isinstance(value, list):
value = color_gui_to_int(value)
else:
value = float(value)
node_value = float(node_value)
try:
if isinstance(value, list):
value = color_gui_to_int(value)
else:
value = float(value)
node_value = float(node_value)
except ValueError:
value = str(value)
else:
value = str(value)
node_value = str(node_value)
Expand Down
19 changes: 19 additions & 0 deletions openpype/settings/defaults/project_settings/flame.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,23 @@
{
"imageio": {
"project": {
"colourPolicy": "ACES 1.1",
"frameDepth": "16-bit fp",
"fieldDominance": "PROGRESSIVE"
},
"profilesMapping": {
"inputs": [
{
"flameName": "ACEScg",
"ocioName": "ACES - ACEScg"
},
{
"flameName": "Rec.709 video",
"ocioName": "Output - Rec.709"
}
]
}
},
"create": {
"CreateShotClip": {
"hierarchy": "{folder}/{sequence}",
Expand Down
25 changes: 25 additions & 0 deletions openpype/settings/defaults/project_settings/hiero.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,29 @@
{
"imageio": {
"workfile": {
"ocioConfigName": "nuke-default",
"ocioconfigpath": {
"windows": [],
"darwin": [],
"linux": []
},
"workingSpace": "linear",
"sixteenBitLut": "sRGB",
"eightBitLut": "sRGB",
"floatLut": "linear",
"logLut": "Cineon",
"viewerLut": "sRGB",
"thumbnailLut": "sRGB"
},
"regexInputs": {
"inputs": [
{
"regex": "[^-a-zA-Z0-9](plateRef).*(?=mp4)",
"colorspace": "sRGB"
}
]
}
},
"create": {
"CreateShotClip": {
"hierarchy": "{folder}/{sequence}",
Expand Down
22 changes: 22 additions & 0 deletions openpype/settings/defaults/project_settings/maya.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,26 @@
{
"imageio": {
"colorManagementPreference_v2": {
"enabled": true,
"configFilePath": {
"windows": [],
"darwin": [],
"linux": []
},
"renderSpace": "ACEScg",
"displayName": "sRGB",
"viewName": "ACES 1.0 SDR-video"
},
"colorManagementPreference": {
"configFilePath": {
"windows": [],
"darwin": [],
"linux": []
},
"renderSpace": "scene-linear Rec 709/sRGB",
"viewTransform": "sRGB gamma"
}
},
"mel_workspace": "workspace -fr \"shaders\" \"renderData/shaders\";\nworkspace -fr \"images\" \"renders\";\nworkspace -fr \"particles\" \"particles\";\nworkspace -fr \"mayaAscii\" \"\";\nworkspace -fr \"mayaBinary\" \"\";\nworkspace -fr \"scene\" \"\";\nworkspace -fr \"alembicCache\" \"cache/alembic\";\nworkspace -fr \"renderData\" \"renderData\";\nworkspace -fr \"sourceImages\" \"sourceimages\";\nworkspace -fr \"fileCache\" \"cache/nCache\";\n",
"ext_mapping": {
"model": "ma",
Expand Down
Loading