Here's an example from a while back: 
http://forums.thefoundry.co.uk/phpBB2/viewtopic.php?p=43348#43348

-Nathan



From: Justin Fpc 
Sent: Wednesday, August 06, 2014 8:22 AM
To: Nuke Python discussion 
Subject: Re: [Nuke-python] List of all Nuke nodes...?

Hi,


I had the same issue few weeks ago. So I made a quick recursive function that 
loops through the parent menu to retrieve all Nodes. 

I did not have time to filter those "specials" (hidden) item menu though 
(starting by @ for example).

--------------------------------------
node_dic = {}

def getItem(menu):

    '''
    Recursive function to browse all menus and submenus
    of the Nodes menu to retrieve all items and commands
    to execute them.
    '''
    if isinstance(menu,nuke.Menu):
        for item in menu.items():
            getItem(item)
    else:
    #the menu is actually a command
        if (menu.name() not in node_list and
            menu.name() not in node_dic.values()):
            node_dic[menu] = menu.name()


getItem(nuke.menu("Nodes"))


for name in node_dic.values():
    print name 


----------------------------------------







If you want to get all nodes object, names from your Nodes menu (where all 
nodes and plugin should be); you can call the function by :


    getItem(nuke.menu("Nodes"))





You can print all names retrieved :



for name in node_dic.values();

    print name 


Then you can execute (create) the node by calling :

    for node in node_dic.keys():

        #if .... filter as you want ; maybe the node.Class()

            node.invoke()

where node is your actual node python object



Hope that helps.


Cheers,



Justin


























2014-08-06 15:40 GMT+01:00 Richard Bobo <richb...@mac.com>:

  Hi,

  Other than looking through the Nuke Reference Guide, is there a Pythonic way 
to list all of the types/classes of Nuke nodes? I'd like to search though the 
list of all Nuke node types for the existence of certain knobs, etc.

  Thanks,
  Rich 
Rich Bobo 
Senior VFX Compositor
Email:  richb...@mac.com                        
Mobile:  248.840.2665
Web:  http://richbobo.com
  _______________________________________________
  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