README///////////////////////////////////////////////////////////////////////////////////////////////////

dw_gdDirReadSetup_v1_1

Written by:  Dave Windhorst    08/25/2012


Python script pack including 3 new commands/nodes: GLOBAL_DIRECTORY node, Associate GD-Read Node 
Selected, and GD-Read Node Setup. Also includes custom 'DW Tools' menu to store these commands and 
future ones to a menu on the 'Nodes' panel menu in Nuke for easy access.

Used to make relative Read nodes. The GD node contains the root directory used to point to where the 
Read nodes associated to it are contained. If the script and Read files are moved to another workstation 
or directory, the user only needs to update the GD node to the new location. GD nodes can be nested 
manually (associate one GD to another) in order to mimic more complex folder/sub-folder structures 
within Nuke.


NOTE: Some limitations due to the variability of OS structures may lead to these scripts not 
working/creating unexpected results. They have been tested in Nuke 6.3v8 running on Windows 7 (64-bit) OS.

NOTE: Created in Nuke 6.3v8.


Contained Files///////////////////////////////////////////////////////////////////////////////////////////

- 'icons' folder
	- dw_gdReadSel.png
	- dw_gdReadSetup.png
	- dw_globalDirSep.png
	- dw_menu.png
	
- 'python' folder
	- dw_globalDirReadSetup_v1_1.py

- init.py
- menu.py
- README.TXT


Steps/////////////////////////////////////////////////////////////////////////////////////////////////////

1. Import/Install Python Scripts into Nuke. To install, copy files (except README.TXT) to '.nuke' folder
	found on workstation. To learn why/how, please watch this tutorial:

	http://www.davewindhorst.com/resources.php?type=tutorials#dw_tut001


	
	To import commands/run them from the script editor are as follows:
	
	
		Global Directory:			dw_globalDirReadSetup_v1_0.globalDirSep()
		
		GD-Read Associate Selected:	dw_globalDirReadSetup_v1_0.gdReadSel()

		GD-Read Setup:				dw_globalDirReadSetup_v1_0.gdReadSetup()
		
		
		
2. Use Imported or 'DW Tools' menu created on Nuke 'Nodes' Menu Toolbar



Global Directory  (Hotkey: A )////////////////////////////////////////////////////////////////////////////

Creates a GLOBAL_DIRECTORY (GD) node in the Nuke DAG window.  Use the 'proj dir' directory knob to open a 
'root path' that will be used to associate other nodes to.  Once the path has been specified, the node
will display it's path in the DAG window for quick reference. A Read node is then associated (by 
expressions) to the GD node.  This can been done in three ways:



	1.  By manually copying the 'label' code found in the GD node's 'Node' tab, 'label' knob.  This code
		should be copied exactly as is and placed within the Read/GD node's path knob. This code should 
		replace the portion of directory that matches the GD node directory.
		
		For example:
		
			GLOBAL_DIRECTORY1 node:	C:/Users/Dave/Projects/
			
			GD node 'label':		[value GLOBAL_DIRECTORY1.projDir]
			
			Read node:				C:/Users/Dave/Projects/shot_001/shot_001.%04d.exr
			
			Read node (new dir.):	[value GLOBAL_DIRECTORY1.projDir]shot_001/shot_001.%04d.exr

			
			
	2.  By selecting the GD node and any Read nodes to be associated and then using the GD-Read Associate
		Selected ( Hotkey:  Ctrl+R ) command.


		
	3.	By using the GD-Read Setup ( Hotkey: Shift+R ) command to either create/select an existing GD node
		and then create a Read node automatically associated to it.
		

		
GD nodes can be nested (A GD node can reference to other GD nodes which then reference to other GD/Read
nodes).  This allows the user to mimic their OS folder structure for files within the Nuke DAG.  In order to 
do this, the association should be done by first associating a GD node to a Read node (manually or 
automatically), and then associating the GD node to another GD node ( can only be done manually).


	For example:
	
		GLOBAL_DIRECTORY1 node:	C:/Users/Dave/Projects/
			
		GD node 'label':		[value GLOBAL_DIRECTORY1.projDir]
		
		Read node:				C:/Users/Dave/Projects/shot_001/shot_001.%04d.exr
			
		Read node (new dir.):	[value GLOBAL_DIRECTORY1.projDir]shot_001/shot_001.%04d.exr
	
	
		^--- This step can be done manually (copy code) or automatically (GD-Read Associated Selected command).
			 In this step, the GD1-node 'label' code was copied and placed in the Read node.

			 
		
		GLOBAL_DIRECTORY2 node:			C:/Users/
		
		GD node 'label':				[value GLOBAL_DIRECTORY2.projDir]
		
		GLOBAL_DIRECTORY1 node:			C:/Users/Dave/Projects/
		
		GLOBAL_DIRECTORY1 (new dir.):	[value GLOBAL_DIRECTORY2.projDir]Dave/Projects/
		
		Read node (not changed):		[value GLOBAL_DIRECTORY1.projDir]shot_001/shot_001.%04d.exr


		^--- This step can only be done manually (copy code) at this time. In this step, the GD2 'label' code
			 was copied and placed in the GD1 node. The original file path is now split across three nodes:
			 
			 GD2:	C:/Users/
			 
			 GD1:	Dave/Projects/
			 
			 Read:	shot_001/shot_001.%04d.exr
			 
			 
			 GD2 --->  GD1 ---> Read:  C:/Users/Dave/Projects/shot_001/shot_001.%04d.exr
			 

There can be as many nested GD nodes as required, as long as the image file path is completed.  GD nodes can 
be associated to more than one GD or Read node at a time.



GD-Read Associate Selected  (Hotkey:  Ctrl+R )/////////////////////////////////////////////////////////////

This command tries to associate the selected GD node and Read nodes.  More than one Read node can be seleccted, 
but only one GD node can. If command is used on a Nukescript which doesn't have Read Node errors, all selected 
Read nodes will automatically be associated to the GD node.  

If Read node errors are present (if the read directories are moved or non-existant), an error will display 
that the association cannot occur automatically, along with a prompt to let the user to connect them manually. 

If No, then the program will continue associating until done or another error is found.  

If Yes, then a Read Sequence Dialog Box will open, allowing the user to find the desired image file sequence. 
If done correctly, the program will now know where to associate and will continue associating until done or 
another error is found.

NOTE: This command will only work on GD-Read node associations, not nested GD-GD node associations!



GD-Read Setup  ( Hotkey:  Shift+R )//////////////////////////////////////////////////////////////////////////

This command displays a Modal Dialog Box to allow the user to create new/select existing GD nodes and associate 
them to created Read nodes automatically.  This command is not for Read nodes already created in the Nuke DAG 
window, but ones to created through the Modal Dialog Box (In theory, replaces the Read command). This modal 
dialog box has two modes: 'Create New GD Node' and associate to GD node listed in 'Node Selected'.

By default, the 'Node selected' option is set to 'Create New GD Node', allowing the user to specify the new GD 
node's path directory in the 'GD Proj Dir' Read Sequence Knob.  Once the Path has been specified, the user must 
click the 'GENERATE GD NODE' button to create a GD node with the path specified (if not, nothing will happen if 
the dialog box is closed).

Once the GD node is created, the dialog box changes to the selected GD node (the command is assuming that if the 
GD node is created, it is the GD node the user wishes to associate with). The 'Node Selected' is now the selected 
GD node and displays it's path directory at the 'Directory' knob.  Since the 'Create New GD Node' is no longer 
selected, the command removes these to avoid confusion and now only displays the Read 'File' sequence dialog knob. 
This mimics a regular Read node by the user being prompted to select the image file.  Once the file has been 
located, the 'GENERATE READ NODE' button must be used to create the Read node (during creation, it is associated 
automatically to the GD node listed in the 'Node Selected' Knob). NOTE: If the dialog box is closed before hitting 
the button, the Read node is not created!

The 'Node Selected' dropdown menu will list all GD nodes currently found in the Nukescript and when selected, will 
display their path directories (this makes it easier to find which GD node to associate with in large Nukescripts). 
If a GD node is selected, the 'Create New GD Node' options will be removed and the only options left are to create 
Read nodes.

NOTE: The Dialog box stays open after generating a Read node, allowing the user to continue creating read nodes or 
GD nodes to be used.


	
KNOWN ISSUES///////////////////////////////////////////////////////////////////////////////////////////////

- Some limitations due to the variability of OS structures may lead to these scripts not 
  working/creating unexpected results. They have been tested in Nuke 6.3v8 running on Windows 7 (64-bit) OS. 
  Use at your own risk!