Skip to content

Commit

Permalink
feat(wlf_Write): v1.58.0: allow set colorspace
Browse files Browse the repository at this point in the history
  • Loading branch information
NateScarlet committed Jun 6, 2022
1 parent 5272a37 commit cec8335
Showing 1 changed file with 26 additions and 22 deletions.
48 changes: 26 additions & 22 deletions plugins/Image/wlf_Write.gizmo
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
version 10.0 v4
Gizmo {
onCreate {
if '__wlf_Write_1_57_1' not in locals():
if '__wlf_Write_1_58_0' not in locals():
# need call this before create to affect first node.
# already done in lib/pref.py
nuke.knobDefault("wlf_Write.__initiated", "false")
class __wlf_Write_1_57_1(object):
class __wlf_Write_1_58_0(object):
@classmethod
def preset_path(cls, name):
import os
Expand All @@ -35,6 +35,8 @@ if '__wlf_Write_1_57_1' not in locals():
'format',
'mov_codec',
'no_motionblur',
'exr_colorspace',
'mov_colorspace',
)
@classmethod
def save_preset(cls, name):
Expand Down Expand Up @@ -137,7 +139,7 @@ if '__wlf_Write_1_57_1' not in locals():
class WriteMOV(object):
@classmethod
def before_render(cls):
globals()['__wlf_Write_1_57_1'].create_output_dir(nuke.thisNode())
globals()['__wlf_Write_1_58_0'].create_output_dir(nuke.thisNode())
nuke.knob('parent.Write_JPG_1.disable', 'True')

class WriteJPG(object):
Expand All @@ -157,7 +159,7 @@ if '__wlf_Write_1_57_1' 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_1_57_1'].create_output_dir(nuke.thisNode())
globals()['__wlf_Write_1_58_0'].create_output_dir(nuke.thisNode())
nuke.knob('root.proxy', 'False')
if nuke.numvalue('parent.no_motionblur'):
map(lambda n: n['disable'].setValue(
Expand All @@ -170,13 +172,13 @@ if '__wlf_Write_1_57_1' not in locals():
map(lambda n: n['disable'].setValue(
False), cls.blur_nodes)
nuke.knob('this.disable', 'True')
__wlf_Write_1_57_1.on_create()
__wlf_Write_1_58_0.on_create()
}
onDestroy __wlf_Write_1_57_1.on_destroy()
autolabel __wlf_Write_1_57_1.autolabel()
onDestroy __wlf_Write_1_58_0.on_destroy()
autolabel __wlf_Write_1_58_0.autolabel()
knobChanged {
try:
__wlf_Write_1_57_1.knob_changed()
__wlf_Write_1_58_0.knob_changed()
except NameError:
pass
}
Expand All @@ -199,21 +201,23 @@ except NameError:
addUserKnob {6 no_motionblur l 渲染时不带运动模糊 +STARTLINE}
no_motionblur true
addUserKnob {26 exr_text l 序列}
addUserKnob {3 exr_threshold l 启用阈值 t 工程长度大于此值时才会输出 -STARTLINE}
exr_threshold 100
addUserKnob {6 output_exr l exr t 输出exr +STARTLINE}
addUserKnob {41 exr_colorspace l 颜色 T Write_EXR_1.colorspace -STARTLINE}
output_exr true
addUserKnob {6 output_png l png t 输出png -STARTLINE}
addUserKnob {6 output_png l png t 输出png +STARTLINE}
output_png false
addUserKnob {3 exr_threshold l 启用阈值 t 工程长度大于此值时才会输出 -STARTLINE}
exr_threshold 100
addUserKnob {26 video_text l 视频}
addUserKnob {6 output_mov l mov t 输出mov +STARTLINE}
output_mov true
addUserKnob {41 mov_codec l 编码 T Write_MOV_1.meta_codec -STARTLINE}
addUserKnob {41 mov_colorspace l 颜色 T Write_MOV_1.colorspace -STARTLINE}
addUserKnob {26 ""}
addUserKnob {32 bt_render_JPG l 渲染单帧 T "knob this.reading none\nknob this.Write_JPG_1.disable 0\nknob this.Read_JPG_1.disable 1\nexecute this.Write_JPG_1 \[value this.knob.frame]\nknob this.Read_JPG_1.version \[expr \[value this.Read_JPG_1.version]+1]\nknob this.Read_JPG_1.disable 0\nknob this.reading jpg" +STARTLINE}
addUserKnob {22 bt_render l 渲染已选 -STARTLINE T "nukescripts.showRenderDialog(\[nuke.thisNode()], False)"}
addUserKnob {6 reading_exr l 读取序列 t "渲染视频时不再计算已经输出了序列的帧, 直接读取结果"}
addUserKnob {22 bt_save_default l 设为默认配置 t "将当前配置设为默认值" -STARTLINE T "cls = __wlf_Write_1_57_1\ncls.save_preset('default')\nnuke.message('已保存至:\\n%s' % cls.preset_path('default'))"}
addUserKnob {22 bt_save_default l 设为默认配置 t "将当前配置设为默认值" -STARTLINE T "cls = __wlf_Write_1_58_0\ncls.save_preset('default')\nnuke.message('已保存至:\\n%s' % cls.preset_path('default'))"}
addUserKnob {20 group_folders l 打开输出文件夹 n 1}
group_folders 0
addUserKnob {22 bt_img_dir l 单帧 -STARTLINE T "path = os.path.join(nuke.value('root.project_directory'), 'images')\nif os.path.isdir(path):\n nukescripts.start('file://'+path)\nelse:\n nuke.message('输出路径不存在, 请先尝试渲染')"}
Expand Down Expand Up @@ -374,8 +378,8 @@ use_limit true
checkHashOnRead false
in_colorspace linear
out_colorspace linear
beforeRender __wlf_Write_1_57_1.WriteJPG.before_render()
afterRender __wlf_Write_1_57_1.WriteJPG.after_render()
beforeRender __wlf_Write_1_58_0.WriteJPG.before_render()
afterRender __wlf_Write_1_58_0.WriteJPG.after_render()
name Write_JPG_1
label "单帧\n会在退出脚本时自动输出"
xpos 0
Expand All @@ -387,12 +391,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_1_57_1.is_reading()]"}}
reading {{"\[python __wlf_Write_1_58_0.is_reading()]"}}
checkHashOnRead false
name Write_EXR_1
xpos 0
ypos -918
disable {{"\[python __wlf_Write_1_57_1.is_write_disabled('exr')]"}}
disable {{"\[python __wlf_Write_1_58_0.is_write_disabled('exr')]"}}
}
Write {
channels {rgba.red rgba.green rgba.blue rgba.alpha}
Expand All @@ -401,13 +405,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_1_57_1.is_reading()]"}}
reading {{"\[python __wlf_Write_1_58_0.is_reading()]"}}
checkHashOnRead false
name Write_PNG_1
selected true
xpos 0
ypos -862
disable {{"\[python __wlf_Write_1_57_1.is_write_disabled('png')]"}}
disable {{"\[python __wlf_Write_1_58_0.is_write_disabled('png')]"}}
}
Write {
file "mov/\[lindex \[split \[basename \[value root.name]] .] 0].mov"
Expand All @@ -420,8 +424,8 @@ mov32_codec "rle "
mov32_pixel_format {{0} "default (RGBA 8-bit)" "RGBA 8-bit"}
mov64_codec apch
mov64_fps {{root.fps}}
beforeRender __wlf_Write_1_57_1.WriteMOV.before_render()
disable {{"\[python __wlf_Write_1_57_1.is_write_disabled('mov')]"}}
beforeRender __wlf_Write_1_58_0.WriteMOV.before_render()
disable {{"\[python __wlf_Write_1_58_0.is_write_disabled('mov')]"}}
name Write_MOV_1
xpos 0
ypos -806
Expand All @@ -436,7 +440,7 @@ ypos -516
Write {
file "mov/burn-in/\[lindex \[split \[basename \[value root.name]] .] 0].mov"
proxy "mov/proxy/burn-in/\[lindex \[split \[basename \[value root.name]] .] 0].mov"
colorspace sRGB
colorspace {{{Write_MOV_1.colorspace}}}
views {{{parent.views}}}
file_type mov
meta_codec {{{Write_MOV_1.meta_codec}}}
Expand All @@ -446,7 +450,7 @@ mov64_codec apch
mov64_fps {{root.fps}}
render_order 2
checkHashOnRead false
beforeRender __wlf_Write_1_57_1.WriteMOV.before_render()
beforeRender __wlf_Write_1_58_0.WriteMOV.before_render()
name Write_MOV_2
label 带帧编号的MOV
xpos 0
Expand Down

0 comments on commit cec8335

Please sign in to comment.