Load Folder (recursiveLoad) v1.0


 
This location is for Registered Users Only.
Perhaps you need to login or register.
Contributor: Howard Jones
Loads a folder and all subfolders recursively from inside Nuke
Requirements:
6.2, 6.3, 7.0 or later
Linux, Mac, Windows
18 Jul 2011
1467

Uses the normal Nuke file browser and loads all img sequences and geo found inside the top folder - recursively working through to load everything inside.

If you have a set up with stereo rendered as separate passes and use a standard convention for right and left file paths (eg /path/left/filename_left.###.dpx, /path/right/filename_right.###.dpx) you can add the search parameters (in this case /right/', '/left' and '_right', _left' ) at the top of the file where indicated and it will auto join all right and left eyes.

It will also load .nk files etc as loads everything in the top folder so you may get a set of error reads which you would just delete.

(Might work in Nuke7.0 who knows - just like the forward optimism of nukepedia)

From menu.py (note named Load Folder in nuke)

1
2
m = toolbar.addMenu("Image", "ToolbarDraw.png")
m.addCommand('Load Folder', 'nuke.load("recursiveLoad"), recursiveLoad()',  'alt+r', icon='Read.png')
Please login in order to download these files.

Comments   

 
0 # James Berkheimer 2014-05-16 23:37
I know this has been out a while, but I'm trying this out with 8.0v3 and it's not working so well. The first issue is that it doesn't bring in the images as a sequence. It will create a read node for every image. The second issue is that the file paths are not correct. All of them start off like so: X:X:/

I've been trolling through the code, but I'm not as familiar with Nuke Python at the moment. I'm hoping maybe someone else found a solution.
 
 
0 # Brad Schaider 2015-02-23 23:50
I got it working in 9.0v4. Open the .py file and amend the last 3 lines with the code below.

Code: readsList=imgSeq2NukeFormat(filesFound)

newReadsList=[]
for i in readsList:
i=i[2:]
newReadsList.append(i)

if verbose: print (newReadsList)

createReads(newReadsList)

There may be a better way, but this essentially takes the list created by the script and removes the first 2 characters of each line. As James pointed out the drive letter is repeated in the file name.

Thanks, this is a very helpful tool.
 
 
0 # Andrew Rea 2015-07-22 11:05
Brad,

any chance you could post your amendments?
I've been trying to get this to work for a while, seems to only load
the first sequence. I'm using Nuke 9X 9.04 on Windows
 
 
0 # Brad Schaider 2015-07-22 21:29
I did post the code. But let me walk you through it!

Download the recursiveLoad.p y and open it in an editor (might I recommend notepad++).

Jump to the end and find these lines:
Code:readsList=imgSeq2NukeFormat(filesFound)

if verbose: print (readsList)

createReads(readsList)


Then amend it so it says:
Code: readsList=imgSeq2NukeFormat(filesFound)

newReadsList=[]
for i in readsList:
i=i[2:]
newReadsList.append(i)

if verbose: print (newReadsList)

createReads(newReadsList)


BUT its very important that you get the leading spaces correct! Your choice to use spaces or tabs (1 tab = 4 spaces). Here is the spacing you need:
Code:
1 TAB readsList=imgSeq2NukeFormat(filesFound)

1 TAB newReadsList=[]
1 TAB for i in readsList:
2 TABS i=i[2:]
2 TABS newReadsList.append(i)

1 TAB if verbose: print (newReadsList)

1 TAB createReads(newReadsList)


Let me know if that helps!
 
 
0 # Andrew Rea 2015-07-24 21:47
Thanks so much Brad, all working now, my python skills are a bit of a work in progress!
 
 
0 # Matt Grasso 2017-02-10 13:38
I did the append but it works only for a single folder, multiple folders will open a single frame of the sequence
 
 
0 # Brad Schaider 2017-02-10 20:59
I haven't used this in a while. What version of Nuke, let me know and I'll test it see if it needs any more changes.
 
 
0 # Brad Schaider 2017-02-11 00:13
I'm gonna take a guess. The files that come in individual frames, do they have underscores between the file name and frame #? fileName_0001.e xr

I found 2 issues with this script. First, it doesn't allow underscores between file name and frame number (_#####.exr), also it doesn't really play nice with periods separating parts of the file name (file.pass.left .#####.exr).

I think I can fix this, but it won't happen til next week. In the mean time you could use a renaming utility, but that's also a pain. Let me know if one of those issues I described applies to you.
 
 
0 # Matt Grasso 2017-02-11 02:12
thank you for the kind brad but I did this, Opened in nkstudio and created comp special for every shot be in a single comp. have a nice time
 
 
0 # Brad Schaider 2017-02-11 04:41
Glad you got something working. Never the less I'll try and get the code running for others who look to use it in the future. If you have a second could you confirm for me if your files have an underscore before the frame #? That would tell me I'm headed down the right path.

All the best.
 
 
0 # Matt Grasso 2017-02-10 22:11
10.5v1, thank you man
 
 
0 # emmanuelle ricard 2017-04-22 23:25
Anyone knows how it is possible to customize this fantastic tool by using a dialog box that asking a specific folder by names of the episode and plan? rather than a getClipname?

Code:
import nuke
import string
import nukescripts
import sys
import os, glob, time, ctypes

class OpenLastCompGUI(nukescripts.PythonPanel):
def OpenLastCompGUI_dialog(self):
self.prj_base_path = 'X:\ProjectPath'
nukescripts.PythonPanel.__init__(self, 'Load All Reads By chosen Plan', '')
self.episode = nuke.String_Knob('frame', 'Episode No: ', '100')
self.addKnob(self.episode)
self.shot = nuke.String_Knob('frame', 'Shot No: ', '001A')
self.addKnob(self.shot)
result = nukescripts.PythonPanel.showModalDialog(self)
if result == True:
episode = self.episode.value()
shot = self.shot.value()
RDRPath = self.prj_base_path+ '\' +'EP' + episode+ '\*\' +shot+ '\' +'RenderFolder\'
print 'RDRPath: ', RDRPath
## Load All Reads By chosen Plan :

class OpenLastComp():

def OpenLastComp_gui(self, *args):
OpenLastCompGUI().OpenLastCompGUI_dialog()

def main():
OpenLastComp().OpenLastComp_gui()
 
 
0 # Bradley Webster 2017-08-04 07:17
Hey if you would like to bring in Ambelic files with this plugin, change the else Statement on line 111 to this:

'''
Updated the ReadGeo to ReadGeo2 (So you can read in Ambelic files)
'''
readGeo = nuke.createNode ('ReadGeo2')
readGeo['file'] .fromUserText(r )
sceneView = readGeo['scene_ view']

allItems = sceneView.getAl lItems() # get a list of all nodes stored in the abc file
sceneView.setIm portedItems(all Items) # import all items into the ReadGeo node

Also add '.abc' to the if statement on line 93
 
 
0 # Johan van Huyssteen 2022-08-31 14:12
Guys, if you want to make this work with Nuke 13 or above, just modify the all the print statements to include ( ) parenthesis to comply with python 3.

There are 2 lines that are trickier to fix, they both say:
if verbose: print >> sys.stderr,' 'failed here %s\n' % lineno()

but you can change it to:
if verbose: print ('>> sys.stderr,' 'failed here %s\n' % lineno() )


Also, if you follow ALL of the instructions listed in the comments, it will work, even with an image sequence.
 
 
+1 # Bruno Edelman 2023-03-29 10:00
I Cant get it to work in nuke 13.2
@Johan. Could you send your code with all of the necessary corrections?
 

You have no rights to post comments

We have 3509 guests and 120 members online