setProjDir v2.3


 
This location is for Registered Users Only.
Perhaps you need to login or register.
Contributor: Jeang Jenq Loh
Set project directory and automatically swap out the file paths to relative if you already have file knobs in your script.
Requirements:
11.0, 10.5, 10.0 or later
Linux, Windows
25 Mar 2018
512

Version 2.3

  • Fixed issue in version 2.2 which converts everything to absolute path even nodes are not selected.

 

Version 2.2

  • Now can change directory multiple times while keeping file paths up to date.
  • Note: Haven't figure out a way for it to not convert all the file paths to absolute so better select the tcl/python linked nodes and exclude them!

 

Version 2.1

  • Resolved name error if a mix of nodes with and without file knob are selected. Script will keep running to change the nodes with file path, while ignoring those without.
  • Will prompt you that directory is set but no nodes were affected if you hit cancel.

 

Version 2.0

  • Support for linux.
  • Added popup panel to determine which nodes you want to affect. Options are:
    [All nodes, Selected nodes only, Exclude selected nodes]
  • Added option to exclude ReadGeo nodes. It shall remind you changing file path on readgeo nodes will affect your scenegraph configuration. Better take a screenshot of your previous configuration first!

 

This script is written to simplify process of setting project directory and what follows after, changing file paths on nodes. It happens if you're only using project directory after working on a shot for a while or getting other artist's work.

setProjDir

'Set Project Directory' will be added to the file menu and toolbar. If it's a new script it'll only show 'Custom path', which you can select a custom path for project directory. Note that this option will result in an absolute file path in your project directory knob.

Once you opened a script, other 5 options will shows up in both menus, which are going up 5 levels from the folder that contains your nukescript as shown in picture above. If you select one of these options your project directory will immediately set to that directory, which is using relative file path. So feel free to move your folder around after this is done. Choosing one of these options will also immediately alter all the file paths in your nukescript, changing them to relative file paths IF they are within your directory or sub-directory. If the file is in upper level of your directory, it will remain absolute. This works whether your file paths are already relative or absolute.

It also inlcuded additional scripts which are

  • absFilePaths: Which will convert your selected nodes' file paths (if has any) to absolute file paths, without affecting frame padding.
  • selNodeWithFile: Select all the nodes with a file knob, this works extremely well with absFilePaths for me as sometimes I just want to make everything absolute for compatibility issue.

setProjDir toolbar

I found using project directory better than putting relative file paths in each and every file knob, as instead of changing each knob I can just set the directory in one place, and change it as I move the folder. Which is the purpose of this script. Please let me know if you found any issues as I will keep improving it!

I started writing this when I was using nuke 10, I tested it in 10 and 11. But I don't see why it won't work it previous versions, feel free to test it out and please leave a comment if you found out it works in previous versions too!

 

To install this script, extract the folder in your .nuke folder, and add the line below to your menu.py

nuke.pluginAddPath('./setProjDir'
Please login in order to download these files.

Comments   

 
0 # Jason Huang 2018-03-18 15:27
Hey Jeang Jenq,

Thanks for sharing this tool. Very useful for when need to move projects around.
It would be great to have an option so that it only runs on selected nodes only. I have a script that has quite a few read nodes that load footage from a different location that is not inside of the project and I use custom expression links to link them. So when I run your setProjectDir, it also changes the file path for those expression-link ed path.
Hopefully my explanation make sense. :-)
 
 
+1 # Jeang Jenq Loh 2018-03-19 18:14
Hi Jason,

To clarify your read nodes are linked with tcl or python? And when run the script you don't want it to affect them? Yes I should look into that :)
 
 
0 # Jason Huang 2018-03-19 18:32
Quoting Jeang Jenq Loh:
Hi Jason,

To clarify your read nodes are linked with tcl or python? And when run the script you don't want it to affect them? Yes I should look into that :)

Not sure if it is linked with tcl or python. It's set up through another gizmo I installed in Nuke. So when I have Read nodes that load files from another drive (completely outside of current project structure), I use that gizmo to quickly switch parent directories.
Yes, when running your setProjectDir, I hope there is an option to only affect selected nodes/Read nodes so I can have a finder control on which Read nodes get set up through setProjectDir.

cheers!
 
 
0 # Jeang Jenq Loh 2018-03-20 08:04
Option now added in version 2.0
Thanks for your feedback, let me know if there's any issues!
 
 
0 # Jason Huang 2018-03-25 07:06
Quoting Jeang Jenq Loh:
Option now added in version 2.0
Thanks for your feedback, let me know if there's any issues!

Hey Jeang Jenq, thanks for pushing out the new version. I did a quick test. The new version would take a second to pop up the menu for me to choose all or selected nodes, which is totally fine, but the issue now is that it removes the expression links for expression-link ed nodes (didn't select them) and make all the paths as absolute paths.
If you want me to send you a sample script that has the gizmo I used for read node expression, just let me know and I'll send it to you.
 
 
0 # Jeang Jenq Loh 2018-03-25 08:17
Ah it seems I left out a line of code that does changes everything instead of using the node list the pop up panel created. The new version should fix that issue now!
 
 
0 # Hank Chang 2018-10-22 17:48
Hi Jeang Jeng,

Thanks for this cool tool!
Now, I work in Nuke version 11.2v3, I found that when I set the directory, it will change all the read modes to the absolute path and cause errors. wondering how to fix it
 
 
0 # Jeang Jenq Loh 2018-11-22 00:09
Hi Hank, thanks for letting me know. Sorry I only saw this reply now.
The script needs to convert path to absolute first so it can figure out which path to take out and convert to relative. But I think I can figure out a way for it not to actually do that in the script, I'll look into it.
I've included a pop up for excluding selected nodes or only do selected nodes while converting to absolute path. You can use that to exclude nodes from pipeline so it doesn't affect them. Does this function works for you?
 

You have no rights to post comments

We have 2863 guests and 67 members online