ID 431922 - The Class() method returns a different result for Link_Knobs, depending on whether it is run inside a for-loop or not

Follow

Problem summary

The Class() method returns a different result for Link_Knobs, depending on whether it is run inside a for-loop or not.


When run in a for-loop, the Class() method will always return the knob's class as Link_Knob. Outside of a for-loop, it will return the actual knob type.


Customer reported version
Nuke 12.1v2


Customer reported platform
CentOS 7


Steps to reproduce


1) Open Nuke.


2) Create any node in the Node Graph. For example, a Blur node.


3) With the node selected, press Ctrl+G to add it to a Group.


4) Right click the Properties Panel of the Group > Manage User Knobs > Pick


5) Select a knob to expose on the Group. In this case, the 'size' knob was used.


6) Run the following code in the Script Editor:

node = nuke.toNode("Group1")

print node["size"].name(), node["size"].Class()

In this example, the following is printed: size WH_Knob

7) Now run the following code in the Script Editor:

node = nuke.toNode("Group1")


for i in node.allKnobs():

print i.name(), i.Class()

Notice that the following is printed for the same knob: size Link_Knob


Expected behaviour
The Class() method should always return the same result for Link_Knobs, regardless of it being run inside a for-loop or not.


Actual behaviour
The Class() method returns a different result for Link_Knobs, depending on whether it is run inside a for-loop or not.

When run in a for-loop, the Class() method will always return the knob's class as Link_Knob.


Workaround
Running the following code instead will return the correct result:

node = nuke.toNode("Group1")


for i in node.allKnobs():

print i.name(), node.knob(i.name()).Class()


Reproduced by support

This bug has been reproduced in:
Nuke 12.1v2 - Windows 10 - macOS 10.14 (Mojave) - Linux CentOS 7

Nuke 12.0v1 - Windows 10

Nuke 11.0v1 - Windows 10

Nuke 10.0v1 - Windows 10

Nuke 9.0v1 - Windows 10

Nuke 8.0v1 - Windows 10 - macOS 10.14 (Mojave)


Earliest version tested
Nuke 8.0v1
- This issue appears to be in all versions of the product


    We're sorry to hear that

    Please tell us why