AUTO CREATION OF MENU ITEMS FOR GIZMOS. (MENU.PY) v2.0
This location is for Registered Users Only.
Perhaps you need to login or register.
6.0, 6.1, 6.2 or later
In the previous version of this, Gizmos would not load in the command line version of Nuke. The fix was to use init .py. Thanks again Paul!
OS X and Linux Easy install instructions.
1. Copy the menu.py and init.py into your ".nuke" folder. If these files already exist, merge the contents of the two in a text editor.
2. Copy the directories within the Gizmos folder directly into your ".nuke" folder
3. Open Nuke
OR If you want to put the gizmos into a subdirectory
1. Copy the contents of the zip folder into your .nuke directory. If init.py and menu.py files already exist, merge the contents of the two in a text editor.
2. Open init.py and add a "CUSTOM_GIZMO_LOCATION" path. Replace "" with your login name.
r'/users//.nuke/Gizmos'
3. Save file and open Nuke.
The zipped download of all our Nuke tools can be found here. There are also more in-depth download instructions!
http://www.luma-pictures.com/tools/nuke/
Please feel free to email [email protected] with any questions, comments, bug reports, feature requests, etc.
www.luma-pictures.com
Comments
just be aware that if you do this you still need to add the plugin paths to init.py as well, or they won't be picked up by nuke when it's run for a command line render. so scripts created in the GUI might have nodes which the render farm can't find!
But what is the easiest way to use this and get custom icons on the folders?
All you have to do is change the line in the init.py under "recursiveAddGi zmoMenuItems()" that looks like this...
toolbar.addCommand(niceName,"nuke.createNode('%s')" % name)
to ...
toolbar.addCommand(niceName,"nuke.createNode('%s')" % name, icon=name+".png ")
if sys.platform.startswith('win32'):
CUSTOM_GIZMO_LOCATION = r'PCLOCATION/AwesomeFolder/Gizmos';
if sys.platform.startswith('darwin'):
CUSTOM_GIZMO_LOCATION = r'MACLOCATION/A wesomeFolder/Gi zmos';
nuke.pluginAddPath(".../gizmos/icons", addToSysPath=Fa lse);
def addGizmoMenuIte ms(self, toolbar=None, defaultTopMenu= None):
'''Recursively create menu items for gizmos found on the searchPaths.
Only call this if you're in nuke GUI mode! (ie, from inside menu.py)
toolbar - the toolbar to which to add the menus; defaults to 'Nodes'
defaultTopMenu - if you do not wish to create new 'top level' menu items,
then top-level directories for which there is not already a top-level
menu will be added to this menu instead (which must already exist)
'''
if not self._crawlData :
self.addGizmoPa ths()
if toolbar is None:
toolbar = nuke.menu("Node s")
elif isinstance(tool bar, basestring):
toolbar = nuke.menu(toolb ar)
self._recursive AddGizmoMenuIte ms(toolbar, self._crawlData , CUSTOM_GIZMO_LO CATION,
defaultSubMenu= defaultTopMenu,
topLevel=True)
def _recursiveAddGi zmoMenuItems(se lf, toolbar, crawlData, currentDir,
defaultSubMenu= None, topLevel=False) :
for name in crawlData.get(' gizmos', ()):
niceName = name
if niceName.find(' _v')==len(name) - 4:
niceName = name[:-4]
toolbar.addComm and(niceName,"n uke.createNode( '%s')" % name, icon=name+".png ")
for folder, data in crawlData.get(' dirs', {}).iteritems() :
import sys
subMenu = toolbar.findIte m(folder)
if subMenu is None:
if defaultSubMenu:
subMenu = toolbar.findIte m(defaultSubMen u)
else:
if topLevel:
subMenu = toolbar.addMenu (folder, icon= CUSTOM_GIZMO_LO CATION + r'' + folder + '.png')
else:
subMenu = toolbar.addMenu (folder, icon= currentDir + '' + folder + '.png')
self._recursive AddGizmoMenuIte ms(subMenu, data, currentDir + '' + subMenu.name())
Now all toplevel folders, subfolders and gizmos should be displayed with icons. You only need to create the icons and name it the same as the name of directories and gizmos and place them accordingly in the directory structure.
import sys
for folder, data in crawlData.get(' dirs', {}).iteritems() :
import sys
subMenu = toolbar.findIte m(folder)
can you plesae correct it
That's all available here: https://github.com/Shrinks99/menumaker
I was banging my head trying to figure out how to add .nk as well and came here to see if there was an update... ALA !!!
Much obliged !
For anyone in the future I'd recommend checking out NukeShared: https://maxvanleeuwen.com/project/nukeshared/, it's a much more comprehensive tool although as of posting it may also not be upgraded for use with Nuke 13.
any chances it could be updated?
https://github.com/Shrinks99/menumaker/releases
For any other scripts you might encounter that haven't been / won't be updated for Python 3 I can recommend the command line program 2to3, it made updating this a breeze! Hopefully it will save you some time as well.
I hope that the fact updating this took so long for me to get around to hasn't caused any major issues and that you find all find it helpful! :)
That out of the way, Nukeshared has also been updated for Python 3 and I would really recommend using that tool instead, it's got additional features and is generally better!
RSS feed for comments to this post