Skip to content

Commit

Permalink
Updated tk-hiero-export to support new NFA ShotGrid Write Node
Browse files Browse the repository at this point in the history
  • Loading branch information
gillesvink committed Nov 5, 2021
1 parent 4eae1ed commit 758645f
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 27 deletions.
7 changes: 4 additions & 3 deletions info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ configuration:
creating new shots in Shotgun. This setting is presented
in the Custom Shotgun Export UI and you can change it
prior to running the export if you want.
default_value: Basic shot template
default_value: 2D Shot

audio_published_file_type:
type: tank_type
Expand Down Expand Up @@ -35,8 +35,9 @@ configuration:
values:
type: dict
items:
channel: { type: str }
name: { type: str }
category: { type: str}
output: { type: str }
data_type: { type: str }
description:

custom_template_fields:
Expand Down
35 changes: 21 additions & 14 deletions python/tk_hiero_export/sg_nuke_shot_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def populateUI(self, widget, exportTemplate):
properties = self._preset.properties()

for node in nodes:
name = 'Toolkit Node: %s ("%s")' % (node["name"], node["channel"])
name = 'Toolkit Node: <%s> <%s> <%s>' % (node["category"], node["output"], node["data_type"])
item = QtGui.QStandardItem(name)
item.setFlags(QtCore.Qt.ItemIsUserCheckable | QtCore.Qt.ItemIsEnabled)
if name in properties["toolkitWriteNodes"]:
Expand Down Expand Up @@ -163,7 +163,7 @@ def taskStep(self):
return FnNukeShotExporter.NukeShotExporter.taskStep(self)

def startTask(self):
""" Run Task """
"""Run Task"""
# call the publish data hook to allow for publish customization while _item is valid (unlike finishTask)
self._extra_publish_data = self.app.execute_hook(
"hook_get_extra_publish_data",
Expand Down Expand Up @@ -268,7 +268,7 @@ def isExportingItem(self, item):

def _beforeNukeScriptWrite(self, script):
"""
Add ShotgunWriteNodePlaceholder Metadata nodes for tk-nuke-writenode to
Add ShotGridWriteNodePlaceholder Metadata nodes for tk-nuke-writenode to
create full Tk WriteNodes in the Nuke environment
Also add createTemplatePlaceholder nodes to activate the conversion progress to a custom template.
Expand All @@ -291,31 +291,38 @@ def _beforeNukeScriptWrite(self, script):
try:
for toolkit_specifier in self._preset.properties()["toolkitWriteNodes"]:
# break down a string like 'Toolkit Node: Mono Dpx ("editorial")' into name and output
match = re.match(
'^Toolkit Node: (?P<name>.+) \("(?P<output>.+)"\)',
toolkit_specifier,
)
regex = "(?<=\<)(.*?)(?=\>)"
match = re.findall(regex, toolkit_specifier)

dictionary = {
"category": match[0],
"output": match[1],
"data_type": match[2],
}

metadata = match.groupdict()
shotGridWriteNode = nuke.MetadataNode(metadatavalues=list(metadata.items()))
shotGridWriteNode.setName("ShotgunWriteNodePlaceholder")
shotGridWriteNode = nuke.MetadataNode(
metadatavalues=list(dictionary.items())
)
shotGridWriteNode.setName("ShotGridWriteNodePlaceholder")

createTemplatePlaceholder = nuke.MetadataNode()
createTemplatePlaceholder.setName("createTemplatePlaceholder")

self.app.log_debug(
"Created ShotgunWriteNodePlaceholder Node: %s" % shotGridWriteNode._knobValues
"Created ShotgunWriteNodePlaceholder Node: %s"
% shotGridWriteNode._knobValues
)

self.app.log_debug(
"Created createTemplatePlaceholder Node: %s" % createTemplatePlaceholder._knobValues
"Created createTemplatePlaceholder Node: %s"
% createTemplatePlaceholder._knobValues
)
# rather than using the script.addNode, we append our node directly to the nodeList
nodeList.append(shotGridWriteNode)
nodeList.append(createTemplatePlaceholder)

# now add our new node to the layout
currentLayoutContext.getNodes().append(node)
currentLayoutContext.getNodes().append(shotGridWriteNode)
except Exception:
self.app.logger.exception("Failed to add SG writenodes")
finally:
Expand Down Expand Up @@ -346,7 +353,7 @@ def __init__(self, name, properties):
toolkit_write_nodes = []
nodes = self.app.get_setting("nuke_script_toolkit_write_nodes")
for node in nodes:
name = 'Toolkit Node: %s ("%s")' % (node["name"], node["channel"])
name = 'Toolkit Node: <%s> <%s> <%s>' % (node["category"], node["output"], node["data_type"])
toolkit_write_nodes.append(name)
self.properties()["toolkitWriteNodes"] = toolkit_write_nodes

Expand Down
19 changes: 9 additions & 10 deletions python/tk_hiero_export/sg_shot_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ def __init__(self, preset):
CollatingExporterUI.__init__(self)

def displayName(self):
return "Process as Shotgun Shots"
return "Process as ShotGrid Shots"

def toolTip(self):
return "Process as Shotgun Shots generates output on a per-shot basis and logs it in Shotgun."
return "Process as ShotGrid Shots generates output on a per-shot basis and logs it in Shotgun."

def populateUI(self, *args, **kwargs):
"""
Expand All @@ -85,7 +85,7 @@ def populateUI(self, *args, **kwargs):

# add group box for shotgun stuff
shotgun_groupbox = QtGui.QGroupBox(
"Shotgun Shot and Sequence Creation Settings"
"ShotGrid Shot and Sequence Creation Settings"
)
master_layout.addWidget(shotgun_groupbox)
shotgun_layout = QtGui.QVBoxLayout(shotgun_groupbox)
Expand All @@ -95,13 +95,12 @@ def populateUI(self, *args, **kwargs):
header_text.setWordWrap(True)
header_text.setText(
"""
<big>Welcome to the Shotgun Shot Exporter!</big>
<p>When you are using the Shotgun Shot Processor, Shots and
Sequences in Shotgun will be created based on the curent timeline.
Existing Shots will be updated with the latest cut lengths.
Quicktimes for each shot will be reviewable in the Media app when
you use the special Shotgun Transcode plugin - all included and
ready to go in the default preset.
<big>Welcome to the Netherlands Filmacademy Shot Exporter! :)</big>
<p>If you wish to use a 3D task template, make sure to assign tags to the shots. Otherwise the
2D Shot template will be assigned.</p>
<p>During exporting
each shot will be automatically renamed, rendered to a quicktime for
preview in ShotGrid, and a Nuke file including the read node will be created.
</p>
"""
)
Expand Down

0 comments on commit 758645f

Please sign in to comment.