ID 390435 - addOnUserCreate function does not allow custom views to be created within Nuke 11.3 releases

Follow

Problem summary
Within Nuke 11.3 releases, when the addOnUserCreate function is used to create custom views through the init.py file, the custom view will not be used and will default to the 'main' view.

Prior to Nuke 11.3 releases this worked as expected.

Customer reported version
nuke.11.3v3

Customer reported platform
centos7

Steps to reproduce

1) Open your init.py file located in your .nuke directory within a text editor

2) Add the following snippet into the init.py file
def setupDefaultViews(): 
 viewsList = ['left']

 views = nuke.views()

 for each in viewsList:
  nuke.tprint("adding: %s" % (each))
  nuke.Root().addView(each)

 if "main" in views:
  nuke.tprint("removing: main")
  nuke.Root().deleteView("main")

nuke.addOnUserCreate(setupDefaultViews, nodeClass="Root")

3) Open a new Nuke 11.3 session

4) Locate the view settings within the Project Settings > View tab
Result: The view is set to main and should be set to left as per the setup in the init.py file

5) To confirm this is only in Nuke 11.3 releases, reproduce the above steps in Nuke 11.2.

Expected behaviour
Using the addOnUserCreate function should work correctly for adding views to the root class in Nuke 13 releases

Actual behaviour
The addOnUserCreate function does not allow adding views to the root class in Nuke 13 releases, and defaults to the main view

Workaround
The issue appears to be isolated to the addOnUserCreate function, as an alternative we would suggest using the addOnCreate function, as per below
nuke.addOnCreate(setupDefaultViews, nodeClass="Root")

This has been tested and works as expected in Nuke 11.3 releases.

Reproduced by support
This bug has been reproduced in:
Nuke 11.3v3 - Windows 7 - CentOS 7 - MacOS 10.13.6
Nuke 11.3v1 - Windows 7 - CentOS 7 - MacOS 10.13.6 - regression

Unable to reproduce bug in:
Nuke 11.2v5 - Windows 7 - CentOS 7 - MacOS 10.13.6

Earliest version tested
Nuke 11.2v5
- This issue no longer appears in this version and has regressed

    We're sorry to hear that

    Please tell us why