我有gizmoB,它以照相机作为输入。 GizmoB居住在GizmoA中,GizmoA也将相机作为输入。我希望gizmoB能够通过表达式访问相机。但是我似乎没有做任何事情。 XML脚本可能会更好地解释它。
基本上是Camera
-> GizmoA
-> GizmoB
。
感谢您的帮助。也许我走错了路,自从我使用Nuke和Python以来已经有一段时间了。
#! C:/Program Files/Nuke10.0v3/nuke-10.0.3.dll -nx
version 10.0 v3
define_window_layout_xml {<?xml version="1.0" encoding="UTF-8"?>
<layout version="1.0">
<window x="0" y="0" w="1920" h="848" screen="0">
<splitter orientation="1">
<split size="40"/>
<dock id="" hideTitles="1" activePageId="Toolbar.1">
<page id="Toolbar.1"/>
</dock>
<split size="1241" stretch="1"/>
<splitter orientation="2">
<split size="287"/>
<dock id="" activePageId="Viewer.2">
<page id="Viewer.2"/>
<page id="Viewer.1"/>
</dock>
<split size="495"/>
<dock id="" activePageId="DAG.2">
<page id="DAG.1"/>
<page id="Curve Editor.1"/>
<page id="DopeSheet.1"/>
<page id="DAG.2"/>
</dock>
</splitter>
<split size="615"/>
<dock id="" activePageId="Properties.1" focus="true">
<page id="Properties.1"/>
</dock>
</splitter>
</window>
</layout>
}
Root {
inputs 0
name Q:/data/test.nk
title "sq2600 s1 - nuke_scripts.nk"
frame 2
last_frame 96
lock_range true
colorManagement Nuke
views {
{LFT ""}
{RGT ""}
}
addUserKnob {20 User}
addUserKnob {1 lt_res}
lt_res "\$\{a_res\}"
addUserKnob {1 mp_res}
mp_res 1
addUserKnob {1 fx_res}
fx_res "\$\{a_res\}"
addUserKnob {1 mpaint_res +INVISIBLE}
addUserKnob {1 lighting_res +INVISIBLE}
addUserKnob {4 deptMode l "Choose a department mode:" M {none "Image Finaling" Layout Lighting FX}}
}
Camera2 {
inputs 0
read_from_file true
rot_order XYZ
translate {2.836216927 8.794775009 13.20492458}
rotate {-17.39999962 22.20000076 7.170989063e-014}
focal 35
haperture 35.99992752
vaperture 23.99995222
near 0.1000000015
far 25
file camera1.fbx
fbx_node_name {{7} "Producer Perspective" "Producer Top" "Producer Bottom" "Producer Front" "Producer Back" "Producer Right" "Producer Left" camera1}
name Camera1
xpos 1333
ypos 5163
}
set N5363c00 [stack 0]
Read {
inputs 0
file ../images/test.%04d.exr
format "1024 768 0 0 1024 768 1 "
last 96
origlast 96
origset true
name Read1
xpos 1156
ypos 5213
}
set N3ac68800 [stack 0]
Group {
inputs 2
name GizmoC
label "(\[value space_transform])"
selected true
xpos 1449
ypos 5282
addUserKnob {20 SpaceTransform}
addUserKnob {26 info l "" +STARTLINE T "Connect camera for transformation"}
addUserKnob {26 ""}
addUserKnob {41 in l input T Shuffle1.in}
addUserKnob {4 data_type l "data type" M {"normal vectors" "point positions"}}
data_type "point positions"
addUserKnob {4 space_transform l "space transform" M {"cam to world" "world to cam" ""}}
space_transform "world to cam"
addUserKnob {41 out l output T ShuffleCopy1.out2}
addUserKnob {26 ""}
}
Input {
inputs 0
name cam
xpos 852
ypos -563
number 1
}
Axis2 {
name Axis3
xpos 862
ypos -489
}
NoOp {
name NoOp1
label "camera scale"
xpos 852
ypos -399
addUserKnob {20 User}
addUserKnob {13 scale}
scale {{"\[value \[topnode parent.input1].scaling.x]"} {"\[value \[topnode parent.input1].scaling.y]"} {"\[value \[topnode parent.input1].scaling.z]"}}
addUserKnob {7 uniform_scale l "uniform scale"}
uniform_scale {{"\[value \[topnode parent.input1].uniform_scale]"}}
addUserKnob {13 total_scale l "total scale"}
total_scale {{"scale*uniform_scale ? 1/(scale*uniform_scale) : 0"} {"scale*uniform_scale ? 1/(scale*uniform_scale) : 0"} {"scale*uniform_scale ? 1/(scale*uniform_scale) : 0"}}
}
Input {
inputs 0
name src
xpos 164
ypos -564
}
Dot {
name Dot7
xpos 198
ypos -482
}
set N59756400 [stack 0]
Shuffle {
in rgb
alpha black
out rgb
name Shuffle1
label "in: \[value in]"
xpos 400
ypos -489
}
Dot {
name Dot1
xpos 434
ypos -397
}
set N529ffc00 [stack 0]
Dot {
name Dot2
xpos 666
ypos -397
}
Add {
channels rgb
value {{-parent.Axis3.world_matrix.3} {-parent.Axis3.world_matrix.7} {-parent.Axis3.world_matrix.11} 0}
name Add1
label "inverse translation"
xpos 632
ypos -246
disable {{!parent.data_type}}
}
ColorMatrix {
matrix {
{{"parent.Axis3.world_matrix.0 * parent.NoOp1.total_scale.x"} {"parent.Axis3.world_matrix.1 * parent.NoOp1.total_scale.y"} {"parent.Axis3.world_matrix.2 * parent.NoOp1.total_scale.z"}}
{{"parent.Axis3.world_matrix.4 * parent.NoOp1.total_scale.x"} {"parent.Axis3.world_matrix.5 * parent.NoOp1.total_scale.y"} {"parent.Axis3.world_matrix.6 * parent.NoOp1.total_scale.z"}}
{{"parent.Axis3.world_matrix.8 * parent.NoOp1.total_scale.x"} {"parent.Axis3.world_matrix.9 * parent.NoOp1.total_scale.y"} {"parent.Axis3.world_matrix.10 * parent.NoOp1.total_scale.z"}}
}
invert true
name ColorMatrix3
label "world to cam"
xpos 632
ypos -184
disable {{hasError}}
}
Dot {
name Dot3
xpos 666
ypos -77
}
push $N529ffc00
ColorMatrix {
matrix {
{{"parent.Axis3.world_matrix.0 * parent.NoOp1.total_scale.x"} {"parent.Axis3.world_matrix.1 * parent.NoOp1.total_scale.y"} {"parent.Axis3.world_matrix.2 * parent.NoOp1.total_scale.z"}}
{{"parent.Axis3.world_matrix.4 * parent.NoOp1.total_scale.x"} {"parent.Axis3.world_matrix.5 * parent.NoOp1.total_scale.y"} {"parent.Axis3.world_matrix.6 * parent.NoOp1.total_scale.z"}}
{{"parent.Axis3.world_matrix.8 * parent.NoOp1.total_scale.x"} {"parent.Axis3.world_matrix.9 * parent.NoOp1.total_scale.y"} {"parent.Axis3.world_matrix.10 * parent.NoOp1.total_scale.z"}}
}
name ColorMatrix2
label "cam to world"
xpos 400
ypos -310
disable {{hasError}}
}
Add {
channels rgb
value {{parent.Axis3.world_matrix.3} {parent.Axis3.world_matrix.7} {parent.Axis3.world_matrix.11} 0}
name Add5
label translation
xpos 400
ypos -246
disable {{!parent.data_type}}
}
Switch {
inputs 2
which {{parent.space_transform}}
name Switch1
label transform
xpos 400
ypos -84
}
push $N59756400
ShuffleCopy {
inputs 2
alpha alpha2
black red
white green
red2 blue
green2 alpha
out2 rgb
name ShuffleCopy1
label "out: \[value out2]"
xpos 164
ypos -84
disable {{"!(NoOp1.total_scale.x && NoOp1.total_scale.y && NoOp1.total_scale.z && \[exists parent.input0])"}}
}
Output {
name Output1
xpos 164
ypos 9
}
end_group
Viewer {
frame_range 1-96
name Viewer1
xpos 1449
ypos 5211
}
push $N5363c00
push $N3ac68800
push 0
Group {
inputs 3
name gizmoA
tile_color 0x5f5f5fff
note_font "Bitstream Vera Sans"
note_font_size 14
note_font_color 0xfefefeff
xpos 1156
ypos 5380
}
Output {
inputs 0
name Output
xpos -1040
ypos -504
}
Input {
inputs 0
name shot_cam
label "\[value number]"
xpos -901
ypos -930
number 2
}
Input {
inputs 0
name position
label "\[value number]"
xpos -1116
ypos -935
number 1
}
Group {
inputs 2
name GizmoB
label "(\[value space_transform])"
selected true
xpos -958
ypos -826
addUserKnob {20 SpaceTransform}
addUserKnob {26 info l "" +STARTLINE T "Connect camera for transformation"}
addUserKnob {26 ""}
addUserKnob {41 in l input T Shuffle1.in}
addUserKnob {4 data_type l "data type" M {"normal vectors" "point positions"}}
data_type "point positions"
addUserKnob {4 space_transform l "space transform" M {"cam to world" "world to cam" ""}}
space_transform "world to cam"
addUserKnob {41 out l output T ShuffleCopy1.out2}
addUserKnob {26 ""}
}
Input {
inputs 0
name cam
xpos 852
ypos -563
number 1
}
Axis2 {
name Axis3
xpos 862
ypos -489
}
NoOp {
name NoOp1
label "camera scale"
xpos 852
ypos -399
addUserKnob {20 User}
addUserKnob {13 scale}
scale {{"\[value \[topnode parent.input1].scaling.x]"} {"\[value \[topnode parent.input1].scaling.y]"} {"\[value \[topnode parent.input1].scaling.z]"}}
addUserKnob {7 uniform_scale l "uniform scale"}
uniform_scale {{"\[value \[topnode parent.input1].uniform_scale]"}}
addUserKnob {13 total_scale l "total scale"}
total_scale {{"scale*uniform_scale ? 1/(scale*uniform_scale) : 0"} {"scale*uniform_scale ? 1/(scale*uniform_scale) : 0"} {"scale*uniform_scale ? 1/(scale*uniform_scale) : 0"}}
}
Input {
inputs 0
name src
xpos 164
ypos -564
}
Dot {
name Dot7
xpos 198
ypos -482
}
set N374e8c00 [stack 0]
Shuffle {
in rgb
alpha black
out rgb
name Shuffle1
label "in: \[value in]"
xpos 400
ypos -489
}
Dot {
name Dot1
xpos 434
ypos -397
}
set N25e1bc00 [stack 0]
Dot {
name Dot2
xpos 666
ypos -397
}
Add {
channels rgb
value {{-parent.Axis3.world_matrix.3} {-parent.Axis3.world_matrix.7} {-parent.Axis3.world_matrix.11} 0}
name Add1
label "inverse translation"
xpos 632
ypos -246
disable {{!parent.data_type}}
}
ColorMatrix {
matrix {
{{"parent.Axis3.world_matrix.0 * parent.NoOp1.total_scale.x"} {"parent.Axis3.world_matrix.1 * parent.NoOp1.total_scale.y"} {"parent.Axis3.world_matrix.2 * parent.NoOp1.total_scale.z"}}
{{"parent.Axis3.world_matrix.4 * parent.NoOp1.total_scale.x"} {"parent.Axis3.world_matrix.5 * parent.NoOp1.total_scale.y"} {"parent.Axis3.world_matrix.6 * parent.NoOp1.total_scale.z"}}
{{"parent.Axis3.world_matrix.8 * parent.NoOp1.total_scale.x"} {"parent.Axis3.world_matrix.9 * parent.NoOp1.total_scale.y"} {"parent.Axis3.world_matrix.10 * parent.NoOp1.total_scale.z"}}
}
invert true
name ColorMatrix3
label "world to cam"
xpos 632
ypos -184
disable {{hasError}}
}
Dot {
name Dot3
xpos 666
ypos -77
}
push $N25e1bc00
ColorMatrix {
matrix {
{{"parent.Axis3.world_matrix.0 * parent.NoOp1.total_scale.x"} {"parent.Axis3.world_matrix.1 * parent.NoOp1.total_scale.y"} {"parent.Axis3.world_matrix.2 * parent.NoOp1.total_scale.z"}}
{{"parent.Axis3.world_matrix.4 * parent.NoOp1.total_scale.x"} {"parent.Axis3.world_matrix.5 * parent.NoOp1.total_scale.y"} {"parent.Axis3.world_matrix.6 * parent.NoOp1.total_scale.z"}}
{{"parent.Axis3.world_matrix.8 * parent.NoOp1.total_scale.x"} {"parent.Axis3.world_matrix.9 * parent.NoOp1.total_scale.y"} {"parent.Axis3.world_matrix.10 * parent.NoOp1.total_scale.z"}}
}
name ColorMatrix2
label "cam to world"
xpos 400
ypos -310
disable {{hasError}}
}
Add {
channels rgb
value {{parent.Axis3.world_matrix.3} {parent.Axis3.world_matrix.7} {parent.Axis3.world_matrix.11} 0}
name Add5
label translation
xpos 400
ypos -246
disable {{!parent.data_type}}
}
Switch {
inputs 2
which {{parent.space_transform}}
name Switch1
label transform
xpos 400
ypos -84
}
push $N374e8c00
ShuffleCopy {
inputs 2
alpha alpha2
black red
white green
red2 blue
green2 alpha
out2 rgb
name ShuffleCopy1
label "out: \[value out2]"
xpos 164
ypos -84
disable {{"!(NoOp1.total_scale.x && NoOp1.total_scale.y && NoOp1.total_scale.z && \[exists parent.input0])"}}
}
Output {
name Output1
xpos 164
ypos 9
}
end_group
end_group
答案 0 :(得分:0)
对于此脚本,我关闭了read from fbx file
选项,然后手动为Camera1
设置了动画。
Patrick,我看到您打开了ColorMatrix1
和ColorMatrix3
中的值反转,如果您在RGB矩阵中有零,这会导致错误(因为{{1 }}个节点等于ColorMatrix
)。
您已在0
节点内编写了一个表达式(该表达式会影响NoOp1
节点):
ColorMatrix
表达式本身可以确定,但是parent.Axis3.world_matrix.0 * parent.NoOp1.total_scale.x
和scale
属性的默认值不能为uniform scale
–它们必须为0
(适用于可见的RGB光谱)甚至+1
(适用于不可见的PP光谱-负色值在NUKE中是很常见的,尤其是对于诸如点位置的渲染过程)。因此,您基于-1
节点中total scale
属性的三元运算符的条件表达式不正确:
NoOp1
因此您的表情至少必须类似于以下内容:
scale * uniform_scale ? 1/(scale * uniform_scale) : 0 // INCORRECT EXPRESSION
即使scale * uniform_scale ? abs(1/(scale * uniform_scale)) : 1
不起作用,您也会获得if-statement
的默认值,用于在1
中进行缩放。
else-statement
和scale
旋钮中的值等于uniform scale
,因为您应该为顶部节点分配输入的正确名称(TCL表达式本身的语法也可以) :
0
或:
[value [topnode parent.Camera1].scaling.x]
[value [topnode parent.Camera1].scaling.y]
[value [topnode parent.Camera1].scaling.z]
[value [topnode parent.Camera1].uniform_scale]
此外,我注意到您在[value [topnode parent.input1].scaling.x] // Axis node has 'input0' and 'input1'
[value [topnode parent.input1].scaling.y]
[value [topnode parent.input1].scaling.y]
[value [topnode parent.input1].uniform_scale]
和Switch1
节点中的两个表达式中都有错误。 Switch2
节点内的表达式如下:
Switch1
但是,正如您所看到的,此表达式也会导致错误(我在NUKE脚本中根本看不到任何parent.space_transform // NO 'space_transform' HERE
属性):
因此我修复了所有上述错误,现在脚本可以正常工作。
通过单击播放此GIF序列。
我只能共享工作脚本的加密XML代码。因此,要阅读该书,您需要The Foundry NUKE 11.3v1 非商业版。这是我的代码(复制粘贴此非常长的字符串):
space_transform
希望这会有所帮助。