I don’t think the selectNodes() method replaces the current selection, so you would want to add a couple of lines in there:
def bdNodes(bdNode): origSel = nuke.selectedNodes() [n.setSelected(False) for n in origSel] # Alternatively, nukescripts.clear_selection_recursive() bdNode.selectNodes() bdNodes = nuke.selectedNodes() [n.setSelected(False) for n in nuke.selectedNodes()] # Or, again, clear_selection_recursive [n.setSelected(True) for n in origSel] return bdNodes -Nathan From: Frank Rueter Sent: Wednesday, February 29, 2012 4:48 PM To: nuke-python@support.thefoundry.co.uk Subject: Re: [Nuke-python] command for obtaining the contents of abackdropNode? oops, try this (using Nathan's suggestion for deselecting): http://pastebin.com/Qab7eMQi On 3/1/12 1:37 PM, Frank Rueter wrote: not per se but you can select all nodes in side a backdrop node, so a function like this will do what you're after: def bdNodes( bdNode ): origSel = nuke.selectedNodes() # STORE CURRENT SELECTION bdNode.selectNodes() # SELECT NODES IN BACKDROP bdNodes = nuke.selectedNodes() # STORE NODES # RESTORE PREVIOUS SELECTION: [ n.setSelected( False ) for n in bdNodes ] [ n.setSelected( True ) for n in origSel ] return bdNodes On 3/1/12 1:23 PM, adamchryDTS wrote: Hi all, command for obtaining the contents of a backdropNode? I'm sure a group node has this feature but I'm being asked to use a backdropNode. I looked around the api and did some searches. I don't see a simple way to query a backdropNode for the nodes contained within it. Is this possible? I did some a post from a few years ago where someone just took the bounding box of the backdrop node and queried every node if it was within the location. Just looking to see if there was a newer better method. _______________________________________________ Nuke-python mailing list Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/ http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python _______________________________________________ Nuke-python mailing list Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/ http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python -------------------------------------------------------------------------------- _______________________________________________ Nuke-python mailing list Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/ http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
_______________________________________________ Nuke-python mailing list Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/ http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python