Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #3363 from pypeclub/bugfix/nuke_extract_thumbnail_…
Browse files Browse the repository at this point in the history
…missing_variables

Nuke: Fix missing variable in extract thumbnail
  • Loading branch information
iLLiCiTiT authored Jun 17, 2022
2 parents 2ad2743 + b9abbcd commit a4ef21d
Showing 1 changed file with 33 additions and 35 deletions.
68 changes: 33 additions & 35 deletions openpype/hosts/nuke/plugins/publish/extract_thumbnail.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,48 +65,46 @@ def render_thumbnail(self, instance):
temporary_nodes = []

# try to connect already rendered images
if self.use_rendered:
collection = instance.data.get("collection", None)
self.log.debug("__ collection: `{}`".format(collection))
previous_node = node
collection = instance.data.get("collection", None)
self.log.debug("__ collection: `{}`".format(collection))

if collection:
# get path
fname = os.path.basename(collection.format(
"{head}{padding}{tail}"))
fhead = collection.format("{head}")
if collection:
# get path
fname = os.path.basename(collection.format(
"{head}{padding}{tail}"))
fhead = collection.format("{head}")

thumb_fname = list(collection)[mid_frame]
else:
fname = thumb_fname = os.path.basename(
instance.data.get("path", None))
fhead = os.path.splitext(fname)[0] + "."
thumb_fname = list(collection)[mid_frame]
else:
fname = thumb_fname = os.path.basename(
instance.data.get("path", None))
fhead = os.path.splitext(fname)[0] + "."

self.log.debug("__ fhead: `{}`".format(fhead))
self.log.debug("__ fhead: `{}`".format(fhead))

if "#" in fhead:
fhead = fhead.replace("#", "")[:-1]
if "#" in fhead:
fhead = fhead.replace("#", "")[:-1]

path_render = os.path.join(
staging_dir, thumb_fname).replace("\\", "/")
self.log.debug("__ path_render: `{}`".format(path_render))
path_render = os.path.join(
staging_dir, thumb_fname).replace("\\", "/")
self.log.debug("__ path_render: `{}`".format(path_render))

if self.use_rendered and os.path.isfile(path_render):
# check if file exist otherwise connect to write node
if os.path.isfile(path_render):
rnode = nuke.createNode("Read")

rnode["file"].setValue(path_render)

# turn it raw if none of baking is ON
if all([
not self.bake_viewer_input_process,
not self.bake_viewer_process
]):
rnode["raw"].setValue(True)

temporary_nodes.append(rnode)
previous_node = rnode
else:
previous_node = node
rnode = nuke.createNode("Read")

rnode["file"].setValue(path_render)

# turn it raw if none of baking is ON
if all([
not self.bake_viewer_input_process,
not self.bake_viewer_process
]):
rnode["raw"].setValue(True)

temporary_nodes.append(rnode)
previous_node = rnode

# bake viewer input look node into thumbnail image
if self.bake_viewer_input_process:
Expand Down

0 comments on commit a4ef21d

Please sign in to comment.