top of page

NESTED BACKDROPS

  • jnietomonco
  • Feb 6, 2023
  • 1 min read

This was the first tool I ever built for Nuke. I changed from one studio to a different one and I was missing a tool that allowed you to create fast backdrops with just a hotkey (I have it set with shift+b).



The code will recognize the area of your selection and use a font size depending on that. It will alternate colors depending on its Z Order, and it will also allow you to chose a specific preset if you prefer.


The different options are really easy:

  • Label: This is the text that will appear on your backdrop. If you leave it empty it will show nothing

  • Color: This is the color the backdrop will be:

    • Auto: It will chose between Light and Dark automatically depending on the Z Order of the backdrop

    • Light: Light grey color

    • Dark: Dark grey color

    • Extra: Darker than dark grey just in case you need it

    • New: This is an extra preset I use to know what new things have been done to the script. Imagine you have someone else's shot for a day or two, I let them know about the new things I added using this backdrop. It will be red and the label will automatically be NEW

Expand Nested Backdrops Code

import nuke
import nukescripts

def nestedBackdrops():
    ##Creates backdrop
    backdrop = nukescripts.autoBackdrop()
    
    ##Asking for position, width and height values
    XPos = backdrop.xpos()
    YPos = backdrop.ypos()
    width = backdrop.knob('bdwidth').getValue()
    height = backdrop.knob('bdheight').getValue()
    area = width*height
    ##Adjusting font size and height of the backdrop depending on its area
    if area <= 75000:
        backdrop['note_font_size'].setValue(25)
    elif area > 75000 and area <= 750000:
        backdrop['note_font_size'].setValue(42)
    elif area > 750000 and area <= 6650000:
        backdrop['note_font_size'].setValue(120)
        backdrop['bdheight'].setValue(height+100)
        backdrop.setYpos(YPos-100)
    else:
        backdrop['note_font_size'].setValue(200)
        backdrop['bdheight'].setValue(height+150)
        backdrop.setYpos(YPos-150)
    
    ##Backdrop color in HEX variables
    r = 0.5
    g = 0.5
    b = 0.5
    evenHex = int('%02x%02x%02x%02x' % (r*255,g*255,b*255,1),16)
    oddHex = int('%02x%02x%02x%02x' % ((r-0.25)*255,(g-0.25)*255,(b-0.25)*255,1),16)
    extraHex = int('%02x%02x%02x%02x' % ((r-0.35)*255,(g-0.35)*255,(b-0.35)*255,1),16)
    newHex = int('%02x%02x%02x%02x' % ((r+0.5)*255,(g-0.5)*255,(b-0.5)*255,1),16)
    
    ##Backdrop color depending on Z Order
    Z = backdrop.knob('z_order').getValue()
    if Z == 0.0 or Z%2 == 0:
        backdrop['tile_color'].setValue(evenHex)
    else:
        backdrop['tile_color'].setValue(oddHex)
    
    ##Popup Window
    BackdropPanel = nuke.Panel('Backdrop Settings')
    BackdropPanel.addSingleLineInput('Label', '')
    BackdropPanel.addEnumerationPulldown('Color', 'Auto Light Dark Extra New')
    BackdropPanel.show()
    
    ##Applying label variable to the final Backdrop
    label = BackdropPanel.value('Label')
    backdrop['label'].setValue(label)
    color = BackdropPanel.value('Color')
    
    if color == 'Light':
        backdrop['tile_color'].setValue(evenHex)
    elif color == 'Dark':
        backdrop['tile_color'].setValue(oddHex)
    elif color == 'Extra':
        backdrop['tile_color'].setValue(extraHex)
    elif color == 'New':
        backdrop['tile_color'].setValue(newHex)
        backdrop['label'].setValue('<center><b>NEW</b></center>')
    else:
        pass

def nestedBackdropsCheck():
    ##Check if any nodes are selected##
    selected = nuke.selectedNodes()

    if len(selected) == 0:
        if nuke.ask('No nodes selected. Are you sure you want to create a Backdrop?'):
            nestedBackdrops()
    if len(selected) > 0:
        nestedBackdrops()

Javier Nieto Moncó © 2025

  • linkedin
  • vimeo
  • generic-social-link
bottom of page