Package nukescripts :: Module toolbars
[hide private]
[frames] | no frames]

Source Code for Module nukescripts.toolbars

  1  # Copyright (c) 2009 The Foundry Visionmongers Ltd.  All Rights Reserved. 
  2   
  3  import nuke 
  4  import nukescripts 
  5  import os, os.path 
  6  import nuke.rotopaint 
  7   
  8  # Define the tool menus. This file is loaded by menu.py. 
9 -def setup_toolbars():
10 # This is not currently used but when we support a text-only mode we'll need it. 11 #size = nuke.numvalue("preferences.toolbarTextSize") 12 13 # Use the following options to set the shortcut context in the call to menu addCommand. 14 # Setting the shortcut context to a widget will mean the shortcut will only be triggered 15 # if that widget (or it's children) has focus. If no shortcut context is specified the 16 # default context is window context i.e. it can be triggered from anywhere in the window. 17 # The enum is defined in nk_menu_python_add_item in PythonObject.cpp 18 windowContext = 0 19 applicationContext = 1 20 dagContext = 2 21 22 # Get the top-level toolbar 23 toolbar = nuke.menu("Nodes") 24 assist = nuke.env['assist'] 25 26 # The "Image" menu 27 m = toolbar.addMenu("Image", "ToolbarImage.png") 28 m.addCommand("Read", "nukescripts.create_read()", "r", icon="Read.png", shortcutContext=dagContext) 29 m.addCommand("Write", "nuke.createNode(\"Write\")", "w", icon="Write.png", shortcutContext=dagContext) 30 m.addCommand("Profile", "nuke.createNode(\"Profile\")", icon="Write.png", shortcutContext=dagContext) 31 if not assist: 32 m.addCommand("UDIM import", "nukescripts.udim_import()", "u", icon="Read.png", shortcutContext=dagContext) 33 m.addCommand("Constant", "nuke.createNode(\"Constant\")", icon="Constant.png") 34 m.addCommand("CheckerBoard", "nuke.createNode(\"CheckerBoard2\")", icon="CheckerBoard.png") 35 m.addCommand("ColorBars", "nuke.createNode(\"ColorBars\")", icon="ColorBars.png") 36 m.addCommand("ColorWheel", "nuke.createNode(\"ColorWheel\")", icon="ColorWheel.png") 37 if not assist: 38 m.addCommand("CurveTool", "nukescripts.createCurveTool()", icon="CurveTool.png") 39 m.addCommand("Viewer", "nuke.createNode(\"Viewer\")", icon="Viewer.png") 40 # m.addCommand("Proxy", "nuke.knob(\"root.proxy\", \"!root.proxy\")", icon="proxyfullres.png") 41 42 # The "Draw" menu 43 m = toolbar.addMenu("Draw", "ToolbarDraw.png") 44 m.addCommand("Roto", '''nuke.createNode("Roto")''', "o", icon="Roto.png", shortcutContext=dagContext) 45 m.addCommand("RotoPaint", "nuke.createNode(\"RotoPaint\")", "p", icon="RotoPaint.png", shortcutContext=dagContext) 46 47 m.addCommand("@;RotoBranch", "nuke.createNode(\"Roto\")", "+o", shortcutContext=dagContext) 48 m.addCommand("@;RotoPaintBranch", "nuke.createNode(\"RotoPaint\")", "+p", shortcutContext=dagContext) 49 50 m.addCommand("Dither", "nuke.createNode(\"Dither\")", icon="Dither.png") 51 m.addCommand("DustBust", "nuke.createNode(\"DustBust\")", icon="DustBust.png") 52 m.addCommand("Grain", "nuke.createNode(\"Grain2\")", icon="Grain.png") 53 m.addCommand("ScannedGrain", "nuke.createNode(\"ScannedGrain\")", icon="ScannedGrain.png") 54 m.addCommand("Glint", "nuke.createNode(\"Glint\")", icon="Glint.png") 55 m.addCommand("Grid", "nuke.createNode(\"Grid\")", icon="Grid.png") 56 m.addCommand("Flare", "nuke.createNode(\"Flare\")", icon="Flare.png") 57 m.addCommand("LightWrap", "nuke.createNode(\"LightWrap\")", icon="LightWrap.png") 58 m.addCommand("MarkerRemoval", "nuke.createNode(\"MarkerRemoval\")", icon="MarkerRemoval.png") 59 m.addCommand("Noise", "nuke.createNode(\"Noise\")", icon="Noise.png") 60 m.addCommand("Radial", "nuke.createNode(\"Radial\")", icon="Radial.png") 61 m.addCommand("Ramp", "nuke.createNode(\"Ramp\")", icon="Ramp.png") 62 m.addCommand("Rectangle", "nuke.createNode(\"Rectangle\")", icon="Rectangle.png") 63 m.addCommand("Sparkles", "nuke.createNode(\"Sparkles\")", icon="Sparkles.png") 64 m.addCommand("Text", "nuke.createNode(\"Text2\")", icon="Text.png") 65 66 m = toolbar.addMenu("Time", "ToolbarTime.png") 67 m.addCommand("Add 3:2 pulldown", "nuke.createNode(\"add32p\")", icon="Add32.png") 68 m.addCommand("Remove 3:2 pulldown", "nuke.createNode(\"remove32p\")", icon="Remove32.png") 69 m.addCommand("AppendClip", "nuke.createNode(\"AppendClip\")", icon="AppendClip.png") 70 m.addCommand("FrameBlend", "nuke.createNode(\"FrameBlend\")", icon="FrameBlend.png") 71 m.addCommand("FrameHold", "nuke.createNode(\"FrameHold\")", icon="FrameHold.png") 72 m.addCommand("FrameRange", "nuke.createNode(\"FrameRange\")", icon="FrameRange.png") 73 if not assist: 74 m.addCommand("Kronos", "nukescripts.createKronos()", icon="Oflow.png") 75 m.addCommand("OFlow", "nukescripts.createOFlow()", icon="Oflow.png") 76 m.addCommand("Retime", "nuke.createNode(\"Retime\")", icon="Retime.png") 77 m.addCommand("TemporalMedian", "nuke.createNode(\"TemporalMedian\")", icon="TemporalMedian.png") 78 m.addCommand("TimeBlur", "nuke.createNode(\"TimeBlur\")", icon="TimeBlur.png") 79 m.addCommand("NoTimeBlur", "nuke.createNode(\"NoTimeBlur\")", icon="NoTimeBlur.png") 80 m.addCommand("TimeEcho", "nuke.createNode(\"TimeEcho\")", icon="TimeEcho.png") 81 m.addCommand("TimeOffset", "nuke.createNode(\"TimeOffset\")", icon="TimeOffset.png") 82 83 if not assist: 84 m.addCommand("TimeWarp", "nukescripts.create_time_warp()", icon="TimeWarp.png") 85 m.addCommand("TimeClip") 86 87 m.addCommand("SmartVector", "nuke.createNode(\"SmartVector\")", icon="SmartVector.png") 88 m.addCommand("VectorToMotion", "nuke.createNode(\"VectorToMotion\")", icon="VectorToMotion.png") 89 m.addCommand("VectorGenerator", "nuke.createNode(\"VectorGenerator\")") 90 91 92 # The "Channel" menu 93 m = toolbar.addMenu("Channel", "ToolbarChannel.png") 94 m.addCommand("Shuffle", "nuke.createNode(\"Shuffle2\")", icon="Shuffle.png") 95 m.addCommand("Copy", "nuke.createNode(\"Copy\")", "k", icon="CopyNode.png", shortcutContext=dagContext) 96 m.addCommand("@;CopyBranch", "nuke.createNode(\"Copy\")", "+k", shortcutContext=dagContext) 97 m.addCommand("ChannelMerge", "nuke.createNode(\"ChannelMerge\")", icon="ChannelMerge.png") 98 m.addCommand("Add", "nuke.createNode(\"AddChannels\")", icon="Add.png") 99 m.addCommand("Remove","nuke.createNode(\"Remove\")", icon="Remove.png") 100 101 102 # The "Color" menu 103 m = toolbar.addMenu("Color", "ToolbarColor.png") 104 105 n = m.addMenu("Math", "ColorMath.png") 106 n.addCommand("Add", "nuke.createNode(\"Add\")", icon="ColorAdd.png") 107 n.addCommand("Multiply", "nuke.createNode(\"Multiply\")", icon="ColorMult.png") 108 n.addCommand("Gamma", "nuke.createNode(\"Gamma\")", icon="ColorGamma.png") 109 n.addCommand("ClipTest", "nuke.createNode(\"ClipTest\")", icon="ClipTest.png") 110 n.addCommand("ColorMatrix", "nuke.createNode(\"ColorMatrix\")", icon="ColorMatrix.png") 111 n.addCommand("Expression", "nuke.createNode(\"Expression\")", icon="Expression.png") 112 113 n = m.addMenu("OCIO", "OCIO.png") 114 n.addCommand("OCIO CDLTransform", "nuke.createNode(\"OCIOCDLTransform\")", icon="OCIO.png") 115 n.addCommand("OCIO ColorSpace", "nuke.createNode(\"OCIOColorSpace\")", icon="OCIO.png") 116 n.addCommand("OCIO Display", "nuke.createNode(\"OCIODisplay\")", icon="OCIO.png") 117 n.addCommand("OCIO FileTransform", "nuke.createNode(\"OCIOFileTransform\")", icon="OCIO.png") 118 n.addCommand("OCIO LogConvert", "nuke.createNode(\"OCIOLogConvert\")", icon="OCIO.png") 119 n.addCommand("OCIO LookTransform", "nuke.createNode(\"OCIOLookTransform\")", icon="OCIO.png") 120 121 n = m.addMenu("3D LUT", "Toolbar3DLUT.png") 122 n.addCommand("CMSTestPattern", "nuke.createNode(\"CMSTestPattern\")", icon="CMSTestPattern.png") 123 n.addCommand("GenerateLUT", "nuke.createNode(\"GenerateLUT\")", icon="GenerateLUT.png") 124 n.addCommand("Vectorfield (Apply 3D LUT)", "nuke.createNode(\"Vectorfield\")", icon="Vectorfield.png") 125 126 m.addCommand("Clamp", "nuke.createNode(\"Clamp\")", icon="Clamp.png") 127 m.addCommand("ColorLookup", "nuke.createNode(\"ColorLookup\")", icon="ColorLookup.png") 128 m.addCommand("Colorspace", "nuke.createNode(\"Colorspace\")", icon="ColorSpace.png") 129 m.addCommand("ColorTransfer", "nuke.createNode(\"ColorTransfer\")", icon="ColorTransfer.png") 130 m.addCommand("ColorCorrect", "nuke.createNode(\"ColorCorrect\")", "c", icon="ColorCorrect.png", shortcutContext=dagContext) 131 m.addCommand("@;ColorCorrectBranch", "nuke.createNode(\"ColorCorrect\")", "+c") 132 m.addCommand("Crosstalk", "nuke.createNode(\"CCrosstalk\")", icon="Crosstalk.png") 133 m.addCommand("Exposure", "nuke.createNode(\"EXPTool\")", icon="Exposure.png") 134 m.addCommand("Grade", "nuke.createNode(\"Grade\")", "g", icon="Grade.png", shortcutContext=dagContext) 135 m.addCommand("@;GradeBranch", "nuke.createNode(\"Grade\")", "+g", shortcutContext=dagContext) 136 m.addCommand("Histogram", "nuke.createNode(\"Histogram\")", icon="Histogram.png") 137 m.addCommand("HistEQ", "nuke.createNode(\"HistEQ\")", icon="HistEQ.png") 138 m.addCommand("HueCorrect", "nuke.createNode(\"HueCorrect\")", icon="HueCorrect.png") 139 m.addCommand("HueShift", "nuke.createNode(\"HueShift\")", icon="HueShift.png") 140 m.addCommand("HSVTool", "nuke.createNode(\"HSVTool\")", icon="HSVTool.png") 141 m.addCommand("Invert", "nuke.createNode(\"Invert\")", icon="Invert.png") 142 m.addCommand("Log2Lin", "nuke.createNode(\"Log2Lin\")", icon="Log2Lin.png") 143 m.addCommand("PLogLin", "nuke.createNode(\"PLogLin\")", icon="Log2Lin.png") 144 m.addCommand("MatchGrade", "nuke.createNode(\"MatchGrade\")", icon="MatchGrade.png") 145 m.addCommand("MinColor", "nuke.createNode(\"MinColor\")", icon="MinColor.png") 146 m.addCommand("Posterize", "nuke.createNode(\"Posterize\")", icon="Posterize.png") 147 m.addCommand("RolloffContrast", "nuke.createNode(\"RolloffContrast\")", icon="RolloffContrast.png") 148 m.addCommand("Saturation", "nuke.createNode(\"Saturation\")", icon="Saturation.png") 149 m.addCommand("Sampler", "nuke.createNode(\"Sampler\")", icon="Sampler.png") 150 m.addCommand("SoftClip", "nuke.createNode(\"SoftClip\")", icon="SoftClip.png") 151 m.addCommand("Toe", "nuke.createNode(\"Toe2\")", icon="Toe.png" ) 152 153 154 # The "Filter" menu 155 m = toolbar.addMenu("Filter", "ToolbarFilter.png") 156 m.addCommand("Blur", "nuke.createNode(\"Blur\")", "b", icon="Blur.png", shortcutContext=dagContext) 157 m.addCommand("@;BlurBranch", "nuke.createNode(\"Blur\")", "+b", shortcutContext=dagContext) 158 m.addCommand("Bilateral", "nuke.createNode(\"Bilateral2\")", icon="Bilateral.png") 159 m.addCommand("BumpBoss", "nuke.createNode(\"BumpBoss\")", icon="BumpBoss.png") 160 m.addCommand("Convolve", "nuke.createNode(\"Convolve2\")", icon="Convolve.png") 161 m.addCommand("Defocus", "nuke.createNode(\"Defocus\")", icon="Defocus.png") 162 m.addCommand("DegrainBlue", "nuke.createNode(\"DegrainBlue\")", icon="DegrainBlue.png") 163 m.addCommand("DegrainSimple", "nuke.createNode(\"DegrainSimple\")", icon="DegrainSimple.png") 164 m.addCommand("Denoise", "nuke.createNode(\"Denoise2\")", icon="denoise.png") 165 m.addCommand("DirBlur", "nuke.createNode(\"DirBlurWrapper\")", icon="DirBlur.png") 166 m.addCommand("DropShadow", "nuke.createNode(\"DropShadow\")", icon="DropShadow.png") 167 m.addCommand("EdgeBlur", "nuke.createNode(\"EdgeBlur\")", icon="EdgeBlur.png") 168 m.addCommand("EdgeDetect", "nuke.createNode(\"EdgeDetectWrapper\")", icon="EdgeDetect.png") 169 m.addCommand("EdgeExtend", "nuke.createNode(\"EdgeExtend\")", icon="EdgeExtend.png") 170 m.addCommand("Emboss", "nuke.createNode(\"Emboss\")", icon="Emboss.png") 171 m.addCommand("Erode (fast)", "nuke.createNode(\"Dilate\")", icon="ErodeFast.png") 172 m.addCommand("Erode (filter)", "nuke.createNode(\"FilterErode\")", icon="FilterErode.png") 173 m.addCommand("Erode (blur)", "nuke.createNode(\"Erode\")", icon="ErodeBlur.png") 174 m.addCommand("Glow", "nuke.createNode(\"Glow2\")", icon="Glow.png") 175 m.addCommand("GodRays", "nuke.createNode(\"GodRays\")", icon="GodRays.png") 176 m.addCommand("Inpaint", "nuke.createNode(\"Inpaint2\")", icon="Inpaint.png") 177 m.addCommand("Laplacian", "nuke.createNode(\"Laplacian\")", icon="Laplacian.png") 178 m.addCommand("LevelSet", "nuke.createNode(\"LevelSet\")", icon="LevelSet.png") 179 180 if not assist: 181 m.addCommand("Matrix...", "nukescripts.create_matrix()", icon="Matrix.png") 182 m.addCommand("Median", "nuke.createNode(\"Median\")", icon="Median.png") 183 m.addCommand("MotionBlur", "nuke.createNode(\"MotionBlur\")", icon="MotionBlur2D.png") 184 m.addCommand("MotionBlur2D", "nuke.createNode(\"MotionBlur2D\")", icon="MotionBlur2D.png") 185 m.addCommand("MotionBlur3D", "nuke.createNode(\"MotionBlur3D\")", icon="MotionBlur3D.png") 186 m.addCommand("Sharpen", "nuke.createNode(\"Sharpen\")", icon="Sharpen.png") 187 m.addCommand("Soften", "nuke.createNode(\"Soften\")", icon="Soften.png") 188 m.addCommand("VectorBlur", "nuke.createNode(\"VectorBlur2\")", icon="VectorBlur.png") 189 m.addCommand("VolumeRays", "nuke.createNode(\"VolumeRays\")", icon="VolumeRays.png") 190 m.addCommand("ZDefocus", "nuke.createNode(\"ZDefocus2\")", icon="ZBlur.png") 191 m.addCommand("ZSlice", "nuke.createNode(\"ZSlice\")", icon="ZSlice.png") 192 193 194 # The "Keyer" menu 195 m = toolbar.addMenu("Keyer", "ToolbarKeyer.png") 196 m.addCommand("Difference", "nuke.createNode(\"Difference\")", icon="DifferenceKeyer.png") 197 m.addCommand("HueKeyer", "nuke.createNode(\"HueKeyer\")", icon="HueKeyer.png") 198 if not assist: 199 m.addCommand("IBKGizmo", "nuke.tcl(\"IBKGizmoV3\")", icon="IBKGizmo.png") 200 m.addCommand("IBKColour", "nuke.tcl(\"IBKColourV3\")", icon="IBKColour.png") 201 m.addCommand("Keyer", "nuke.createNode(\"Keyer\")", icon="Keyer.png") 202 m.addCommand("Primatte", "nuke.createNode(\"Primatte3\")", icon="Primatte.png") 203 m.addCommand("Keylight", 'nuke.createNode("OFXuk.co.thefoundry.keylight.keylight_v201")', icon="Keylight.png") 204 m.addCommand("Ultimatte", "nuke.createNode(\"Ultimatte\")", icon="Ultimatte.png") 205 m.addCommand("ChromaKeyer", "nuke.createNode(\"ChromaKeyer\")", icon="ChromaKeyer.png") 206 207 208 # The "Merge" menu 209 m = toolbar.addMenu("Merge", "ToolbarMerge.png") 210 m.addCommand("AddMix", "nuke.createNode(\"AddMix\")", "+a", icon="AddMix.png", shortcutContext=dagContext) 211 m.addCommand("KeyMix", "nuke.createNode(\"Keymix\")", icon="Keymix.png") 212 m.addCommand("ContactSheet", "nuke.createNode(\"ContactSheet\")", icon="ContactSheet.png") 213 m.addCommand("CopyBBox", "nuke.createNode(\"CopyBBox\")", icon="CopyBBox.png") 214 m.addCommand("CopyRectangle", "nuke.createNode(\"CopyRectangle\")", icon="CopyRectangle.png") 215 m.addCommand("Dissolve", "nuke.createNode(\"Dissolve\")", icon="Dissolve.png") 216 m.addCommand("LayerContactSheet", "nuke.createNode(\"LayerContactSheet\")", icon="LayerContactSheet.png") 217 m.addCommand("Merge", "nuke.createNode(\"Merge2\")", "m", icon="Merge.png", shortcutContext=dagContext) 218 m.addCommand("@;MergeBranch", "nuke.createNode(\"Merge2\")", "+m", shortcutContext=dagContext) 219 220 n = m.addMenu("Merges", "Merge.png") 221 if not assist: 222 n.addCommand("Plus", "nuke.createNode(\"Merge2\", \"operation plus name Plus\", False)", icon="MergePlus.png") 223 n.addCommand("Matte", "nuke.createNode(\"Merge2\", \"operation matte name Matte\", False)", icon="MergeMatte.png") 224 n.addCommand("Multiply", "nuke.createNode(\"Merge2\", \"operation multiply name Multiply\", False)", icon="MergeMultiply.png") 225 n.addCommand("In", "nuke.createNode(\"Merge2\", \"operation in name In\", False)", icon="MergeIn.png") 226 n.addCommand("Out", "nuke.createNode(\"Merge2\", \"operation out name Out\", False)", icon="MergeOut.png") 227 n.addCommand("Screen", "nuke.createNode(\"Merge2\", \"operation screen name Scrn\", False)", icon="MergeScreen.png") 228 n.addCommand("Max", "nuke.createNode(\"Merge2\", \"operation max name Max\", False)", icon="MergeMax.png") 229 n.addCommand("Min", "nuke.createNode(\"Merge2\", \"operation min name Min\", False)", icon="MergeMin.png") 230 n.addCommand("Absminus", "nuke.createNode(\"Merge2\", \"operation difference name Difference\", False)", icon="MergeDifference.png") 231 m.addCommand("MergeExpression", "nuke.createNode(\"MergeExpression\")", icon="MergeExpression.png") 232 m.addCommand("Switch", "nuke.createNode(\"Switch\")", icon="Switch.png") 233 if not assist: 234 m.addCommand("TimeDissolve", "nuke.createNode(\"TimeDissolve\")", icon="TimeDissolve.png") 235 m.addCommand("Premult", "nuke.createNode(\"Premult\")", icon="Premult.png") 236 m.addCommand("Unpremult", "nuke.createNode(\"Unpremult\")", icon="Unpremult.png") 237 if not assist: 238 m.addCommand("Blend", "nuke.createNode(\"Blend\")", icon="Blend.png") 239 m.addCommand("ZMerge", "nuke.createNode(\"ZMerge\")", icon="ZMerge.png") 240 241 242 # The "Transform" menu 243 m = toolbar.addMenu("Transform", "ToolbarTransform.png") 244 m.addCommand("Transform", "nuke.createNode(\"Transform\")", "t", icon="2D.png", shortcutContext=dagContext) 245 m.addCommand("@;Transform Branch", "nuke.createNode(\"Transform\")", "+t", shortcutContext=dagContext) 246 m.addCommand("TransformMasked", "nuke.createNode(\"TransformMasked\")", icon="2DMasked.png") 247 m.addCommand("Card3D", "nuke.createNode(\"Card3D\")", icon="3D.png") 248 m.addCommand("AdjustBBox", "nuke.createNode(\"AdjBBox\")", icon="AdjBBox.png") 249 m.addCommand("BlackOutside", "nuke.createNode(\"BlackOutside\")", icon="BlackOutside.png") 250 m.addCommand("CameraShake", "nuke.createNode(\"CameraShake3\")", icon="CameraShake.png") 251 m.addCommand("Crop", "nuke.createNode(\"Crop\")", icon="Crop.png") 252 m.addCommand("CornerPin", "nuke.createNode(\"CornerPin2D\")", icon="CornerPin.png") 253 m.addCommand("VectorCornerPin", "nuke.createNode(\"VectorCornerPin\")", icon="VectorCornerPin.png") 254 m.addCommand("SphericalTransform", "nuke.createNode(\"SphericalTransform2\")", icon="EnvironMaps.png") 255 m.addCommand("IDistort", "nuke.createNode(\"IDistort\")", icon="IDistort.png") 256 m.addCommand("VectorDistort", "nuke.createNode(\"VectorDistort\")", icon="VectorDistort.png") 257 m.addCommand("LensDistortion", "nuke.createNode(\"LensDistortion2\")", icon="LensDistort.png") 258 m.addCommand("Mirror", "nuke.createNode(\"Mirror2\")", icon="Mirror.png") 259 m.addCommand("Position", "nuke.createNode(\"Position\")", icon="Position.png") 260 m.addCommand("Reformat", "nuke.createNode(\"Reformat\")", icon="Reformat.png") 261 m.addCommand("Reconcile3D", "nuke.createNode(\"Reconcile3D\")", icon="Reconcile3D.png") 262 m.addCommand("PointsTo3D", "nuke.createNode(\"PointsTo3D\")", icon="PointsTo3D.png") 263 m.addCommand("PlanarTracker", "nukescripts.createPlanartracker()", icon="planar_tracker.png") 264 m.addCommand("Tracker", "nuke.createNode(\"Tracker4\")", icon="Tracker.png") 265 m.addCommand("TVIScale", "nuke.createNode(\"TVIscale\")", icon="TVIScale.png") 266 m.addCommand("GridWarp", "nuke.createNode(\"GridWarp3\")", icon="GridWarp.png") 267 m.addCommand("GridWarpTracker", "nuke.createNode(\"GridWarpTracker\")", icon="GridWarpTracker.png") 268 m.addCommand("SplineWarp", "nuke.createNode(\"SplineWarp3\")", icon="SplineWarp.png") 269 m.addCommand("Stabilize", "nuke.createNode(\"Stabilize2D\")", icon="Stabilize.png") 270 m.addCommand("STMap", "nuke.createNode(\"STMap\")", icon="STMap.png") 271 m.addCommand("Tile", "nuke.createNode(\"Tile\")", icon="Tile.png") 272 273 #m.addCommand("AutoCrop", "nukescripts.autocrop()", icon="AutoCrop.png") 274 275 276 # The "3D" menu 277 m = toolbar.addMenu("3D", "Cube.png") 278 279 m.addCommand("Axis", "nuke.createNode(\"Axis2\")", icon="Axis.png") 280 281 n = m.addMenu("Geometry", "Geometry.png") 282 n.addCommand("Card", "nuke.createNode(\"Card2\")", icon="Card.png") 283 n.addCommand("Cube", "nuke.createNode(\"Cube\")", icon="Cube.png") 284 n.addCommand("Cylinder", "nuke.createNode(\"Cylinder\")", icon="Cylinder.png") 285 n.addCommand("DepthToPoints", "nuke.createNode(\"DepthToPoints\")", icon="DepthToPoints.png") 286 #n.addCommand("Modeler", "nuke.createNode(\"Modeler\")", icon="Modeler.png") 287 n.addCommand("ModelBuilder", "nuke.createNode(\"ModelBuilder\")", icon="Modeler.png") 288 n.addCommand("PointCloudGenerator", "nuke.createNode(\"PointCloudGenerator\")", icon="PointCloudGenerator.png") 289 n.addCommand("PositionToPoints", "nuke.createNode(\"PositionToPoints2\")", icon="PositionToPoints.png") 290 n.addCommand("PoissonMesh", "nuke.createNode(\"PoissonMesh\")", icon="PoissonMesh.png") 291 n.addCommand("Sphere", "nuke.createNode(\"Sphere\")", icon="Sphere.png") 292 n.addCommand("ReadGeo", "nuke.createNode(\"ReadGeo2\")", icon="ReadGeo.png") 293 n.addCommand("WriteGeo", "nuke.createNode(\"WriteGeo\")", icon="WriteGeo.png") 294 295 n = m.addMenu("Lights", "Toolbar3DLights.png") 296 n.addCommand("Light", "nuke.createNode(\"Light2\")", icon="PointLight.png") 297 n.addCommand("Point", "nuke.createNode(\"Light\")", icon="PointLight.png") 298 n.addCommand("Direct", "nuke.createNode(\"DirectLight\")", icon="DirectLight.png") 299 n.addCommand("Spot", "nuke.createNode(\"Spotlight\")", icon="SpotLight.png") 300 n.addCommand("Environment", "nuke.createNode(\"Environment\")", icon="Environment.png") 301 n.addCommand("Relight", "nuke.createNode(\"ReLight\")", icon="ReLight.png") 302 303 n = m.addMenu("Modify", "Modify.png") 304 n.addCommand("TransformGeo", "nuke.createNode(\"TransformGeo\")", icon="Modify.png") 305 n.addCommand("MergeGeo", "nuke.createNode(\"MergeGeo\")", icon="Modify.png") 306 n.addCommand("CrosstalkGeo", "nuke.createNode(\"CrosstalkGeo\")", icon="Modify.png") 307 #n.addCommand("Connect Points", "nuke.createNode(\"ConnectPointsGeo\")", icon="Modify.png") 308 n.addCommand("DisplaceGeo", "nuke.createNode(\"DisplaceGeo\")", icon="Modify.png") 309 n.addCommand("EditGeo", "nuke.createNode(\"EditGeo\")", icon="Modify.png") 310 n.addCommand("GeoSelect", """nuke.createNode("GeoSelect")""", icon="Modify.png") 311 n.addCommand("LookupGeo", "nuke.createNode(\"LookupGeo\")", icon="Modify.png") 312 n.addCommand("LogGeo", "nuke.createNode(\"LogGeo\")", icon="Modify.png") 313 n.addCommand("Normals", "nuke.createNode(\"Normals\")", icon="Modify.png") 314 n.addCommand("ProceduralNoise", "nuke.createNode(\"ProcGeo\")", icon="Modify.png") 315 n.addCommand("RadialDistort", "nuke.createNode(\"RadialDistort\")", icon="Modify.png") 316 n.addCommand("Trilinear", "nuke.createNode(\"Trilinear\")", icon="Modify.png") 317 n.addCommand("UVProject", "nuke.createNode(\"UVProject\")", icon="Modify.png") 318 #n.addCommand("VectorfieldGeo", "nuke.createNode(\"VectorfieldGeo\")", icon="Modify.png") 319 #n.addCommand("Vectorfield Create", "nuke.createNode(\"VectorfieldCreateGeo\")", icon="Modify.png") 320 n = n.addMenu("RenderMan", "Modify.png") 321 n.addCommand("ModifyRIB", "nuke.createNode(\"ModifyRIB\")", icon="Modify.png") 322 323 n = m.addMenu("Shader", "Shaders.png") 324 n.addCommand("AmbientOcclusion", "nuke.createNode(\"AmbientOcclusion\")", icon="Shader.png") 325 n.addCommand("ApplyMaterial", "nuke.createNode(\"ApplyMaterial\")", icon="Shader.png") 326 n.addCommand("BasicMaterial", "nuke.createNode(\"BasicMaterial\")", icon="Shader.png") 327 n.addCommand("FillMat", "nuke.createNode(\"FillMat\")", icon="Shader.png") 328 n.addCommand("MergeMat", "nuke.createNode(\"MergeMat\")", icon="Shader.png") 329 n.addCommand("BlendMat", "nuke.createNode(\"BlendMat\")", icon="Shader.png") 330 n.addCommand("Project3D", "nuke.createNode(\"Project3D2\")", icon="Shader.png") 331 n.addCommand("Diffuse", "nuke.createNode(\"Diffuse\")", icon="Shader.png") 332 n.addCommand("Emission", "nuke.createNode(\"Emission\")", icon="Shader.png") 333 n.addCommand("Phong", "nuke.createNode(\"Phong\")", icon="Shader.png") 334 n.addCommand("Specular", "nuke.createNode(\"Specular\")", icon="Shader.png") 335 n.addCommand("Displacement", "nuke.createNode(\"Displacement\")", icon="Shader.png") 336 if not assist: 337 n.addCommand("UVTile", "nukescripts.createUVTile()", icon="Shader.png") 338 n.addCommand("Wireframe", "nuke.createNode(\"Wireframe\")", icon="Shader.png") 339 n.addCommand("Transmission", "nuke.createNode(\"Transmission\")", icon="Shader.png") 340 n = n.addMenu("RenderMan", "Shaders.png") 341 n.addCommand("Reflection", "nuke.createNode(\"Reflection\")", icon="Shader.png") 342 n.addCommand("Refraction", "nuke.createNode(\"Refraction\")", icon="Shader.png") 343 344 m.addCommand("Camera", "nuke.createNode(\"Camera2\")", icon="Camera.png") 345 m.addCommand("CameraTracker", "nuke.createNode(\"CameraTracker\")", icon="CameraTracker.png") 346 m.addCommand("DepthGenerator", "nuke.createNode(\"DepthGenerator\")", icon="DepthGenerator.png") 347 m.addCommand("DepthToPosition", "nuke.createNode(\"DepthToPosition\")", icon="DepthToPosition.png") 348 m.addCommand("Scene", "nuke.createNode(\"Scene\")", icon="Scene.png") 349 m.addCommand("ScanlineRender", "nuke.createNode(\"ScanlineRender\")", icon="Render.png") 350 m.addCommand("RayRender", "nuke.createNode(\"RayRender\")", icon="Render.png") 351 352 if not assist: 353 m = m.addMenu("RenderMan", "Toolbar3D.png") 354 m.addCommand("PrmanRender","nukescripts.createPrmanRender()", icon="Render.png") 355 356 # particles menu 357 m = toolbar.addMenu("Particles", "ToolbarParticles.png") 358 m.addCommand("ParticleEmitter") 359 360 m.addCommand("ParticleBounce") 361 m.addCommand("ParticleCache", icon="ParticleCache.png") 362 m.addCommand("ParticleCurve") 363 m.addCommand("ParticleDirectionalForce") 364 m.addCommand("ParticleDrag") 365 m.addCommand("ParticleExpression") 366 m.addCommand("ParticleMerge") 367 m.addCommand("ParticleMotionAlign") 368 m.addCommand("ParticleGravity") 369 370 #Disable ParticleLineForce for now as it is not ready for being included in the bundle - Bug 30000 371 # m.addCommand("ParticleLineForce") 372 373 m.addCommand("ParticleLookAt") 374 m.addCommand("ParticlePointForce") 375 m.addCommand("ParticleSpeedLimit") 376 m.addCommand("ParticleSpawn") 377 m.addCommand("ParticleTurbulence") 378 m.addCommand("ParticleVortex") 379 m.addCommand("ParticleWind") 380 381 m.addCommand("ParticleSettings", icon="particle_settings.png") 382 383 m.addCommand("ParticleToGeo") 384 385 m.addCommand("ParticleBlinkScript", icon="ParticleBlinkScript.png") 386 387 n = m.addMenu("ParticleBlinkScript Gizmos", "ParticleBlinkScript.png") 388 n.addCommand("ParticleColorByAge", icon="ParticleBlinkScript.png") 389 n.addCommand("ParticleKill", icon="ParticleBlinkScript.png") 390 n.addCommand("ParticleProjectDisplace", icon="ParticleBlinkScript.png") 391 n.addCommand("ParticleProjectImage", icon="ParticleBlinkScript.png") 392 n.addCommand("ParticleGrid", icon="ParticleBlinkScript.png") 393 n.addCommand("ParticleDirection", icon="ParticleBlinkScript.png") 394 n.addCommand("ParticleFuse", icon="ParticleBlinkScript.png") 395 n.addCommand("ParticleDistributeSphere", icon="ParticleBlinkScript.png") 396 n.addCommand("ParticleCylinderFlow", icon="ParticleBlinkScript.png") 397 n.addCommand("ParticleConstrainToSphere", icon="ParticleBlinkScript.png") 398 n.addCommand("ParticleFlock", icon="ParticleBlinkScript.png") 399 n.addCommand("ParticleAttractToSphere", icon="ParticleBlinkScript.png") 400 n.addCommand("ParticleHelixFlow", icon="ParticleBlinkScript.png") 401 n.addCommand("ParticleShockWave", icon="ParticleBlinkScript.png") 402 403 m.addCommand("ParticleInfo", icon="ParticleInfo.png") 404 405 # deep menu 406 m = toolbar.addMenu("Deep", "ToolbarDeep.png") 407 m.addCommand("DeepColorCorrect", "nuke.createNode('DeepColorCorrect2')" ) 408 m.addCommand("DeepCrop") 409 m.addCommand("DeepExpression") 410 m.addCommand("DeepFromFrames") 411 m.addCommand("DeepFromImage") 412 m.addCommand("DeepMerge", "nuke.createNode('DeepMerge2')") 413 if not assist: 414 m.addCommand("DeepRead", '''nukescripts.create_read("DeepRead")''') 415 m.addCommand("DeepRecolor") 416 m.addCommand("DeepReformat") 417 m.addCommand("DeepSample") 418 m.addCommand("DeepToImage") 419 m.addCommand("DeepToImage", "nuke.createNode('DeepToImage2')") 420 m.addCommand("DeepToPoints") 421 m.addCommand("DeepTransform") 422 m.addCommand("DeepWrite") 423 424 # Views menu 425 m = toolbar.addMenu("Views", "ToolbarViews.png") 426 n = m.addMenu("Stereo", "ToolbarStereo.png") 427 n.addCommand("Anaglyph", "nuke.createNode(\"Anaglyph\")", icon="Anaglyph.png") 428 n.addCommand("MixViews", "nuke.createNode(\"MixViews\")", icon="MixViews.png") 429 n.addCommand("SideBySide", "nuke.createNode(\"SideBySide\")", icon="SideBySide.png") 430 n.addCommand("ReConverge", "nuke.createNode(\"ReConverge\")", icon="ReConverge.png") 431 432 m.addCommand("JoinViews", "nuke.createNode(\"JoinViews\")", icon="JoinViews.png") 433 m.addCommand("OneView", "nuke.createNode(\"OneView\")", icon="OneView.png") 434 m.addCommand("ShuffleViews", "nuke.createNode(\"ShuffleViews\")", icon="ShuffleViews.png") 435 m.addCommand("Split and Join", "nukescripts.create_viewsplitjoin()", icon="SplitAndJoin.png") 436 437 m = toolbar.addMenu("MetaData", "MetaData.png") 438 m.addCommand("ViewMetaData", "nuke.createNode(\"ViewMetaData\")", icon="ViewMetaData.png") 439 m.addCommand("CompareMetaData", "nuke.createNode(\"CompareMetaData\")", icon="CompareMetaData.png") 440 m.addCommand("ModifyMetaData", "nuke.createNode(\"ModifyMetaData\")", icon="ModifyMetaData.png") 441 m.addCommand("CopyMetaData", "nuke.createNode(\"CopyMetaData\")", icon="CopyMetaData.png") 442 m.addCommand("AddTimeCode", "nuke.createNode(\"AddTimeCode\")", icon="AddTimeCode.png") 443 444 import nukescripts.toolsets 445 nukescripts.toolsets.createToolsetsMenu(toolbar) 446 nukescripts.createNodePresetsMenu() 447 448 449 # The "Other" menu 450 m = toolbar.addMenu("Other", "ToolbarOther.png") 451 m.addCommand("AudioRead", "nuke.createNode(\"AudioRead\")", icon="Read.png") 452 m.addCommand("Assert", "nuke.createNode(\"Assert\")", icon="Assert.png") 453 m.addCommand("Backdrop", "nukescripts.autoBackdrop()", icon="Backdrop.png") 454 m.addCommand("BlinkScript", "nuke.createNode(\"BlinkScript\")", icon="BlinkScript.png") 455 m.addCommand("DiskCache", "nuke.createNode(\"DiskCache\")", ".", icon="DiskCache.png", shortcutContext=dagContext) 456 m.addCommand("Dot", "nuke.createNode(\"Dot\", inpanel=False)", ".", icon="Dot.png", shortcutContext=dagContext) 457 m.addCommand("Input", "nuke.createNode(\"Input\")", icon="Input.png") 458 m.addCommand("Output", "nuke.createNode(\"Output\")", icon="Output.png") 459 m.addCommand("NoOp", "nuke.createNode(\"NoOp\")", icon="NoOp.png") 460 m.addCommand("PostageStamp", "nuke.createNode(\"PostageStamp\")", icon="PostageStamp.png") 461 m.addCommand("Group", "nuke.collapseToGroup()", icon="Group.png") 462 if not assist: 463 m.addCommand("Precomp", "nukescripts.precomp_selected()","^+p", icon="Precomp.png", shortcutContext=dagContext) 464 m.addCommand("LiveGroup", "nuke.collapseToLiveGroup()", icon="Group.png") 465 m.addCommand("LiveInput", "nuke.createLiveInput()", icon="Input.png") 466 467 m.addCommand("StickyNote", "nukescripts.toolbar_sticky_note()", "#n", icon="StickyNote.png", shortcutContext=dagContext) 468 n = m.addMenu("All plugins", "AllPlugins.png") 469 n.addCommand("Update", "nukescripts.update_plugin_menu(\"All plugins\")") 470 471 # The OFX plugins menus 472 nuke.ofxMenu("") 473 474 # Have to remove some of the furnace core nodes that get added automatically in nuke.ofxMenu() 475 m = toolbar.menu("FurnaceCore") 476 if (m != None): 477 m.removeItem("F_DeGrain") 478 m.removeItem("F_DeNoise") 479 m.removeItem("F_Kronos") 480 m.removeItem("F_MotionBlur") 481 m.removeItem("F_VectorGenerator") 482 m.removeItem("F_MatchGrade") 483 484 # Denoise2 needs to be added after the OFX plugins menus 485 m = toolbar.menu( 'Filter' ) 486 if m == None or not hasattr(m, 'addCommand'): 487 # If the Filter menu is empty, eg no whitelisted filter plugins in Nuke Assist, 488 # we must create the menu afresh, as it will not exist 489 m = toolbar.addMenu("Filter", "ToolbarFilter.png") 490 if m != None and hasattr(m, 'addCommand'): 491 m.addCommand("Denoise", "nuke.createNode(\"Denoise2\")", icon="denoise.png") 492 493 # OFlow needs to be added after the OFX plugins menus 494 m = toolbar.menu( 'Time' ) 495 if m == None or not hasattr(m, 'addCommand'): 496 # If the Filter menu is empty, eg no whitelisted filter plugins in Nuke Assist, 497 # we must create the menu afresh, as it will not exist 498 m = toolbar.addMenu("Time", "ToolbarTime.png") 499 if m != None and hasattr(m, 'addCommand'): 500 m.addCommand("OFlow", "nukescripts.createOFlow()", icon="Oflow.png") 501 502 m = None 503 n = None
504
505 -def createCurveTool():
506 n = nuke.createNode( 'CurveTool' ) 507 if n.input(0): 508 n['resetROI'].execute()
509
510 -def createKronos():
511 n = nuke.createNode( 'Kronos' ) 512 if n.input(0): 513 n['resetInputRange'].execute()
514
515 -def createOFlow():
516 n = nuke.createNode('OFlow2'); 517 if n.input(0): 518 n['resetInputRange'].execute()
519 520 # Some helper functions that we can call from the toolbar items. 521
522 -def create_time_warp():
523 t = nuke.createNode("TimeWarp") 524 a = nuke.value(t.name()+".first_frame") 525 e = nuke.value(t.name()+".last_frame") 526 if float(e)<=float(a): 527 a = nuke.value("root.first_frame") 528 e = nuke.value("root.last_frame") 529 cmd = "{curve C x"+a+" "+a+" x"+e+" "+e+"}" 530 t.knob("lookup").fromScript(cmd)
531 532
533 -def create_matrix():
534 p = nuke.Panel("Enter desired matrix size:") 535 p.addSingleLineInput("width", 3) 536 p.addSingleLineInput("height", 3) 537 ret = p.show() 538 if ret == 1: 539 wdt = p.value("width") 540 hgt = p.value("height") 541 a = " { "+" 0 "*int(wdt)+" } " 542 a = "{ " + a*int(hgt) + " }" 543 nuke.createNode("Matrix", "matrix "+a)
544 545
546 -def toolbar_sticky_note():
547 sticky = nuke.createNode("StickyNote") 548 sticky.knob("label").setValue("type note here") 549 sticky.knob("selected").setValue(False)
550
551 -def createPrmanRender():
552 try: 553 nuke.createNode( "PrmanRender" ) 554 except: 555 msg = "Could not create PrmanRender node.\n\nThis is usually because the library search path environment variable is not set correctly so Nuke can't link with the prman libraries.\n" 556 if not os.environ.has_key('RMANTREE'): 557 msg = msg + "\nAlso, the RMANTREE environment variable is not set.\n" 558 559 if nuke.env['MACOS']: 560 msg = msg + "\nIf you are launching Nuke from an icon on Mac OSX you may need to add environment variable settings to your environment plist file (~/.MacOSX/environment.plist).\n" 561 msg = msg + "\nCheck your Pixar Photorealistic Renderman documentation section \"RenderMan Pro Server > Administration > Installation\" for platform-specific installation instructions." 562 563 nuke.message( msg )
564
565 -def createUVTile():
566 uvtile_node = nuke.createNode("UVTile2") 567 n = uvtile_node.input(0) 568 569 if n != None and n.Class() == 'Read': 570 filename = n['file'].getValue() 571 udim = nukescripts.parseUdimFile(filename) 572 if udim != None: 573 uvtile_node['udim_enable'].setValue(True) 574 uvtile_node['udim'].setValue(udim)
575
576 -def createPlanartracker():
577 578 rotoNode = nuke.createNode("Roto", "output {rgba.alpha none none mask_planartrack.a}", False) 579 rotoLayerId = 1 580 rotoLayerName = "PlanarTrackLayer"+str(rotoLayerId) 581 582 rotoTrackLayer = rotoNode.name() + "." + str(rotoLayerId) + "." + rotoLayerName 583 584 rotoCurves = rotoNode["curves"] 585 rotoCurveRoot = rotoCurves.rootLayer 586 planarLayer = nuke.rotopaint.Layer(rotoCurves) 587 rotoCurveRoot.append(planarLayer) 588 atr = planarLayer.getAttributes() 589 planarLayer.name = rotoLayerName 590 planarLayer.getAttributes().set(nuke.rotopaint.AnimAttributes.kPlanarTrackLayerAttribute,rotoLayerId) 591 592 rotoNode.showControlPanel() 593 planarLayer.setFlag(nuke.rotopaint.FlagType.eSelectedFlag, 1) 594 rotoCurves.changed() 595 rotoNode["toolbox"].setValue(4)
596