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
1792

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   

 
0 # 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...
 
 
+1 # 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.
 
 
0 # 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
 
 
0 # 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?
 
 
0 # 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).
 
 
0 # 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!
 
 
0 # 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?
 
 
0 # 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
 
 
0 # 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
 
 
0 # 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.
 
 
0 # Eric Mc Guire 2019-10-05 14:08
Hi! Thanks for the script it's working great.

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.
 
 
0 # Esdras Prudente 2019-12-27 19:20
Thanks! It works great! :)
 
 
0 # li zhaohui 2021-03-29 16:03
nuke13?
 
 
+3 # Jeremy Cox 2021-04-29 01:44
To get this working in Nuke 13, change line 173 to this:

if int(lastframe) < 0:

Entirely possible that other issues exist, but this fixed the error that I was seeing.
 
 
0 # Jung Keun Kim 2021-05-24 10:30
that solution works well in nuke 13, but nuke 12 doesn't. :cry:
 
 
0 # Leanndro Amorim 2021-09-11 00:31
Quoting Jung Keun Kim:
that solution works well in nuke 13, but nuke 12 doesn't. :cry:

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
 
 
0 # Minnaz Rehman 2023-03-27 22:35
This also works for Nuke 14.0.v2
 
 
0 # Leanndro Amorim 2021-09-11 00:32
delete this
 
 
0 # darren coombes 2022-02-02 23:20
Does anyone have a version of this that works with nk12 and nk 13 ?
 
 
0 # Petter Lindholm 2022-07-27 19:37
I followed Jeremy Cox instructions changing the line 173. Works for both 12 and 13
 
 
0 # Petter Lindholm 2022-07-27 19:35
Got it to work in Nuke 13.1v4 and 12.2v6 with above suggestions. Anyone got this to work with Shotgrids write nodes? Is there any wizard out there that can point me in the right direction? :)
 

You have no rights to post comments

We have 2565 guests and 44 members online