<\/a><\/p>\n <\/p>\n
<\/p>\n
<\/p>\n
<\/p>\n
<\/p>\n
<\/p>\n
<\/p>\n
<\/p>\n
<\/p>\n
<\/p>\n
<\/p>\n
<\/p>\n
<\/p>\n
<\/p>\n
Select your \"snatch\" folder and click ok.<\/p>\n
And voila, navigate to the chosen folder and you should find there all the Gizmos and Groups you've previously selected<\/strong>. By the way, as a side note, when snatching actual Gizmos and not Grizmos or Groups, the tool is first going to convert the Gizmo into a Group and then export the Group to the folder, adding the suffix \"_toGroup\"<\/span> to the original Gizmo's name... just so you know!<\/p>\n<\/div>\n
bonus snippet!!<\/strong><\/h6>\nNow, after having snatched, created, and downloaded your favorite Gizmos, it's time to deploy them within your little Nuke path.<\/strong> While you can just drop them inside the .nuke<\/strong> folder and use the command \"update\" inside the \"Other\/All plugins\" menu on Nuke's Toolbar, this is probably the laziest and less organized way to go.<\/p>\nAlternatively, as you probably already know, you can create menus and submenus on Nuke's Toolbar to add your Gizmos<\/strong>, using these simple commands:<\/p>\nnuke.menu("Nodes").addMenu("MyMenu", icon = "MyMenuLogo.png")\r\ntoolbar.addCommand("MyMenu\/MySubMenu\/ToolName", "nuke.createNode("ToolName")")\r\n<\/pre><\/div>\n<\/div>\n
Although there's nothing wrong with this option, just think of having to write one line of code for each of the Gizmos you wanted to add to your menus, in addition to having to create and name those menus by hand. Yuck!<\/p>\n
Now, one smart way to do this, would be to have all these gizmos distributed in folders and subfolders named as we want our Nuke menus and submenus to be named, and somehow write some hacky snippet that will automatically create the menus based off of these folders, name them accordingly, and list all the contained tools, as well as adding the menu icon again, automatically.<\/strong> For this to work (in this implementation I am sharing), we have to ensure 4 things:<\/p>\n<\/div>\n
1 - that the folders will be named according to this syntax: <gizmos_JohnDoe><\/strong>. Namely, the word \"gizmo\"<\/span> an underscore \"_\"<\/span> and any name we wanted, in this case, \"JohnDoe\"<\/span>.<\/p>\n2 - that the icon to be used will be named exactly like the name after the underscore<\/strong>, in this case, \"JohnDoe\"<\/span> and it will be a PNG image. I.e: \"JohnDoe.png\"<\/span><\/p>\n3 - that the folder will be on the same root where the menu.py<\/strong> is.<\/p>\n4 - that there will not be more than two nested levels in the gizmo folders<\/strong>, meaning there can be only subfolders inside the gizmo folders (to create subcategories), but not sub-subfolders.<\/p>\nWith that out of the way, just copy this little snippet inside your menu.py, save it and you should be good to go!<\/p>\n
code<\/strong><\/h6>\n################# Import a lot of tools \r\n\r\n# Import Gizmos\r\n\r\ntoolbar = nuke.menu("Nodes");\r\ngizmodir = os.path.dirname(__file__)\r\nprint "GIZMODIR: ", gizmodir\r\n\r\ndef deploy_gizmos():\r\n\r\n for gd in os.listdir(gizmodir):\r\n \r\n upper_path = os.path.join(gizmodir,gd)\r\n \r\n if gd.startswith('gizmos_') and os.path.isdir(os.path.join(gizmodir,gd)):\r\n nuke.pluginAddPath('.\/'+gd)\r\n \r\n for sub_gd in os.listdir(os.path.join(gizmodir,gd)):\r\n if sub_gd.startswith('gizmos_') and os.path.isdir(os.path.join(gizmodir,gd,sub_gd)):\r\n lower_path = os.path.join(gizmodir,gd,sub_gd)\r\n nuke.pluginAddPath('.\/' + sub_gd)\r\n\r\n for gd in sorted(os.listdir(gizmodir), key=lambda f: f.lower()):\r\n\r\n if gd.startswith('gizmos_') and os.path.isdir(os.path.join(gizmodir,gd)):\r\n print gd[7:], gd[7:]+'.png'\r\n menu = toolbar.addMenu(gd[7:], gd[7:]+'.png')\r\n nuke.pluginAddPath('.\/'+gd)\r\n \r\n for gizmo in sorted(os.listdir(os.path.join(gizmodir,gd)), key=lambda f: f.lower()):\r\n if gizmo.endswith('.gizmo'):\r\n menu.addCommand(gizmo[:-6], 'nuke.createNode("'+gizmo[:-6]+'")')\r\n \r\n for sub_gd in os.listdir(os.path.join(gizmodir,gd)): \r\n if sub_gd.startswith('gizmos_') and os.path.isdir(os.path.join(gizmodir,gd,sub_gd)):\r\n \r\n super_menu = gd[7:]\r\n sub_menu = sub_gd[7:] \r\n combined_menu = super_menu + "\/" + sub_menu\r\n to_plugin_path = "'.\/"+sub_gd +"'"\r\n to_plugin_path = os.path.join(gizmodir,gd,sub_gd)\r\n \r\n menu = toolbar.addMenu(combined_menu, sub_gd[7:]+'.png')\r\n nuke.pluginAddPath(to_plugin_path) \r\n \r\n for gizmo in sorted(os.listdir(os.path.join(gizmodir,gd,sub_gd)), key=lambda f: f.lower()):\r\n if gizmo.endswith('.gizmo'):\r\n menu.addCommand(gizmo[:-6], 'nuke.createNode("'+gizmo[:-6]+'")')\r\n \r\ndeploy_gizmos()\r\n \r\n<\/pre><\/div>\n <\/p>\n","protected":false},"excerpt":{"rendered":"
I don’t know about you, but over the years I have curated a generous collection of Gizmos that I like having in my toolkit no matter where I go to do my comping thing. On the same note, whenever I am working on x or y company and I come across some new gems that […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[48],"tags":[],"class_list":["post-3034","post","type-post","status-publish","format-standard","hentry","category-python"],"_links":{"self":[{"href":"https:\/\/boris-mc.com\/index.php?rest_route=\/wp\/v2\/posts\/3034","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/boris-mc.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/boris-mc.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/boris-mc.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/boris-mc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3034"}],"version-history":[{"count":25,"href":"https:\/\/boris-mc.com\/index.php?rest_route=\/wp\/v2\/posts\/3034\/revisions"}],"predecessor-version":[{"id":3068,"href":"https:\/\/boris-mc.com\/index.php?rest_route=\/wp\/v2\/posts\/3034\/revisions\/3068"}],"wp:attachment":[{"href":"https:\/\/boris-mc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3034"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/boris-mc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3034"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/boris-mc.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3034"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}