As PySide is becoming more and more the UI of the CG artist, I thought I'd share this little tip. How to add Qt widgets to a Nuke gizmo.
I use gizmos very often, but I felt limited with the ui tools available and I wanted the ability to add some additional functionality to them. I've been making tools using PySide in Nuke since version 6, however I had to spend a bit of time researching how to go about adding widgets to a group / gizmo, and as far as I can tell, I'm the first to post how to achieve this online. So here's to a first!
Step 1 - Subclass a widget.
I started by sub-classing a QWidget, setting a layout, adding my buttons and other widgets, making connections, etc. Note that you'll need to pass in the nuke node the widget is attached to as an argument.
Step 2 - Add the makeUI() and updateValue() methods.
The makeUI method is where the magic happens. It appears that Nuke is hard coded to look for a method named makeUI. Just return self and you're good. The only reason I add the updateValue method is because Nuke will scream at you if your class doesn't have it. I'm still not sure what triggers that method. As far as I can tell, it's neither a node eval nor a PySide signal. Oh well, not a big deal.
Step 3 - Create the knob and add it to a group.
You'll want to create a PyCustom_Knob. It requires everything you give it to be string based, so you have to pass in your widget name and arguments as a string. Haven't found another way to do this, but passing in "MyWidget(nuke.thisNode())" works just fine. You could potentially pass in more info if needed, but you should be able to get any info from the group node itself.
Hope you guys find this useful, cheers!