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 pluginList = [] 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 pluginList.append(root) 23 n = nuke.menu("Nodes").addMenu("Other/"+menuname) 24 pluginList.sort() 25 26 def addToCommands(plugin): 27 s = plugin.upper() 28 p = n.addMenu(s[0]) 29 p.addCommand(plugin, "nuke.createNode('"+plugin+"')")
30 31 # BUG TP #415155 32 internalDependencies = { "Shuffle2":["Shuffle", "ShuffleCopy"] } 33 for plugin in pluginList: 34 if plugin in internalDependencies: 35 map(addToCommands, internalDependencies[plugin]) 36 addToCommands(plugin) 37