Skip to content

Commit

Permalink
fix: Update frame range when write node is selected (#161)
Browse files Browse the repository at this point in the history
Signed-off-by: Haejung Choi <[email protected]>
Co-authored-by: Haejung Choi <[email protected]>
  • Loading branch information
diane-hj and Haejung Choi authored Aug 21, 2024
1 parent ed5438d commit e6398c9
Show file tree
Hide file tree
Showing 6 changed files with 272 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
assetReferences:
inputs:
directories: []
filenames:
- /normalized/job/bundle/dir/frame.nk
outputs:
directories:
- /normalized/cwd
referencedPaths: []
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
parameterValues:
- name: Frames
value: 3-7
- name: NukeScriptFile
value: /normalized/job/bundle/dir/frame.nk
- name: WriteNode
value: Write1
- name: ProxyMode
value: 'false'
- name: deadline:targetTaskRunStatus
value: READY
- name: deadline:maxFailedTasksCount
value: 20
- name: deadline:maxRetriesPerTask
value: 5
- name: deadline:priority
value: 50
128 changes: 128 additions & 0 deletions job_bundle_output_tests/frame/expected_job_bundle/template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
specificationVersion: jobtemplate-2023-09
name: frame.nk
parameterDefinitions:
- name: NukeScriptFile
type: PATH
objectType: FILE
dataFlow: IN
userInterface:
control: CHOOSE_INPUT_FILE
label: Nuke Script File
fileFilters:
- label: Nuke Script Files
patterns:
- '*.nk'
- label: All Files
patterns:
- '*'
description: The Nuke script file to render.
- name: Frames
type: STRING
description: The frames to render. E.g. 1-3,8,11-15
minLength: 1
- name: WriteNode
type: STRING
userInterface:
control: DROPDOWN_LIST
label: Write Node
description: Which write node to render ('All Write Nodes' for all of them)
default: All Write Nodes
allowedValues:
- All Write Nodes
- Write1
- name: View
type: STRING
userInterface:
control: DROPDOWN_LIST
description: Which view to render ('All Views' for all of them)
default: All Views
allowedValues:
- All Views
- main
- name: ProxyMode
type: STRING
userInterface:
control: CHECK_BOX
label: Proxy Mode
description: Render in Proxy Mode.
default: 'false'
allowedValues:
- 'true'
- 'false'
- name: ContinueOnError
type: STRING
userInterface:
control: CHECK_BOX
label: Continue On Error
description: Continue processing when errors occur.
default: 'false'
allowedValues:
- 'true'
- 'false'
steps:
- name: Render
parameterSpace:
taskParameterDefinitions:
- name: Frame
type: INT
range: '{{Param.Frames}}'
stepEnvironments:
- name: Nuke
description: Runs Nuke in the background with a script file loaded.
script:
embeddedFiles:
- name: initData
filename: init-data.yaml
type: TEXT
data: |
continue_on_error: {{Param.ContinueOnError}}
proxy: {{Param.ProxyMode}}
script_file: '{{Param.NukeScriptFile}}'
write_nodes:
- '{{Param.WriteNode}}'
views:
- '{{Param.View}}'
actions:
onEnter:
command: NukeAdaptor
args:
- daemon
- start
- --path-mapping-rules
- file://{{Session.PathMappingRulesFile}}
- --connection-file
- '{{Session.WorkingDirectory}}/connection.json'
- --init-data
- file://{{ Env.File.initData }}
cancelation:
mode: NOTIFY_THEN_TERMINATE
timeout: 86400
onExit:
command: NukeAdaptor
args:
- daemon
- stop
- --connection-file
- '{{ Session.WorkingDirectory }}/connection.json'
cancelation:
mode: NOTIFY_THEN_TERMINATE
timeout: 3600
script:
embeddedFiles:
- name: runData
filename: run-data.yaml
type: TEXT
data: 'frameRange: "{{Task.Param.Frame}}"'
actions:
onRun:
command: NukeAdaptor
args:
- daemon
- run
- --connection-file
- '{{Session.WorkingDirectory}}/connection.json'
- --run-data
- file://{{ Task.File.runData }}
cancelation:
mode: NOTIFY_THEN_TERMINATE
timeout: 518400
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "frame.nk",
"description": "",
"override_frame_range": false,
"frame_list": "1-100",
"write_node_selection": "Write1",
"view_selection": "",
"is_proxy_mode": false,
"input_filenames": [],
"input_directories": [],
"output_directories": [],
"timeouts_enabled": true,
"on_run_timeout_seconds": 518400,
"on_enter_timeout_seconds": 86400,
"on_exit_timeout_seconds": 3600,
"include_adaptor_wheels": false
}
78 changes: 78 additions & 0 deletions job_bundle_output_tests/frame/scene/frame.nk
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
#! /Applications/Nuke15.0v4/Nuke15.0v4.app/Contents/MacOS/libnuke-15.0.4.dylib -nx
#write_info Write1 file:"ColorBars.png" format:"2048 1556 1" chans:":rgba.red:rgba.green:rgba.blue:" framerange:"1 100" fps:"0" colorspace:"default (sRGB)" datatype:"8 bit" transfer:"unknown" views:"main" colorManagement:"Nuke"
version 15.0 v4
define_window_layout_xml {<?xml version="1.0" encoding="UTF-8"?>
<layout version="1.0">
<window x="0" y="38" w="1512" h="916" maximized="1" screen="0">
<splitter orientation="1">
<split size="40"/>
<dock id="" hideTitles="1" activePageId="Toolbar.1">
<page id="Toolbar.1"/>
</dock>
<split size="849" stretch="1"/>
<splitter orientation="2">
<split size="526"/>
<dock id="" activePageId="Viewer.1">
<page id="Viewer.1"/>
</dock>
<split size="370"/>
<dock id="" activePageId="DAG.1">
<page id="DAG.1"/>
<page id="Curve Editor.1"/>
<page id="DopeSheet.1"/>
</dock>
</splitter>
<split size="615"/>
<dock id="" activePageId="Properties.1" focus="true">
<page id="Properties.1"/>
<page id="uk.co.thefoundry.backgroundrenderview.1"/>
<page id="Scenegraph.1"/>
</dock>
</splitter>
</window>
</layout>
}
Root {
inputs 0
name /Users/chaejung/Desktop/submitter/deadline-cloud-for-nuke/job_bundle_output_tests/frame/scene/frame.nk
format "2048 1556 0 0 2048 1556 1 2K_Super_35(full-ap)"
proxy_type scale
proxy_format "1024 778 0 0 1024 778 1 1K_Super_35(full-ap)"
colorManagement Nuke
workingSpaceLUT linear
monitorLut sRGB
monitorOutLUT rec709
int8Lut sRGB
int16Lut sRGB
logLut Cineon
floatLut linear
}
ColorBars {
inputs 0
name ColorBars1
xpos -195
ypos -157
}
Write {
file ColorBars.png
file_type png
first 3
last 7
use_limit true
checkHashOnRead false
ocioColorspace scene_linear
display default
view sRGB
name Write1
selected true
xpos -195
ypos -83
}
Viewer {
frame_range 1-100
monitorOutNDISenderName "Nuke - frame - Viewer1"
monitorOutOutputTransform rec709
name Viewer1
xpos -195
ypos -57
}
32 changes: 23 additions & 9 deletions src/deadline/nuke_submitter/deadline_submitter_for_nuke.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,15 +146,13 @@ def _get_job_template(settings: RenderSubmitterUISettings) -> dict[str, Any]:

# Determine whether this is a movie render. If it is, we want to ensure that the entire Nuke
# evaluation is placed on one task.
write_node, _ = _get_write_node(settings)
write_node, write_node_name = _get_write_node(settings)
movie_render = "file_type" in write_node.knobs() and write_node["file_type"].value() in [
"mov",
"mxf",
]
if movie_render:
frame_list = (
settings.frame_list if settings.override_frame_range else str(write_node.frameRange())
)
frame_list = _get_frame_list(settings, write_node, write_node_name)
match = re.match(r"(\d+)-(\d+)", frame_list)
if not match:
raise DeadlineOperationError(
Expand All @@ -181,11 +179,9 @@ def _get_parameter_values(
write_node, write_node_name = _get_write_node(settings)

# Set the Frames parameter value
if settings.override_frame_range:
frame_list = settings.frame_list
else:
frame_list = str(write_node.frameRange())
parameter_values.append({"name": "Frames", "value": frame_list})
parameter_values.append(
{"name": "Frames", "value": _get_frame_list(settings, write_node, write_node_name)}
)

# Set the Nuke script file value
parameter_values.append({"name": "NukeScriptFile", "value": get_nuke_script_file()})
Expand Down Expand Up @@ -247,6 +243,24 @@ def _get_parameter_values(
return parameter_values


def _get_frame_list(
settings: RenderSubmitterUISettings,
write_node: Node,
write_node_name: Optional[str],
) -> str:
# Set the Frames parameter value
if settings.override_frame_range:
frame_list = settings.frame_list
else:
# frame range from project setting
frame_list = str(nuke.root().frameRange())
if write_node_name and write_node.knob("use_limit").value():
first_frame = int(write_node.knob("first").value())
last_frame = int(write_node.knob("last").value())
frame_list = f"{first_frame}-{last_frame}"
return frame_list


def show_nuke_render_submitter(parent, f=Qt.WindowFlags()) -> "SubmitJobToDeadlineDialog":
global g_submitter_dialog

Expand Down

0 comments on commit e6398c9

Please sign in to comment.