Duplicate Read Destroyer v1.5


 
This location is for Registered Users Only.
Perhaps you need to login or register.
Contributor: Nathan Rusch
Removes superfluous Read nodes sharing duplicate knob values (optionally filtered by name regex). Replaces them with shaded PostageStamp nodes with hidden inputs.
Requirements:
5.1, 5.2, 6.0, 6.1, 6.2, 6.3 or later
Linux, Mac, Windows
24 Aug 2011
354

Duplicate Read Destroyer

Module containing classes for facilitating the removal of duplicate Read nodes based on a user-specified set of knobs to check. From every set of duplicates, the node highest vertically in the DAG is preserved, while the other duplicates are replaced with shaded PostageStamp nodes referencing the remaining copy, with hidden inputs.

Recently rewritten as a class-based system. The worker class is designed to deal primarily with Read nodes, but it contains a static method that can be used to de-duplicate any list of nodes (of any class) by any list of knob names.

Using the DupReadDestroyer class

Basic usage

This is the main class, designed to ease in the removal of duplicate Read nodes. The simplest use case is as follows:

1
2
3
import dupReadDestroy
 
dupReadDestroy.DupReadDestroyer().destroy()

This will prompt the user for a set of criteria to use, including:
1) whether to operate on all Read nodes or the currently selected Reads,
2) whether to further filter the resulting node list by testing the node names against a user-specified regular expression, and
3) which knobs to consider when deciding which nodes are duplicates of each other.

DupReadDestroyGUI

Note: Only nodes whose values for all specified knobs match each other are considered duplicates.
Extended usage

The worker class will accept keyword arguments for whether to use selected nodes (False by default) and what context to pick the nodes from (nuke.root() by default), as well as an arbitrary set of keyword arguments corresponding to the knob names you wish to use and the regex pattern to filter by:

1
2
3
4
import dupReadDestroy
 
d = dupReadDestroy.DupReadDestroyer(__regex='^HeroRead_\d+$', file=True, colorspace=True)
d.destroy()

This makes it easy to cross-call the de-duplication class from other scripts without having to deal with user interaction. This invocation is also required if Nuke is running in non-GUI mode; an exception will be raised if an instance is constructed without any keyword arguments in a terminal session.

Bypassing class instantiation

If you don't want to deal with class instances, things can be simplified even further using the DupReadDestroyer class' static 'processNodes' method. This simply takes a list of nodes and a list of knob names and de-duplicates the nodes accordingly. In theory, this can be used on any node class, though the cases in which that could be useful are most likely few and far between.

1
2
3
import dupReadDestroy
 
dupReadDestroy.DupReadDestroyer.processNodes(nuke.allNodes('Read'), ['file', 'colorspace'])
Please login in order to download these files.

Comments   

 
0 # Zach Lewis 2011-08-06 12:50
Hey, this is awesome, man. I hate duplicate reads with the fiery passion of a thousand burning suns.

I'd actually love to have a revised version, if you're feeling like it, cuz I like using the dope sheet with read nodes as a poor man's timeline, and crosscuts are not that uncommon...
 
 
0 # Nathan Rusch 2011-08-15 21:21
Hey, glad you found this somewhat useful. Unfortunately I haven't had the time to really do any scripting outside work for quite some time, so the realistic chances of a revised version in the very near future are slim.

That being said, if you have some ideas for criteria you would like to see added, please let me know. I've been thinking of modifying it to allow the user to pick which criteria to use to filter out Reads.
 
 
0 # Zach Lewis 2011-08-15 21:41
Hey man. Again, thanks. I understand the no-time thing completely.

Buuuuuttt.... if you're looking for feedback...
If I could use regular expressions to whitelist nodes, that would be perfect. For me, anyway. I think. I could just whitelist any node that had a time-offset or whatever other than zero. That would actually be the perfect solution for my only beef. Is that possible? I'd give you the hardest high five if I could.
 
 
0 # Nathan Rusch 2011-08-22 23:50
Alright, I just uploaded a completely rewritten module. Give it a shot once the upload is approved and let me know how it works out.
 
 
0 # Zach Lewis 2011-08-24 18:48
Dude, this looks wonderful. I haven't had a chance to really mess around with everything, but I'll let you know if I manage to break it. The object-oriented approach is very clever - being able to pass in arguments really enhances usability. Thanks for updating this. A++++ seller, would buy from again.
 
 
0 # Anselm Lier 2011-08-26 07:25
Thanks Nathan, this is great!
 

You have no rights to post comments

We have 2952 guests and 61 members online