#! C:/Program Files/Nuke8.0v5/nuke-8.0.v5.dll -nx
version 8.0 v5
define_window_layout_xml {<?xml version="1.0" encoding="UTF-8"?>
<layout version="1.0">
<window x="0" y="0" w="1936" h="1160" screen="0">
<splitter orientation="1">
<split size="1369"/>
<splitter orientation="1">
<split size="51"/>
<dock id="" hideTitles="1" activePageId="Toolbar.1">
<page id="Toolbar.1"/>
</dock>
<split size="547"/>
<dock id="" activePageId="Properties.1">
<page id="Properties.1"/>
</dock>
</splitter>
</window>
</layout>
}
Root {
inputs 0
name C:/Users/Admin/Desktop/test.nk
format "1280 720 0 0 1280 720 1 hd_720"
proxy_type scale
proxy_format "1024 778 0 0 1024 778 1 1K_Super_35(full-ap)"
}
Viewer {
inputs 0
frame 1
input_process false
name Viewer1
xpos -40
ypos -9
}
Camera {
inputs 0
translate {{curve x1 -5 x50 5} {curve x1 0.3 x50 2} {curve x1 17 x50 30}}
rotate {{curve} {curve x1 -20 x50 10} {curve}}
name Camera1
xpos 570
ypos -6
}
CheckerBoard2 {
inputs 0
centerlinewidth 0
name CheckerBoard1
xpos 90
ypos -6
}
Cube {
translate {-2 0.5 0}
name Cube1
xpos 250
ypos 154
}
Cylinder {
translate {2 1 0}
name Cylinder1
xpos 250
ypos 74
}
Sphere {
translate {0 0.5 0}
name Sphere1
xpos 250
ypos -6
}
Light {
inputs 0
translate {-5 3 10}
name Point1
xpos 410
ypos -6
}
Scene {
inputs 7
name Scene1
xpos 410
ypos 154
}
ScanlineRender {
inputs 3
name ScanlineRender1
xpos 560
ypos 175
}
Write {
file C:/Users/Admin/Desktop/testing/super_####.png
file_type png
checkHashOnRead false
name Write1
xpos 560
ypos 219
}
Above is sample ascii file. its simple nuke script. I wanted to edit this file via python currently my immediate need is tweaking Write node file output path. immediate problem is need to verify that am I going in right direction or possibly totally wrong
My psudo approach is something like
- read file
- search for string pattern "Write{*}"
- once found, read details (line by line) etc
- change information and re-write the file on disk again (new)
QUESTIONS:
- can I read this file (parse) with some xml way as well, and directly get write node settings? or RegEx is best way to go?
- currently sample file is small but real file can go to 500Kb easily that is approximately 3000 lines of data. So can we directly tweak a line in ascii files or do we have to read data, then do change in data and re-write all data from scratch on disk?
- can someone please give some hints, from re module, how to reach chunk blocks of data (node settings) with format name{} format. so I can filter if multiple write nodes exists.
Huge thanks in advance for suggestions , regards,lala
No comments:
Post a Comment