Be careful with with the deepSampleCount approach, as it will require 
computation of image data if it isn’t already available.

The canSetInput test isn’t a bad idea and would work most of the time, but what 
about DeepToImage or DeepToPoints?

-Nathan



From: Anthony Kramer 
Sent: Friday, June 13, 2014 2:47 PM
To: Nuke Python discussion 
Subject: Re: [Nuke-python] Identify deep node with python

Nice, that seems to work, thanks!




On Fri, Jun 13, 2014 at 2:42 PM, Jose Fernandez de Castro 
<pixelcowbo...@gmail.com> wrote:

  Another hacky way (not thoroughly tested though) could be to do the following:
  try:
      nuke.selectedNode().deepSampleCount(0,0)
      print("Deep")
  except(ValueError):
       print("Not deep")


  On Fri, Jun 13, 2014 at 2:26 PM, Anthony Kramer
  <anthony.kra...@gmail.com> wrote:
  > Its hacky but heres what I came up with. It tests whether all the node(s)
  > you have selected can connect to a DeepTransform node, which presumably
  > means they are deep nodes:
  >
  >
  > nodes = nuke.selectedNodes()
  >
  > nukescripts.clear_selection_recursive()
  >
  > test = nuke.createNode('DeepTransform')
  >
  > for n in nodes:
  >
  >      if not test.canSetInput(0, n):
  >
  >      ret = False
  >
  >      break
  >
  > else:
  >
  >      ret = True
  >
  > nuke.delete(test)
  >
  > print ret
  >
  >
  >
  > If anyones got a better idea, I'd love to hear it.
  >
  >
  >
  >
  > On Fri, Jun 13, 2014 at 12:24 PM, Nathan Rusch <nathan_ru...@hotmail.com>
  > wrote:
  >>
  >> Off the top of my head, I don’t think there’s anything incriminating about
  >> deep nodes other than the fact that their class names start with "Deep" 
(for
  >> now, at least).
  >>
  >> -Nathan
  >>
  >>
  >> From: Anthony Kramer
  >> Sent: Friday, June 13, 2014 11:36 AM
  >> To: Nuke Python discussion
  >> Subject: [Nuke-python] Identify deep node with python
  >>
  >> Looking for a way with python to identify if the selected node(s) as deep
  >> nodes.
  >>
  >> -ak
  >>
  >> ________________________________
  >> _______________________________________________
  >> 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
  >




  --
  Jose Fernandez de Castro

  _______________________________________________
  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

Reply via email to