I had to set something up for this a while ago and ended up going with a
multi-pronged approach.
if os.getenv('OCIO'):
nuke.root().knob('defaultViewerLUT').setValue('OCIO LUTs')
nuke.knobDefault('Root.defaultViewerLUT', 'OCIO LUTs')
Along with an onScriptLoad calling:
def update_OCIO_knob():
nuke.root()['defaultViewerLUT'].setValue('OCIO LUTs')
Looking back at the code I can't quite remember why I did all that or if
any of it is redundant but if I recall it did the trick.
On 29 March 2016 at 12:27, Erik Johansson <[email protected]> wrote:
> I already do that, forgot to include that code:
> nuke.addOnUserCreate(setupOcioConfigPath, nodeClass='Root')
>
> The problem is with addOnScriptLoad actually. If I open a script where
> ocio is not configed it don't update the viewerprocesses. If I open a blank
> script it works as expected as then addOnUnserCreate is executed.
>
> // E
>
> On Tue, Mar 29, 2016 at 7:18 PM, Charles Taylor <[email protected]>
> wrote:
>
>> You should be able to filter your addOnUnserCreate callback to only fire
>> on the creation of the root node, does that help?
>>
>> c
>>
>>
>>
>> On 03/29/2016 01:09 PM, Erik Johansson wrote:
>>
>> If added with addOnUserCreate callback it works but not with
>> addOnScriptLoad (I wan't to force the setting for everyone so scripts where
>> it is not setup get configured correctly).
>>
>> On Tue, Mar 29, 2016 at 6:45 PM, Erik Johansson <[email protected]>
>> wrote:
>>
>>> I set up our OCIO config as:
>>>
>>> r = nuke.root()
>>> r['customOCIOConfigPath'].setValue(os.environ['OCIO_CONFIG_PATH'])
>>> r['defaultViewerLUT'].setValue('OCIO LUTs')
>>> r['OCIO_config'].setValue('custom')
>>>
>>> If I run it in the script editor it works as expected and available
>>> viewerProcesses are updated to whats in the config file.
>>>
>>> If I however put it in menu.py instead it still shows the nuke default
>>> viewerProcesses.
>>>
>>> How can I trigger a refresh?
>>>
>>> // Erik
>>>
>>>
>>
>>
>>
>> --
>>
>>
>> *Erik Johansson **Pipeline TD*
>>
>>
>> *Fido *Rosenlundsgatan 40
>> 118 53 Stockholm, Sweden
>> www.fido.se
>>
>>
>> _______________________________________________
>> Nuke-python mailing [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
>>
>>
>
>
> --
>
>
> *Erik Johansson**Pipeline TD*
>
>
> *Fido*Rosenlundsgatan 40
> 118 53 Stockholm, Sweden
> www.fido.se
>
> _______________________________________________
> 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