Nuke – Disabling All Motion Blur in Your Script

In Shake you used to be able to disable all motion blur that was being added in your script.  It was super useful as it meant you could turn the motion blur off to do colour work etc and then turn it back on when it came time to render.  Sadly Nuke does not have this function.  However you can run the following piece of code from the Script Editor and it will set all motion blur in your Transform nodes to ‘0’.

Be careful with this however… as when you come to turn the motion blur back on it will set ‘1’ in ALL your Transform nodes that have a motion blur setting… which you possibly didn’t want!

To turn all motion blur off…

x=nuke.allNodes()
for n in x:
     try:
          n['motionblur'].setExpression("0")
     except:
          pass

To turn all motion blur on…

x=nuke.allNodes()
for n in x:
     try:
          n['motionblur'].setExpression("1")
     except:
          pass

**UPDATE**mb

Thinking on this a little further I feel I’ve come up with a better solution and most importantly a much simpler one.

Create a Switch node and then expression link it to the motion blur knob in your Transform nodes (Switch1.which for example). Just change the Switch from ‘0’ to ‘1’ to turn the motion blur on and vice versa to turn it off. That way you can be a lot more selective about which motion blur settings your changing.

**UPDATE 15/01/16**

Today I came up with an even simpler way to achieve this.  Link the motion blur knob to the disable knob in the Switch.  Just disabling the Switch in the gui will turn the motion blur off.  Place the following in the motion blur expression window…

!Switch1.disable

The ‘!’ is needed to invert the result as ‘1’ is returned when the Switch is disabled.

Advertisement

2 thoughts on “Nuke – Disabling All Motion Blur in Your Script

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s