Thanks, Justin!

I will use this and cross-reference it with my current brute-force method of 
copy/pasting the nodes listed in the Nuke Reference Guide. I have a list of 287 
nodes from that I am currently validating with this:

(...not pasting my listOfAllNukeNodes here, since it's so long...)

for n in listOfAllNukeNodes:
    try:
        fn = getattr(nuke.nodes, n)
        node = fn()
        print "Valid:" + n
        nuke.delete(node)
    except:
        print "NOT VALID -----------------> " + n

Your method is also very interesting, though, because it gets all of the 
add-on/custom functions - not just the built-in Nuke ones!

(BTW -- I noticed that "node_list = []" was missing at the top of your pasted 
code...)

Thanks,
Rich

Rich Bobo Senior VFX Compositor
Email:  richb...@mac.com                        
Mobile:  248.840.2665
Web:  http://richbobo.com

On Aug 06, 2014, at 11:24 AM, Justin Fpc <j.grosde...@gmail.com> wrote:

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