setProjDir

Set project directory and automatically swap out the file paths to relative if you already have file knobs in your script.

Updated: 25 March 2018

Author: jeangjenq

Compatible Nuke versions: 10.0 or later

Compatibility: Linux, Windows

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'

Sign in or register to download or rate.