Skip to content

Commit

Permalink
fix(wlf_Write): v1.56.3 deadline job submit
Browse files Browse the repository at this point in the history
should respect sequence output type
  • Loading branch information
NateScarlet committed Aug 31, 2020
1 parent a40afc5 commit 955c09a
Showing 1 changed file with 42 additions and 18 deletions.
60 changes: 42 additions & 18 deletions plugins/Image/wlf_Write.gizmo
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
version 10.0 v4
Gizmo {
onCreate {
if '__wlf_Write' not in locals():
class __wlf_Write(object):
if '__wlf_Write_1_56_3' not in locals():
class __wlf_Write_1_56_3(object):
@classmethod
def on_create(cls):
this = nuke.thisNode()
Expand Down Expand Up @@ -48,7 +48,7 @@ if '__wlf_Write' not in locals():
os.makedirs(_dir)

@staticmethod
def is_reading_exr():
def is_reading():
import os
import sys
if os.getenv('WLF_IS_SEPARATE_JOBS') or nuke.numvalue('parent.reading_exr'):
Expand All @@ -60,10 +60,34 @@ if '__wlf_Write' not in locals():
ret = False
return ret

@staticmethod
def is_write_disabled(output_type):
n = nuke.thisNode()
if n['reading'].value():
return False

p = nuke.thisParent()
enabled = {
'exr': p['output_exr'].value(),
'png': p['output_png'].value(),
}
import os
if (
os.getenv('WLF_IS_SEPARATE_JOBS') and
not any(enabled.values())
):
# sequence output is required for deadline seperate jobs
enabled['exr'] = True

frame_count = abs(nuke.numvalue('root.first_frame') - nuke.numvalue('root.last_frame')) + 1
if enabled[output_type] and frame_count < p['exr_threshold'].value():
return False
return True

class WriteMOV(object):
@classmethod
def before_render(cls):
globals()['__wlf_Write'].create_output_dir(nuke.thisNode())
globals()['__wlf_Write_1_56_3'].create_output_dir(nuke.thisNode())
nuke.knob('parent.Write_JPG_1.disable', 'True')

class WriteJPG(object):
Expand All @@ -83,7 +107,7 @@ if '__wlf_Write' not in locals():
cls.last_render_mode = nuke.Root()['proxy'].value()
cls.blur_nodes = [n for n in nuke.allNodes(group=nuke.Root())
if n.Class() in cls.blur_node_classes and not n['disable'].value()]
globals()['__wlf_Write'].create_output_dir(nuke.thisNode())
globals()['__wlf_Write_1_56_3'].create_output_dir(nuke.thisNode())
nuke.knob('root.proxy', 'False')
if nuke.numvalue('parent.no_motionblur'):
map(lambda n: n['disable'].setValue(
Expand All @@ -98,19 +122,19 @@ if '__wlf_Write' not in locals():
nuke.knob('this.disable', 'True')


__wlf_Write.on_create()
__wlf_Write_1_56_3.on_create()
}
onDestroy __wlf_Write.on_destroy()
autolabel __wlf_Write.autolabel()
onDestroy __wlf_Write_1_56_3.on_destroy()
autolabel __wlf_Write_1_56_3.autolabel()
knobChanged {
try:
__wlf_Write.knob_changed()
__wlf_Write_1_56_3.knob_changed()
except NameError:
pass
}
tile_color 0xbfbf00ff
note_font 微软雅黑
addUserKnob {20 Write l "wlf_Write v1.56.2"}
addUserKnob {20 Write l "wlf_Write v1.56.3"}
addUserKnob {41 format l 输出格式 T Reformat1.format}
addUserKnob {45 views l 视图}
views {main}
Expand Down Expand Up @@ -295,8 +319,8 @@ use_limit true
checkHashOnRead false
in_colorspace linear
out_colorspace linear
beforeRender __wlf_Write.WriteJPG.before_render()
afterRender __wlf_Write.WriteJPG.after_render()
beforeRender __wlf_Write_1_56_3.WriteJPG.before_render()
afterRender __wlf_Write_1_56_3.WriteJPG.after_render()
name Write_JPG_1
label "单帧\n会在退出脚本时自动输出"
xpos 0
Expand All @@ -308,12 +332,12 @@ file "sequences/\[lindex \[split \[basename \[value root.name]] .] 0]/\[lindex \
proxy "sequences/proxy/\[lindex \[split \[basename \[value root.name]] .] 0]/\[lindex \[split \[basename \[value root.name]] .] 0].%d.exr"
file_type exr
render_order 0
reading {{"\[python __wlf_Write.is_reading_exr()]"}}
reading {{"\[python __wlf_Write_1_56_3.is_reading()]"}}
checkHashOnRead false
name Write_EXR_1
xpos 0
ypos -918
disable {{"!(reading | \[python bool(os.getenv('WLF_IS_SEPARATE_JOBS'))] | parent.output_exr & ((abs(root.last_frame - root.first_frame) + 1) >= parent.exr_threshold))"}}
disable {{"\[python __wlf_Write_1_56_3.is_write_disabled('exr')]"}}
}
Write {
channels {rgba.red rgba.green rgba.blue rgba.alpha}
Expand All @@ -322,13 +346,13 @@ proxy "sequences/proxy/\[lindex \[split \[basename \[value root.name]] .] 0]/\[l
file_type png
datatype "16 bit"
render_order 0
reading {{"\[python __wlf_Write.is_reading_exr()]"}}
reading {{"\[python __wlf_Write_1_56_3.is_reading()]"}}
checkHashOnRead false
name Write_PNG_1
selected true
xpos 0
ypos -862
disable {{"!(reading | \[python bool(os.getenv('WLF_IS_SEPARATE_JOBS'))] | parent.output_png & ((abs(root.last_frame - root.first_frame) + 1) >= parent.exr_threshold))"}}
disable {{"\[python __wlf_Write_1_56_3.is_write_disabled('png')]"}}
}
Write {
file "mov/\[lindex \[split \[basename \[value root.name]] .] 0].mov"
Expand All @@ -341,7 +365,7 @@ mov32_codec "rle "
mov32_pixel_format {{0} "default (RGBA 8-bit)" "RGBA 8-bit"}
mov64_codec apch
mov64_fps {{root.fps}}
beforeRender __wlf_Write.WriteMOV.before_render()
beforeRender __wlf_Write_1_56_3.WriteMOV.before_render()
name Write_MOV_1
xpos 0
ypos -806
Expand All @@ -365,7 +389,7 @@ mov64_codec apch
mov64_fps {{root.fps}}
render_order 2
checkHashOnRead false
beforeRender __wlf_Write.WriteMOV.before_render()
beforeRender __wlf_Write_1_56_3.WriteMOV.before_render()
name Write_MOV_2
label 带帧编号的MOV
xpos 0
Expand Down

0 comments on commit 955c09a

Please sign in to comment.