Flags on Nuke read nodes based on publish status

I’m looking to display a small flag in Nuke’s node graph DAG based on whether the file path points to the latest version of that asset/publish. I’d like to draw an icon that’s connected to the read node so that it moves with the node as the user navigates around the DAG.

If a read node’s path is to the most recent version of the asset, it would appear green. If it’s not the most recent, it would be red and if it’s not linked to an asset at all, no flag would be displayed.

I have code to determine the version status of a file path when it’s read into Nuke, but I haven’t found a way to draw custom shapes in the DAG and attach them to nodes.

I’ve been reading Erwan Leroy’s blog about drawing in the DAG using Qt which might be a good way to go, but I thought I’d ask here and see if anyone has tried to do something similar.

I believe Nuke has a built in function for it but I can’t remember how.
This would be a good place to search but I’ll let you know if I know more.
nuke.knobDefault — Nuke Python API Reference

I think it had something to do with the autoLabel or autobackdrop function.

I attached an image on what I was imagining. On the read node, a green bar would appear above the node if it’s the most recent version of that asset. Otherwise, the bar would be red. The bar would act as if it was a part of the read node its self, so if the read node moves, the bar moves as well.
@Ricardo_Musch I believe autoLabel handles the naming of nodes when they’re created and autobackdrop is used to place backdrops behind nodes I think. Apologies if my initial post was too vague.

Hi @fuzzymango,

I have been looking some time ago to do the same thing, adding badges to nuke read nodes would be interesting.

I haven’t found out how to do that unfortunately. My poor man’s solution was to change the color of the read nodes. In my case, I just color them to differentiate between beauty renders and aovs.

In case it helps :

def tileColorConvert(tile_color):
    converts from color triplet (r,g,b, 0 to 255 to packed rgb used for nuke's tile_color knob)
    code borrowed from tk-nuke-writenode
    packed_rgb = 0
    for element in tile_color:
        packed_rgb = (packed_rgb + min(max(element, 0), 255)) << 8 
    return packed_rgb

green_color = [0, 255, 0]
green_tile_color = tileColorConvert(green_color)

# set the green color on a readnode :

If you find a solution, please share it :slight_smile:

1 Like

Here we go!


Yup that youtube video is great. Here’s my solution:

n = nuke.nodes.Read()
icon = r"C:\Users\USER\Downloads\smallIcon_green.jpg"
n.setCustomIcon(icon, 0.3, 85)