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

Source Code for Module nukescripts.plugin_menu

 1  # Copyright (c) 2009 The Foundry Visionmongers Ltd.  All Rights Reserved. 
 2   
 3  import os.path 
 4  import nuke 
 5   
 6  # Warning this relies on nuke replacing matching menu entries so that 
 7  # we don't get duplicates: 
8 -def update_plugin_menu(menuname):
9 list = [] 10 if nuke.env['nc']: 11 plugins = nuke.plugins(nuke.ALL | nuke.NODIR, "*."+nuke.PLUGIN_EXT, "*.ofx.bundle", "*.gizmo", "*.gznc") 12 else: 13 plugins = nuke.plugins(nuke.ALL | nuke.NODIR, "*."+nuke.PLUGIN_EXT, "*.ofx.bundle", "*.gizmo") 14 for i in plugins: 15 (root, ext) = os.path.splitext(i) 16 (root, ext) = os.path.splitext(root) 17 # Sometimes we get files like ._Glare.gizmo, etc due to Mac OS X 18 # or editors and that returns an empty string for root. 19 if root is None or len(root) == 0: 20 continue 21 if not root[0] == '@': 22 list.append(root) 23 n = nuke.menu("Nodes").addMenu("Other/"+menuname) 24 list.sort() 25 for i in list: 26 s = i.upper() 27 p = n.addMenu(s[0]) 28 p.addCommand(i, "nuke.createNode('"+i+"')")
29