I have gizmoB that takes a camera as input. GizmoB lives in GizmoA which also takes a camera as input. I want gizmoB to be able to access the camera via an expression. However nothing I do quite seems to work. The XML-script might better explain it.
Basically Camera
-> GizmoA
-> GizmoB
.
Thanks for your help. Maybe I'm going at this the wrong way, it's been a while since I have used Nuke and 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