hi

the rapid way to get this working is like the example code below:

def autoColorReadNodeType(overrideNode=None):
        if overrideNode == None:
                this = nuke.thisNode()
        else:
                this = overrideNode
        
        # get the Read node file name
        thisFile = this["file"].evaluate()
        
        # catch keyword in the filename path to set custom color
        if "/depth/" in thisFile:
                nodeColor = 4280356351
        elif "/matte/" in thisFile:
                nodeColor = 862912511
        else:
                nodeColor = 0
        
        # set the Read node custom color
        this["tile_color"].setValue(nodeColor)

then add this line to your init.py :

nuke.addOnCreate(autoColorReadNodeType, nodeClass = "Read")

Now each time a Read node is created and the one of your keyword
is found in the filename, it get the custom color, or 0 for no color.

let me know if it works for you ;)

On Thu, Feb 9, 2012 at 9:03 PM, Jud Pratt <[email protected]> wrote:
> Hey all... I'm wondering if there is a script that will let me color a read
> node according to where the file came from.
>
> I'm working on a 3D conversion project and the way the pipeline is set up,
> all the source files (depth, original footage, mattes, etc.) are named
> identically... sort of like shot_reel.########.dpx.  Each of those lie in
> their own particular folder akin to
> ../depth/foreground/version/001/shot_reel.########.dpx for example.
>
> The problem is sometimes you can have several read nodes right next to each
> other and lose track with the only option to be double click on them and see
> what their source is.
>
> I would like to have the color of the read node set itself automatically
> depending on what the parent folder is. e.g red for depth, green for
> original source, etc.  I'm sure it can be done in python, but I haven't
> really learned my scripting yet and this project won't really offer me the
> time to dig into it.
>
> I'm guessing it'd be a fairly simple script...  if path contains depth,
> color node red else if path contains matte color node blue.  Hmm... maybe I
> can find the time to figure out the syntax.  Any tips would be welcome
> though!
>
> Now to get some sleep... been doing some long days of late.
>
> Thanks in advance for any help!
> --Jud
>
>
> _______________________________________________
> Nuke-users mailing list
> [email protected], http://forums.thefoundry.co.uk/
> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users



--
Matthieu Cadet
Compositor Artist & TD,
nWave Digital
[email protected]
_______________________________________________
Nuke-users mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users

Reply via email to