nukescripts.nodes

Package nukescripts :: Module nodes |
[hide private]
[frames] | no frames]

# Source Code for Module nukescripts.nodes

     1  # Copyright (c) 2009 The Foundry Visionmongers Ltd.  All Rights Reserved.
     2
     3  import nuke
     4
     5
     6 -def color_nodes():
     7    """Set all selected nodes to be the same colour as the first selected node."""
     8    n = nuke.selectedNode()
     9    if n is None:
    10      nuke.message("No node selected")
    11      return
    12
    13    c = n.knob("tile_color")
    14    c = nuke.getColor(c.value())
    15    n.knob("tile_color").setValue(c)
    16
    17    # get other nodes:
    18    n = nuke.selectedNodes()
    19    for i in n:
    20      i.knob("tile_color").setValue(c)
    21    nuke.modified(True)
    22
    23
    24 -def node_delete(popupOnError = False):
    25    d = nuke.dependentNodes(nuke.EXPRESSIONS | nuke.HIDDEN_INPUTS, nuke.selectedNodes(), False)
    26    l = ""
    27    for i in d:
    28      if i.Class() != "Viewer":
    29        l = l + i.fullName() + ", "
    30    l = l[0:len(l)-2]
    31    if len(l) > 0:
    32      if not nuke.ask("The nodes you are deleting are used by expressions in:\n" + l + "\nAre you sure you want to delete?"):
    33        return
    34    nuke.nodeDelete(popupOnError)
    35