ID 166974 - Custom Viewer mask dropped after restart of Nuke

Follow

Problem summary
When saving a Nuke script with a custom guide (Via creating a guide with custom_guides.py)
On restart, the custom guide will fail to load and report the following error: 
 

/filepath/script.nk:Viewer1.masking_ratio: Bad value for masking_ratio : 8

Customer reported version
nuke.9.0v8

Customer reported platform
Linux - Ubuntu
 
Steps to reproduce

1) Add a new viewer mask to your custom_guides.py (For testing use  ' guides.MaskGuide("2.39:1", 2.39) ' )

2) Open Nuke

3) Create a CheckerBoard node
 
4) In the Viewer, set the masking_ratio knob to '2.39:1' and save the script.
 
5) Close the comp (File -> Close Comp)
 
6) Re-open the last comp (File -> Open Recent Comp)
 
Result:
You will receive one of the two following error:
  • 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 undesirednuke.addOnCreate(OnViewerCreate, nodeClass="Viewer")import custom_guidescustom_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 bug has been reproduced in:

Nuke11.0v2 - Windows 7 - Mac10.12 - CentOS6.9
Nuke11.0v1 - Windows 7
Nuke10.5v6 - Windows 7 - Mac10.12 - CentOS6.9
Nuke10.5v1 - Windows 7
Nuke10.0v6 - Windows 7 - Mac10.12 - CentOS6.9
Nuke10.0v1 - Windows 7
Nuke9.0v9 - Windows 7 - Mac10.12 - CentOS6.9
Nuke9.0v1 - Windows 7
Nuke8.0v7 - Windows 7 - Mac10.12 - CentOS6.9
Nuke7.0v10 - Windows 7 - Mac10.12 - CentOS6.9

 
Expected behaviour
Nuke should return the custom mask to the viewer without receiving errors

Actual behaviour
Nuke prompts an error to the user and the viewer loses its custom mask.

    We're sorry to hear that

    Please tell us why