readFromWrite v2.3


 
This location is for Registered Users Only.
Perhaps you need to login or register.
Contributor: Fredrik Averpil
Generate Read node(s) from selected Write node(s). Supports filepaths with expressions.
Requirements:
10.0, 9.0, 8.0, 7.1, 7.0, 6.3, 6.2 or later
Mac, Windows
08 Jun 2016
774

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.

Released under the MIT license Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Please login in order to download these files.

Comments   

 
# Ben Roberts 2011-11-16 16:17
great idea. how is it working out the frame range of the file on disk? for me it doesn't seem to pick up the correct frame range from the rendered file, but some sort of random number...
 
 
# Fredrik Averpil 2011-11-17 00:54
Hi Ben,

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.
 
 
# Andrew Mumford 2015-09-05 23:44
Frederick - any pointers on how I would modify this to allow parsing of Volumes with "spaces" in the filename - like "/Volumes/CalDi git 6TB RAID 0 T3/show/project /seq/shots/sc00 1/scripts" ...
I know why would any idiot name anything like this but then I did so I would like to try and fix it !?

Thx
 
 
# Ben Roberts 2011-11-17 18:26
thanks for the description fredrik. not sure what happened yesterday but it's all working sweet now. thanks i also adjusted it a bit for peeps using floating windows, like myself to use: inpanel=False. thanks again!
 
 
-1 # Jason Tsang 2012-05-02 17:02
What if I have a frame padding of 5 or 6?
 
 
# Fredrik Averpil 2012-11-05 06:56
Hi Jason,

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).
 
 
# satheesh R 2014-08-26 19:18
Hi Fred.

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.
 
 
-1 # Sri kanth 2016-05-23 10:54
Hi Fredrik, Thanks for the V2.0 ! :-)
 
 
+1 # Octavio Mancilla 2016-05-23 16:51
Great tool, thanks!
 
 
# Kyran Bishop 2017-02-07 16:08
Getting an error when running in NukeX 9.0v6;

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?
 
 
# Jung Keun Kim 2017-02-20 08:27
Getting an error when i running this script to no padding file like a still frame

P:/201701_Mars/images/Render/Citya.jpg

===============

list index out of range
 
 
# sebastian brown 2018-08-18 02:10
Thanks for sharing with the community!!

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
 
 
# Anthony Thomas 2019-08-15 03:52
Anyone getting this error?

'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.
 

You have no rights to post comments

We have 4041 guests and 116 members online