You can choose to have your RotoPaint always open with a particular tool selected, or open a particular tool with the settings you want.
1. | Create a file called menu.py in your plug-in path directory if one doesn’t already exist. For more information on plug-in path directories, see Loading Gizmos, NDK Plug-ins, and Python and TCL Scripts. |
2. | Select your default tool from the following list and add the Python line in your menu.py: |
• Select All
nuke.knobDefault('RotoPaint.toolbox','selectAll')
• Select Splines
nuke.knobDefault('RotoPaint.toolbox','selectCurves')
• Select Points
nuke.knobDefault('RotoPaint.toolbox','selectPoints')
• Select Feather Points
nuke.knobDefault('RotoPaint.toolbox','selectFeatherPoints')
• Add Points
nuke.knobDefault('RotoPaint.toolbox','addPoints')
• Remove Points
nuke.knobDefault('RotoPaint.toolbox','removePoints')
• Cusp Points
nuke.knobDefault('RotoPaint.toolbox','cuspPoints')
• Smooth Points
nuke.knobDefault('RotoPaint.toolbox','curvePoints')
• Remove Feather
nuke.knobDefault('RotoPaint.toolbox','removeFeather')
• Open/Close Curve
nuke.knobDefault('RotoPaint.toolbox','closeCurve')
• Bezier
nuke.knobDefault('RotoPaint.toolbox','createBezier')
• Cusped Bezier
nuke.knobDefault('RotoPaint.toolbox','createBezierCusped')
• B-Spline
nuke.knobDefault('RotoPaint.toolbox','createBSpline')
• Ellipse
nuke.knobDefault('RotoPaint.toolbox','createEllipse')
• Rectangle
nuke.knobDefault('RotoPaint.toolbox','createRectangle')
• Cusped Rectangle
nuke.knobDefault('RotoPaint.toolbox','createRectangleCusped')
• Brush
nuke.knobDefault('RotoPaint.toolbox','brush')
• Eraser
nuke.knobDefault('RotoPaint.toolbox','eraser')
• Clone
nuke.knobDefault('RotoPaint.toolbox','clone')
• Reveal
nuke.knobDefault('RotoPaint.toolbox','reveal')
• Dodge
nuke.knobDefault('RotoPaint.toolbox','dodge')
• Burn
nuke.knobDefault('RotoPaint.toolbox','burn')
• Blur
nuke.knobDefault('RotoPaint.toolbox','blur')
• Sharpen
nuke.knobDefault('RotoPaint.toolbox','sharpen')
• Smear
nuke.knobDefault('RotoPaint.toolbox','smear')
3. | Restart Nuke. |
1. | Create a file called init.py in your plug-in path directory if one doesn’t already exist. For more information on plug-in path directories, see Loading Gizmos, NDK Plug-ins, and Python and TCL Scripts. |
2. | Define your RotoPaint tool and the default setting you want to set. To get the specific tool and setting names, you can copy your RotoPaint node in Nuke and paste it into a text editor. The lines with curved brackets after "toolbox" indicate your current tool settings. |
For example:
• to set the brush size for paint to 30, and for clone to 280, add this Python line in your init.py:
nuke.knobDefault("RotoPaint.toolbox", '''clone {
{ brush bs 30 }
{ clone bs 280 }
}''')
OR
• to set the brush hardness for paint to 1.0 by default, add this Python line:
nuke.knobDefault("RotoPaint.toolbox", '''brush {
{ brush h 1 }
}''')
• to set the source transform round on clone to on by default, add this Python line:
nuke.knobDefault("RotoPaint.toolbox", '''clone {
{ clone str 1 }
}''')
3. | Restart Nuke. |
NOTE: As you can see from the above examples, the different RotoPaint tools have their own default tool settings. If you attempt to set a default but don’t specify for which tool, the default gets ignored as soon as you switch to a different tool. For example, nuke.knobDefault('RotoPaint.toolbar_brush_hardness','1.0') sets brush hardness to 1.0 initially, but as soon as you activate a different tool, you get the default for that tool.
NOTE: You cannot set up multiple defaults through RotoPaint.toolbox. For example, if you run the following three commands, the default is only set for the last one (sharpen):
nuke.knobDefault("RotoPaint.toolbox", '''clone {{ clone ltt 0}}''')
nuke.knobDefault("RotoPaint.toolbox", '''blur {{ blur ltt 0}}''')
nuke.knobDefault("RotoPaint.toolbox", '''sharpen {{ sharpen ltt 0}}''')
To set the defaults for clone and blur as well, you should instead use this:
nuke.knobDefault("RotoPaint.toolbox", '''clone {
{ brush ltt 0 }
{ clone ltt 0}
}''')