2009年12月6日 如何将自定义gizmo插件定位到工具栏上

 

 
For this you need to first create a new folder call '.nuke'. I needs to be made in either...
OSX - /Users/your user name
Windows XP - \Documents and Settings\your user name

Next write a text file with the following information in it.


# Custom Nuke Menu on Toolbar
import nuke
import os.path

# Get the top-level toolbar
toolbar = nuke.menu("Nodes")

# FX Share Menu definitions
m = toolbar.addMenu("TestMenu", "testMenu.png")
m.addCommand("depthSlice", "nuke.createNode(\"depthSlice\")",icon="depthSlice.png")
m.addCommand("Reorder", "nuke.createNode(\"reorder\")",icon="reorder.png")
m.addCommand("iDilateErode", "nuke.createNode(\"iDilateErode\")",icon="iDilateErode.png")


The information above in dark blue is what you will need to replace with your own custom information, everything else need to remain the same.
The dark blue lines of code follow a pattern,
m.addCommand("nameOfGizmo"
This part is the name of the Gizmo which you have made and save into the root of .nuke, ie nameOfGizmo.gizmo

, "nuke.createNode(\"depthSlice\")"
This part created the name of the tool you'll see in the Toolbar and put's it into the menu defined above, in our case 'testMenu'.

,icon="depthSlice.png")
This final part adds the icon you will see in the menu of the Toolbar. It needs to be save at a .PNG file, 24 pixels by 24 pixels. Also note that there is also a .PNG file in the line where the new menu on the Toolbar is created. In our example above it's
m = toolbar.addMenu("TestMenu", "testMenu.png").
The best order to work in overall is to first create the gizmo and save it in the root of '.nuke'
Secondly create the 32x32 pixel icon you want to use and save that in the root of '.nuke' as a PNG file.
Finally create/edit the file
above saving it as menu.py again into the root of '.nuke'
You should end of up was a number of files in '.nuke' such as...
menu.py
nukeMagicTool1.gizmp
nukeMagicTool1.png
nukeSuperTool1.gizmo
nukeSuperTool1.png


转自Sphere VFX

posted @ 2009-12-06 02:33  iamsellen  阅读(687)  评论(0编辑  收藏  举报