Hi !

Thanks Nathan for your great help, I've choose the second option that
require me not too much time to put in production pipeline :)
I've used the nuke.plugins() function to get all the existing Gizmos
we used and parsed the list like this:

    # Find all Gizmo type in nuke.plugins list
    for gizmo in nuke.plugins(1, "*.gizmo"):
        # If directories_to_your_gizmos find in the path
        if "directories_to_your_gizmos" in os.path.normpath(gizmo):
            gizmoClassName = os.path.basename(gizmo).split(".")[0]
            # Check if its a version number is in the filename
            if re.findall("[/_.]v\d+", gizmoClassName, re.IGNORECASE):
                # add autolabel callback to the Gizmo class name
                nuke.addAutolabel(gizmoVersionLabel, nodeClass = gizmoClassName)

Anyway, i've got an response from Nuke support you can see below:

"Your other request isn't possible at the moment and the way you are doing it

is the only way as the class is unique and there isn't a callback to do this
on a gizmo.  I have logged this as a new feature logged as Feature 24512."


Thanks again all for your help ;)
Matthieu.


On Tue, Jan 24, 2012 at 6:47 PM, Nathan Rusch <[email protected]> wrote:
>
> There are a few ways you could approach this problem, depending on how 
> technical you want to get.
>
> 1) Simply add an explicit call to your function in each gizmo’s 'autolabel' 
> knob.
>
>     g['autolabel'].setValue('myFunction()')
>
> 2) If your gizmos use a standard naming convention (which it looks like they 
> may), write your own addGizmoAutolabel function that wraps nuke.addAutolabel 
> and matches un-versioned gizmo classes. So you would pass in 'Splitter' as 
> the class and it would check nuke.plugins for gizmos matching a regexp that 
> fits your naming convention and add the autolabel callback to each one.
>
> 3) Write a more comprehensive gizmo manager class that manages your entire 
> collection of gizmos, including menu item creation, version priority, 
> callback registration (using partially- or fully-qualified class names), etc.
>
> -Nathan
>
>
> From: Matthieu Cadet
> Sent: Tuesday, January 24, 2012 12:50 AM
> To: Nuke Python discussion
> Subject: Re: [Nuke-python] nuke.addAutolabel on Gizmo node class
>
> Yes that's right, but the thing is i'm using lot of gizmos and all gizmos 
> have version number include in the filename,
> so if i have for example one gizmo "Splitter_v01.gizmo"; "Splitter_v02.gizmo" 
> ; "Splitter_v03.gizmo"; ...
> then each gizmo class name will be  Splitter_v01; 
> Splitter_v02;Splitter_v03;...
>
> and if i want to put a custom label on all of my gizmo the only way is to put 
> nuke.addAutolabel for each version of my gizmos like this :
>
> nuke.addAutolabel(myFunction,nodeClass="Splitter_v01")
> nuke.addAutolabel(myFunction,nodeClass="Splitter_v02")
> nuke.addAutolabel(myFunction,nodeClass="Splitter_v03")
> nuke.addAutolabel(myFunction,nodeClass="Stereo_v01")
> nuke.addAutolabel(myFunction,nodeClass="Stereo_v02")
> etc...
>
> i was wondering if there is a node class name that represent all kind of 
> gizmo.
>
> i will ask Nuke support for this, thanks for your help ;)
>
> On Mon, Jan 23, 2012 at 5:18 PM, Nathan Rusch <[email protected]> 
> wrote:
>>
>> A gizmo's "class" is simply the base name of the .gizmo file you export.
>>
>> So if I have a gizmo called "MySpecialDespill.gizmo," the class is 
>> "MySpecialDespill."
>>
>> ________________________________
>> From: [email protected]
>> Date: Mon, 23 Jan 2012 14:46:09 +0100
>> To: [email protected]
>> Subject: [Nuke-python] nuke.addAutolabel on Gizmo node class
>>
>>
>> Hi!
>>
>> Does anyone know if it's possible to use the "nuke.addAutolabel" callback 
>> function on only "Gizmo" node class ?
>> like this for example :
>>
>> nuke.addAutolabel(myFunction,nodeClass="Gizmo")
>>
>> but it seems that "Gizmo" node cannot be specified as nodeClass argument in 
>> nuke.addAutolabel ...
>>
>> thanks for your help ;)
>>
>> --
>> Matthieu Cadet
>> Compositor Artist & TD,
>> nWave Digital
>> [email protected]
>>
>>
>> _______________________________________________ Nuke-python mailing list 
>> [email protected], http://forums.thefoundry.co.uk/ 
>> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
>>
>> _______________________________________________
>> Nuke-python mailing list
>> [email protected], http://forums.thefoundry.co.uk/
>> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
>>
>
>
>
> --
> Matthieu Cadet
> Compositor Artist & TD,
> nWave Digital
> [email protected]
>
>
> ________________________________
> _______________________________________________
> Nuke-python mailing list
> [email protected], http://forums.thefoundry.co.uk/
> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
>
>
> _______________________________________________
> Nuke-python mailing list
> [email protected], http://forums.thefoundry.co.uk/
> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
>



--
Matthieu Cadet
Compositor Artist & TD,
nWave Digital
[email protected]
_______________________________________________
Nuke-python mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

Reply via email to