ID 269203 - Nuke won't terminal / batch render if the Viewer is using a custom guide

Follow

Problem summary
Nuke won't terminal / batch render if the Viewer is using a custom guide

Customer reported version
nuke.9.0v8

Customer reported platform
windows7

Steps to reproduce

1) Copy the attached custom_guides.py to your .nuke directory

2) Open Nuke

3) Create a CheckerBoard node

4) Attach a Write node and set the file knob to null.null

5) In the Viewer, set the masking_ratio knob to 1:2.39 and save the script

6) Render the script from a terminal/command window using the below command:

<NukePath>/NukeVersion -F 1 -x <path/to/script.nk>

It will error saying:

Viewer1.masking_ratio: Bad value for masking_ratio : 7

This also happens if you edit the <Nuke>\pythonextensions\site-packages\custom_guides.py file directly, rather than copying it to the .nuke directory.


Workarounds
1)Set the masking_ratio knob in Viewer to be a Nuke standard one.

2)Create an onCreate callback which manually adds the masking ratios to the Viewer nodes


def OnViewerCreate():

    node = nuke.thisNode()

    knob = node['masking_ratio']

    allvalues = knob.values() + ['2.39\t2.39:1'] ### Add custom masking ratio and ratio name

    knob.setValues(allvalues)

    knob.setValue('2.39') ### Set to desired masking ratio

    ### The above line will set the masking ratio for all viewers the that masking ratio when creating Viewer nodes, disable it if undesired


nuke.addOnCreate(OnViewerCreate, nodeClass="Viewer")


import custom_guides

custom_guides.viewer_masks.append(custom_guides.guides.MaskGuide("2.39:1", 2.39))

Adding the above code to your init.py should set your masking_ratio the desired ratio. 


Reproduced by support
This problem has been reproduced on:
Nuke 10.5v2 - Windows 10 - CentOS 6.8 - MacOSX 10.12
Nuke 10.5v1 - Windows 10
Nuke 10.0v6 - Windows 10
Nuke 10.0v1 - Windows 10
Nuke 9.0v9 - Windows 10
Nuke 9.0v1 - Windows 10 - CentOS 6.8 - MacOSX 10.12

Expected behaviour
For Nuke to render the Nuke script

Actual behaviour
It errored saying bad masking ratio

    We're sorry to hear that

    Please tell us why