Skip to content

Commit 25c859c

Browse files
authored
Merge pull request #5 from weijer/fix_importplus
fix importplus
2 parents cee08ce + cca1f66 commit 25c859c

File tree

12 files changed

+1016
-660
lines changed

12 files changed

+1016
-660
lines changed

command.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,16 @@
99
import python.ToolSet as ToolSet
1010
from python.cryptomatte import cryptomatte_utilities
1111
from python.mamoworld.workflow import relativeFilePath
12-
from python.mamoworld.mochaImportPlus import loadmochaimport
12+
from python.mamoworld.mochaImportPlus import loadMochaImport
1313
import python.CreatePointCloud.CreatedPointCloud as CreatedPointCloud
1414
import python.NukeFXSExporter.NukeFXSExporter as NukeFXSExporter
1515

1616
base_dir = os.path.dirname(__file__)
17-
loadmochaimport.loadMochaimport(base_dir)
18-
loadmochaimport.addIconPath(base_dir)
17+
loadMochaImport.load()
18+
loadMochaImport.addIconPath(base_dir)
1919

2020
import mochaimport
2121

22-
2322
def run_pack():
2423
"""
2524
run package nuke project plugin

menu.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import config
88
import sys
99
import command
10+
import mochaimport
1011

1112

1213
class NukeMenu(object):
Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
#! /Applications/Nuke7.0v8/NukeX7.0v8.app/../Nuke7.0v8.app/Contents/MacOS/Nuke7.0v8 -nx
2+
version 7.0 v1
3+
Gizmo {
4+
inputs 3
5+
help "<h1>Corner Pin With Lens Distortion</h1><p>Creates a corner pin based on mocha tracking data and optionally also mocha lens data</p> <h2>Inputs</h2><p><strong>Src:</strong>The image that you want to corner pin</p><strong>Bg:</strong>The background (usually the clip that you tracked). It is required for two things: (1) The node has an option to merge the background behind the corner pin (2) The background is required to correctly interpret the size of the DistMap input<p><strong>DistMap</strong> (optional) a Distortion Map Clip (ST Map) exported with the mocha Pro lens module with option 'distort'.</p><h2>Basic Usage</h2><ol><li>Create the node.</li><li>connect the Src and Bg inputs</li><li>Load your mocha tracking data from the clipboard or from file. The format you need to export from mocha is Nuke corner pin (*.nk)</li></ol><h2>Lens Distortion</h2><p>If you've used the mocha Lens module to analyze the lens distortion of your clip, you need to do the following things to apply both the corner pin and the lens distortion to your image:<ul><li>Make sure to provide the Background (Bg) input, even if you don't want the option to merge in the background. The background is needed to correctly interpret the size of the distortion map.</li><li>Make sure the mocha corner pin data you load into the node is exported from mocha Pro with the option 'Remove lens distortion'.</li><li>as DistMap input of the node use a Distortion Map Clip (ST Map) exported with the mocha Pro lens module with option 'distort'.</li></ul>"
6+
label MochaImport+
7+
addUserKnob {20 User l "Corner Pin"}
8+
addUserKnob {26 loadMochaDataLabel l "load mocha data" t "load Nuke Corner Pin (*.nk) data from mocha" T ""}
9+
addUserKnob {22 loadCornerPinFile l "from file" t "import mocha corner pin data from a file\n\nrequired format: Nuke Corner Pin (*.nk)" -STARTLINE T "if not locals().has_key(\"mochaimport\"):\n nuke.message(\"Please install MochaImport+ for NUKE (by mamoworld.com) to use this function\")\nelse:\n mochaimport.cornerPinNode___loadTrackingDataFromFile()\n"}
10+
addUserKnob {22 pasteMochaDataFromClipboard l "from clipboard" t "import mocha corner pin data from the clipboard \n\nrequired format: Nuke Corner Pin (*.nk)" -STARTLINE T "if not locals().has_key(\"mochaimport\"):\n nuke.message(\"Please install MochaImport+ for NUKE (by mamoworld.com) to use this function\")\nelse:\n mochaimport.cornerPinNode___loadTrackinDataFromClipboard()\n"}
11+
addUserKnob {20 cornerpindata l data t "the actual corner pin data loaded from the file" n 1}
12+
addUserKnob {12 pin1 l "pin 1" t "corner pin tracking data"}
13+
addUserKnob {12 pin2 l "pin 2" t "corner pin tracking data"}
14+
addUserKnob {12 pin3 l "pin 3" t "corner pin tracking data"}
15+
addUserKnob {12 pin4 l "pin 4" t "corner pin tracking data"}
16+
addUserKnob {78 pinTimeOffset l "corner pin time offset" t "shift your tracking data if it does not start at the first frame" n 1}
17+
addUserKnob {20 endGroup n -1}
18+
addUserKnob {26 divName l "" +STARTLINE}
19+
addUserKnob {6 mergeBackground l "merge background" t "NOTE: also provide a background input if you do not want to merge it. It is necessary to interpret the size of the distortion map correctly" +STARTLINE}
20+
addUserKnob {26 ""}
21+
addUserKnob {20 CornerPinDetails l "corner pin" n 1}
22+
addUserKnob {41 filter T "corner pin.filter"}
23+
addUserKnob {41 clamp -STARTLINE T "corner pin.clamp"}
24+
addUserKnob {41 black_outside l "black outside" -STARTLINE T "corner pin.black_outside"}
25+
addUserKnob {41 motionblur T "corner pin.motionblur"}
26+
addUserKnob {41 shutter T "corner pin.shutter"}
27+
addUserKnob {41 shutteroffset l "shutter offset" T "corner pin.shutteroffset"}
28+
addUserKnob {41 shuttercustomoffset l "" -STARTLINE T "corner pin.shuttercustomoffset"}
29+
addUserKnob {20 endGroup_1 l endGroup n -1}
30+
addUserKnob {26 ""}
31+
addUserKnob {20 LensDistortionDetails l "lens distortion" n 1}
32+
addUserKnob {41 filter_1 l filter T "apply distortion.filter"}
33+
addUserKnob {20 endGroup_2 l endGroup n -1}
34+
}
35+
BackdropNode {
36+
inputs 0
37+
name Merge_Background
38+
xpos -78
39+
ypos 36
40+
bdwidth 242
41+
bdheight 69
42+
}
43+
BackdropNode {
44+
inputs 0
45+
name Apply_Lens_Distortion
46+
xpos 59
47+
ypos -222
48+
bdwidth 246
49+
bdheight 245
50+
}
51+
Input {
52+
inputs 0
53+
name Bg
54+
label "\[value number]"
55+
xpos -57
56+
ypos -223
57+
number 1
58+
}
59+
Input {
60+
inputs 0
61+
name Src
62+
label "\[value number]"
63+
xpos 70
64+
ypos -327
65+
}
66+
CornerPin2D {
67+
to1 {{parent.pin1.x(t+parent.pinTimeOffset)} {parent.pin1.y(t+parent.pinTimeOffset)}}
68+
to2 {{parent.pin2.x(t+parent.pinTimeOffset)} {parent.pin2.y(t+parent.pinTimeOffset)}}
69+
to3 {{parent.pin3.x(t+parent.pinTimeOffset)} {parent.pin3.y(t+parent.pinTimeOffset)}}
70+
to4 {{parent.pin4.x(t+parent.pinTimeOffset)} {parent.pin4.y(t+parent.pinTimeOffset)}}
71+
invert false
72+
from1 {0 0}
73+
from2 {{"\[python nuke.toNode(\\\"Src\\\").width()\\ ]"} {curve}}
74+
from3 {{"\[python nuke.toNode(\\\"Src\\\").width()\\ ]"} {"\[python nuke.toNode(\\\"Src\\\").height()\\ ]"}}
75+
from4 {0 {"\[python nuke.toNode(\\\"Src\\\").height()\\ ]"}}
76+
name "corner pin"
77+
xpos 70
78+
ypos -264
79+
}
80+
set N1f8decd0 [stack 0]
81+
Crop {
82+
box {0 0 {"\[python -execlocal bgNode\\ =\\ nuke.toNode(\\\"Bg\\\")\\nret\\ =\\ bgNode.format().width()]"} {"\[python -execlocal bgNode\\ =\\ nuke.toNode(\\\"Bg\\\")\\nret\\ =\\ bgNode.format().height()]"}}
83+
reformat true
84+
crop false
85+
name Crop1
86+
xpos 70
87+
ypos -85
88+
}
89+
set N1f8e5f00 [stack 0]
90+
Input {
91+
inputs 0
92+
name DistMap
93+
label "\[value number]"
94+
xpos 216
95+
ypos -328
96+
number 2
97+
}
98+
Crop {
99+
box {{"\[python -execlocal bgNode\\ =\\ nuke.toNode(\\\"Bg\\\")\\ndistortionMapNode\\ =\\ nuke.toNode(\\\"DistMap\\\")\\ncurrentWidth\\ =\\ distortionMapNode.format().width()\\ntargetWidth\\ =\\ bgNode.format().width()\\nret\\ =\\ currentWidth/2\\ -\\ targetWidth/2\\n]"} {"\[python -execlocal bgNode\\ =\\ nuke.toNode(\\\"Bg\\\")\\ndistortionMapNode\\ =\\ nuke.toNode(\\\"DistMap\\\")\\ncurrentHeight\\ =\\ distortionMapNode.format().height()\\ntargetHeight\\ =\\ bgNode.format().height()\\nret\\ =\\ currentHeight/2\\ -\\ targetHeight/2]"} {"\[python -execlocal bgNode\\ =\\ nuke.toNode(\\\"Bg\\\")\\ndistortionMapNode\\ =\\ nuke.toNode(\\\"DistMap\\\")\\ncurrentWidth\\ =\\ distortionMapNode.format().width()\\ntargetWidth\\ =\\ bgNode.format().width()\\nret\\ =\\ currentWidth/2\\ +\\ targetWidth/2]"} {"\[python -execlocal bgNode\\ =\\ nuke.toNode(\\\"Bg\\\")\\ndistortionMapNode\\ =\\ nuke.toNode(\\\"DistMap\\\")\\ncurrentHeight\\ =\\ distortionMapNode.format().height()\\ntargetHeight\\ =\\ bgNode.format().height()\\nret\\ =\\ currentHeight/2\\ +\\ targetHeight/2]"}}
100+
reformat true
101+
crop false
102+
name Crop2
103+
xpos 216
104+
ypos -88
105+
}
106+
push $N1f8e5f00
107+
STMap {
108+
inputs 2
109+
uv rgb
110+
name "apply distortion"
111+
xpos 216
112+
ypos -9
113+
}
114+
Switch {
115+
inputs 2
116+
which {{"!\[exists parent.input2]"}}
117+
name Switch2
118+
selected true
119+
xpos 70
120+
ypos -9
121+
}
122+
set N1f8f1f00 [stack 0]
123+
Merge2 {
124+
inputs 2
125+
operation under
126+
name Merge1
127+
xpos -57
128+
ypos 70
129+
}
130+
push $N1f8f1f00
131+
Switch {
132+
inputs 2
133+
which {{"\[python nuke.thisGroup()\\\['mergeBackground'\\].getValue()]"}}
134+
name Switch1
135+
xpos 70
136+
ypos 70
137+
}
138+
Output {
139+
name Output1
140+
xpos 70
141+
ypos 139
142+
}
143+
push $N1f8decd0
144+
Viewer {
145+
input_process false
146+
name Viewer1
147+
xpos -307
148+
ypos -29
149+
}
150+
end_group

0 commit comments

Comments
 (0)