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

Nuke: Support options for reading deep exr in load clips #555

Merged
merged 3 commits into from
May 27, 2024
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
64 changes: 41 additions & 23 deletions server_addon/nuke/client/ayon_nuke/plugins/load/load_clip.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ class LoadClip(plugin.NukeLoader):
# option gui
options_defaults = {
"start_at_workfile": True,
"add_retime": True
"add_retime": True,
"deep_exr": False
}

node_name_template = "{class_name}_{ext}"
Expand All @@ -80,6 +81,11 @@ def get_options(cls, *args):
"add_retime",
help="Load with retime",
default=cls.options_defaults["add_retime"]
),
qargparse.Boolean(
"deep_exr",
help="Read with deep exr",
default=cls.options_defaults["deep_exr"]
)
]

Expand Down Expand Up @@ -115,6 +121,9 @@ def load(self, context, name, namespace, options):
add_retime = options.get(
"add_retime", self.options_defaults["add_retime"])

deep_exr = options.get(
"deep_exr", self.options_defaults["deep_exr"])

repre_id = repre_entity["id"]

self.log.debug(
Expand Down Expand Up @@ -155,13 +164,21 @@ def load(self, context, name, namespace, options):
return

read_name = self._get_node_name(context)

# Create the Loader with the filename path set
read_node = nuke.createNode(
"Read",
"name {}".format(read_name),
inpanel=False
)
read_node = None
if deep_exr:
# Create the Loader with the filename path set
read_node = nuke.createNode(
"DeepRead",
"name {}".format(read_name),
inpanel=False
)
else:
# Create the Loader with the filename path set
read_node = nuke.createNode(
"Read",
"name {}".format(read_name),
inpanel=False
)

# get colorspace
colorspace = (
Expand All @@ -173,14 +190,14 @@ def load(self, context, name, namespace, options):
# we will switch off undo-ing
with viewer_update_and_undo_stop():
read_node["file"].setValue(filepath)

self.set_colorspace_to_node(
read_node,
filepath,
project_name,
version_entity,
repre_entity
)
if read_node.Class() == "Read":
self.set_colorspace_to_node(
read_node,
filepath,
project_name,
version_entity,
repre_entity
)

self._set_range_to_node(
read_node, first, last, start_at_workfile, slate_frames
Expand Down Expand Up @@ -330,13 +347,14 @@ def update(self, container, context):
# to avoid multiple undo steps for rest of process
# we will switch off undo-ing
with viewer_update_and_undo_stop():
self.set_colorspace_to_node(
read_node,
filepath,
project_name,
version_entity,
repre_entity
)
if read_node.Class() == "Read":
self.set_colorspace_to_node(
read_node,
filepath,
project_name,
version_entity,
repre_entity
)

self._set_range_to_node(read_node, first, last, start_at_workfile)

Expand Down
2 changes: 1 addition & 1 deletion server_addon/nuke/package.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "nuke"
title = "Nuke"
version = "0.2.0"
version = "0.2.1"

client_dir = "ayon_nuke"

Expand Down
7 changes: 5 additions & 2 deletions server_addon/nuke/server/settings/loader_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ class LoadClipOptionsModel(BaseSettingsModel):
add_retime: bool = SettingsField(
title="Add retime"
)

deep_exr: bool = SettingsField(
title="Deep Exr Read Node"
)

class LoadClipModel(BaseSettingsModel):
enabled: bool = SettingsField(
Expand Down Expand Up @@ -65,7 +67,8 @@ class LoaderPluginsModel(BaseSettingsModel):
"node_name_template": "{class_name}_{ext}",
"options_defaults": {
"start_at_workfile": True,
"add_retime": True
"add_retime": True,
"deep_exr": False
}
}
}