Here it is, in case it's useful to anyone else:

http://pastebin.com/zNCUykk9

I originally wrote it to catch Int vs Float knobs, as well as Cascading
Enumerations vs Enumerations. So, it's a little bit specific/hardcoded to
catch those cases, and use knob.Class() for everything else.





On Sun, Mar 31, 2013 at 2:21 PM, Ivan Busquets <ivanbusqu...@gmail.com>wrote:

> There IS a way to get the knob ID (type) through python:
>
> nuke.knob(knobname, type = True) # Returns an int with the knob ID
>
> I think I have a wrapper somewhere that uses this to tell apart knobs that
> are reported as being ('Array_Knob'). I'll see if I can find it
>
>
>
>
> On Sun, Mar 31, 2013 at 10:15 AM, Hugh Macdonald <
> li...@hughmacdonald.co.uk> wrote:
>
>> Thanks Josh,
>>
>> It's good to know that this is possible, if a little frustrating that it
>> isn't exposed in Python directly!
>>
>>
>> On 26 March 2013 10:50, Josh Imbruglia <the.factory.sm...@gmail.com>wrote:
>>
>>> using the following tcl script you can get the index of a knob:
>>>
>>> index = nuke.tcl('knob', '-t', knob.node().name() + '.' + knob.name()
>>>
>>> the index is the corresponding knob enum index from knobs.h
>>>
>>> so 2 is int, 6 is boolean, etc...
>>>
>>> - josh
>>>
>>> On Mon, Mar 25, 2013 at 8:36 PM, Hugh Macdonald
>>> <li...@hughmacdonald.co.uk> wrote:
>>> > Hi all,
>>> >
>>> > I'm trying to figure out how to tell the difference between certain
>>> knob
>>> > types on a gizmo...
>>> >
>>> > When querying a knob in Python, I can't tell the difference between a
>>> Float,
>>> > Size and Int knob. Now there doesn't seem to be much difference
>>> between a
>>> > Float and a Size knob anyway, but there is obviously a difference, at
>>> least
>>> > in the GUI, between a Float and an Int knob.
>>> >
>>> > All of them return "Array_Knob" from Class(), and I can't find any
>>> > difference from any of the other calls I can make on the knobs.
>>> >
>>> > Any idea how I can tell the difference?
>>> >
>>> >
>>> > Thanks
>>> >
>>> > Hugh
>>> >
>>> > _______________________________________________
>>> > 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
>>>
>>
>>
>> _______________________________________________
>> 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