Duplicate Read Destroyer v1.5
This location is for Registered Users Only.
Perhaps you need to login or register.
5.1, 5.2, 6.0, 6.1, 6.2, 6.3 or later
Linux, Mac, Windows


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.
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']) |
Comments
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...
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.
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.
RSS feed for comments to this post