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.
Contributor: www.luma-pictures.com
Just drag and drop gizmos into the right folder and they will show up in your Nuke menus. No longer will you have to create the menu items manually for each gizmo you want to install.
Requirements:
6.0, 6.1, 6.2 or later
08 Feb 2011
2912
Just drag and drop gizmos into the right folder and they will show up in your Nuke menus. No longer will you have to create the menu items manually for each gizmo you want to install.
-Written by Paul Molodowitch!  Thanks man! 
Note: The previous Luma menu.py should be overwritten with this new one.

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
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Please login in order to download these files.

Comments   

 
0 # Lewi Lewis 2011-01-13 17:47
Thanks for these, much appreciated.
 
 
0 # Lewis Saunders 2011-01-19 03:56
this is very neat :-)

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!
 
 
0 # Ivar Rystad 2011-02-14 02:37
This works great! Thanks alot!
But what is the easiest way to use this and get custom icons on the folders?
 
 
0 # Justin Johnson 2011-02-15 22:19
We are working on an update to this. We will try to include support for Icons soon. :-)
 
 
0 # Ivar Rystad 2011-05-23 03:04
Any news on an update to this? Would be awesome-o if it supported custom icons on the folders :-)
 
 
0 # Richard Blank 2012-03-21 01:15
Is there any way to make the CUSTOM_GIZMO_LO CATION path cross platform to work on both windows and Mac?
 
 
0 # Eli Intriligator 2012-05-17 00:58
I accidentally replaced the files and now it doesn't work. Is there something I can change in the python files so that they are default? (Please answer soon, I can't use Nuke until it is fixed.)
 
 
0 # Justin Johnson 2012-05-17 08:58
I am not sure what your issue is exactly.. You can email and we can try to figure out what is going on.
 
 
0 # J Bills 2012-06-15 18:06
mega-handy. thanks for sharing.
 
 
0 # Cameron Carson 2012-09-18 12:27
Not sure if Anyone is interested but It's super easy to get Icons working provided you name them the same as the name of the gizmo. For example MyAwesomeGizmo. png goes with MyAwesomeGizmo.py.

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 ")
 
 
0 # Cameron Carson 2012-09-18 12:28
Oh also Richard Not sure if anyone answered your question but the way you make the locations cross platform is to use something like this...

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';
 
 
0 # Cameron Carson 2012-09-18 12:32
Oh I forgot to add that you have to have wherever you place your icons for this has to be added to the system path Using a line like this in the init.py. You might already have one. I did that's why I forgot.

nuke.pluginAddPath(".../gizmos/icons", addToSysPath=Fa lse);
 
 
+2 # Piotr Borowski 2013-05-17 05:58
Hi, I rewrote a piece of code:

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.
 
 
0 # KARTHICK K 2019-02-06 17:34
When i used this , throwing error line
import sys

for folder, data in crawlData.get(' dirs', {}).iteritems() :
import sys
subMenu = toolbar.findIte m(folder)

can you plesae correct it
 
 
0 # Doctor Remulak 2016-07-30 13:02
Awesome script. Thanx!
 
 
0 # Henry Wilkinson 2020-01-17 05:01
It's 2020 and I've made some updates to this! Now supports images by default as is posted in this thread, .gizmo and .nk files, and no more hardcoded user home folder path!

That's all available here: https://github.com/Shrinks99/menumaker
 
 
+1 # Henrique Reginato 2020-07-30 23:50
THANK YOU !
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 !
 
 
0 # Vale Angel 2021-03-22 18:17
Looks like it's not working under Nuke 13, the old and also your new Menumaker scripts. Worked like a charm till 12.2 v3.
 
 
+1 # Henry Wilkinson 2021-03-22 18:43
Haven't tested it with Nuke 13 yet but I suspect this is because of the Python3 upgrade. I'm glad you found this helpful up to now!

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.
 
 
0 # Daniele Orsetti 2021-05-02 12:49
This seems to have stopped working with nuke 13 :(
any chances it could be updated?
 
 
+1 # Henry Wilkinson 2021-05-02 19:29
Alright, I've updated the tool, you can download the new version of it here:
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!
 
 
0 # Jacob Holiday 2022-05-05 16:15
Works like a charm, thanks!
 

You have no rights to post comments

We have 3498 guests and 128 members online