Archives for May 2014

Nuke – How customizing, and python scripting made me enjoy using it

I have been using Nuke by the Foundry for a long time now as a freelancer.  Having used After Effects for a large majority of my career it took a while to fall in love with Nuke.  It was not the fact that Nuke was node based ( I had used Shake before) nor that it had a limited timeline, I just felt you had to spend a lot of time as a single user homing your gizmos, toolsets and to create the experience you personally wanted.  I started to enjoy using it once I got into doing this.  I started small,  just setting up node defaults in my  I progressed to adding a user tab to some nodes that automated certain actions, for example shuffle node to set all the RGBA channels to be all Red or Green.  My next step has been jumping into python.  I can not count the times I have been working on a job where at some point I have turned to someone and said ‘I wish this would work this way, or I know this could be sped up with a small bit of python’.  I joke with a good friend of mine Tim Bacon that we send Dear Mr. Foundry letters, pointing out why on earth does something work like this.  Well with python that can all change!

I had one of those conversations this week about something that was annoying me.  We are doing a lot of Nuke 3d and I felt it would be better looking in the node graph if the nodes spread around the scene node…and there it started.  I started to write something simple that would just place dots in an arc that had a start and end angle, then this moved into selecting some nodes and moving those into an arc.  If we move those though what about the nodes above?  Well we best move those into there new place also.  I soon realized that you might want the two angles not to go left to right, and you might want to reverse the order of the nodes.  This all works great as a function.  I have yet to make a dialog box to interface with it, but I could write a function that is attached to a shortcut to make it run in the GUI.  I realized that I would probably rather in this instance select my main node and have any nodes above that to move, and this is where I am at.  A weekend of coding and a nice tool to position my nodes.  I think it is just the start of this problem as pressing “L” in Nuke just does not cut it, it needs to be improved and I am sure it could be.  this is just the start of me writing python code to fix my day to day issues.  I am going to test this some more in production and once I get a GUI made to allow users to interface with all the options release the code.  I am sure the code is not pretty and could be improved but it does the job!  You can see a video below of it working.