readFromWrite v2.3
This location is for Registered Users Only.
Perhaps you need to login or register.
10.0, 9.0, 8.0, 7.1, 7.0, 6.3, 6.2 or later
Mac, Windows
Read node generator v2.3, 2016-06-08
Changelog:
- v2.3:
- Bug fix: crash when knob 'use_limit' isn't available on node
- Accidentally left ReadFromWrite() at bottom of script in v2.2
- v2.2:
- Support for nodes with filepath which does not exist on disk
(will read Write node settings or incoming framerange)
- Support for additional Read/Write node option 'raw'
- v2.1:
- Fixed bug where Read node always got premultiplied
- Support for ../ in filepath/expression
- Dialog on 'filepath not found' error
- Set origfirst, origlast framerange
- Additional movie file format support (see SINGLE_FILE_FORMATS
variable)
- General cleanup of various methods for greater maintainability
- v2.0:
- Completely rewritten from scratch
- Improved detection of frame range
- Supports any padding format (not only %04d)
- Applies colorspace to Read node
- Supports not only Write nodes (see FILEPATH_KNOBS variable)
- Supports definition of 'single file image sequence' formats
(see SINGLE_FILE_FORMATS variable)
- PEP8 compliant!
Usage:
Select any Write node and run ReadFromWrite() after having sourced this
file, or put the following in your menu.py:
import readFromWrite
nuke.menu('Nuke').addCommand('Read from Write',
'readFromWrite.ReadFromWrite()',
'shift+r')
Please note:
Script is now started via ReadFromWrite() instead of the old
readfromWrite() function, so you'll have to update your scripts if you
are updating from a 1.x version.
Still untested in Linux. Let me know if it works there and if so, I can tick the 'Linux' checkbox.
Comments
It works like this, currently, although I've planned for a different approach in a near future update:
The script looks for the path in the write node and makes sure its structure is prefix.####.suf fix or prefix.suffix (meaning e.g. filename.0001.d px or filename.mov). If it finds the prefix.####.suf fix, it simply takes the numbers from the first frame and then the last frame and sets those numbers as "first frame" and "last frame". In this scenario, you should be all set without any issues.
If the write node is writing a .mov file, it is impossible to figure out the correct frame range. However if a file sequence of the same prefix is found in the write folder, the script will take that frame range and use that (a warning message will appear). If no file sequence with the same prefix is found, the script will read the global settings and use the frame range set in there. A warning message will appear in this scenario too.
Please get back to me in regards to if you are experiencing any other scenario (in that case, probably a bug needs fixing).
I'm about to update the script where it does not require the file name syntax to be prefix.####.suf fix or prefix.suffix, but instead using regular expressions to find the #### part and if it simply does not find it, it will take the approach where it starts guessing.
I know why would any idiot name anything like this but then I did so I would like to try and fix it !?
Thx
That won't work without changing some of the code. You would have to change the search pattern (line 82), the regex (line 132) and the replace (line 154).
Thanks for the script. Im facing some issues. When i try to run this script with write node selected this code raise below error.
sourcePrefix, sourceSuffix = filename.split('.%04d.')
ValueError: need more than 1 value to unpack
Can you check with this pls.
ReadFromWrite()
# Result: Traceback (most recent call last):
File "", line 337, in
File "", line 71, in __init__
File "", line 96, in gather_node_data
File "", line 266, in frame_info
File "", line 168, in get_framerange
IndexError: list index out of range
Any thoughts?
P:/201701_Mars/images/Render/Citya.jpg
===============
list index out of range
was this working for nuke10.5?
I was getting this error:
Traceback (most recent call last):
File "", line 1, in
File "C:/Users/cinef /.nuke\readFrom Write.py", line 71, in __init__
node_data = self.gather_nod e_data(nodes)
File "C:/Users/cinef /.nuke\readFrom Write.py", line 96, in gather_node_dat a
frame_info = self.frame_info (node, knob_value, knob_eval)
File "C:/Users/cinef /.nuke\readFrom Write.py", line 230, in frame_info
filepath = self.filepath_f rom_disk(node, knob_value, knob_eval)
File "C:/Users/cinef /.nuke\readFrom Write.py", line 142, in filepath_from_d isk
elif os.path.exists( knob_eval):
File "C:\Program Files\Nuke10.5v 3\lib\genericpa th.py", line 18, in exists
os.stat(path)
TypeError: coercing to Unicode: need string or buffer, NoneType found
'module' object has no attribute 'readFromWrite'
this is how the file is written out,
ACH_VFX_SH021_V001.%04d.exr
It's following the correct rules I thought. I placed the python script in my python folder, and copied and pasted the command on your website, in my menu.py
Ideally this should be working, so what does that error mean? What should I fix? Help me pleeeease lol.
However, it doesn't seem to handle exr textures (and probably other image formats) that are not in an image sequence format (i.e. ".0100.exr"). Line 260 of v2.3 produces an error of index out of range. For example this file:
Z:/Render/Jungle_A_Mountain_A_clr_A.exr
The fix is easy though to make it work. In your "def frame_info(...) ", you scan for "if nuke.ask(not_fo und)" and then provide a fallback method if no frame range is found. You just have to repeat this section in your else section after, if once again no image sequence is found.
Explicitly said, in your v2.3 version of the script, add a try / except at line 258, and copy lines 236-255 in your except.
if int(lastframe) < 0:
Entirely possible that other issues exist, but this fixed the error that I was seeing.
Just replace to:
if nuke.NUKE_VERSI ON_MAJOR >= 13:
if int(lastframe) < 0:
lastframe = firstframe
return firstframe, lastframe
if nuke.NUKE_VERSI ON_MAJOR < 13:
if lastframe < 0:
lastframe = firstframe
return firstframe, lastframe
RSS feed for comments to this post