That's a very strange error indeed... I have a feeling the traceback might be misleading, and that something lower in Nuke is actually throwing an exception, which is being propagated improperly. The fact that this involves a new knob type seems suspicious as well.

I would definitely send that to support.

-Nathan


-----Original Message----- From: Wakisaka,Taku,MARZA
Sent: Thursday, February 13, 2014 3:49 AM
To: nuke-python@support.thefoundry.co.uk
Subject: [Nuke-python] Setting Text2 font knob on callback

Hi,

I am having trouble setting Text2's font knob from callback,
and it gives out following error:

Traceback (most recent call last):
File "C:/Program Files/Nuke8.0v3/plugins\nuke\callbacks.py", line 127, in knobChanged
   _doCallbacks(knobChangeds)
File "C:/Program Files/Nuke8.0v3/plugins\nuke\callbacks.py", line 44, in _doCallbacks
   for f in list:
TypeError: an integer is required

Following is a code that reproduce the error:
n = nuke.createNode("Text2")

knob = nuke.Enumeration_Knob("test", "test", ["1", "2"])
n.addKnob(knob)

def knob_callback():
   node = nuke.thisNode()
   knob = nuke.thisKnob()

   knob_name = knob.name()
   if knob_name == "test":
       key = knob.value()
       if key == "1":
           node["font"].setValue("Utopia", "Regular")
       else:
           node["font"].setValue("Courier", "Regular")

nuke.addKnobChanged(knob_callback, nodeClass=n.Class())
n["test"].setValue(2)


Does anyone know why python is raising TypeError?
I've never seen a error like this in a for statement.

Thanks,
Taku


_______________________________________________
Nuke-python mailing list
Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
_______________________________________________
Nuke-python mailing list
Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

Reply via email to