Force a refresh of context variables?


Mark Visser <mvi...@...>
 

Hi folks,

A feature that our artists fought long and hard to have is the ability to change shots from within their software, without going back to the shell and doing a "setshot" (which sets up various environment variables) and re-starting Nuke. To make that work, we alter the current environment via Python's os.environ.

I can't for the life of me see a way via the Python API to force OCIO to refresh its context variables from the environment -- or even a way to set context variables explicitly. I've tried creating a new config with OCIO.Config.CreateFromEnv / CreateFromFile and making it current with OCIO.SetCurrentConfig, but Nuke doesn't update to reflect the new config at all, let alone refresh the context variables. I see that the github master of OCIO has additional API methods for manipulating context variables via Config.getCurrentContext, but unfortunately Nuke is using 1.0.7, which doesn't seem to have these methods available.

I'm aware of the "Context" tab in the OCIO nodes, but the goal is to make the OCIO config part of the enclosing environment, not embed parts of it in .nk files.

Short of launching a new Nuke instance, is there any way to force a refresh of context variables?

thanks
-Mark


dbr/Ben <dbr....@...>
 

If you only need a limited set of the env variables, you can set the Nuke node context tab up like so:

key1: SHOT
value1: [getenv SHOT]

..etc, then it will dynamically pick up changes to the SHOT env-var (without embedding the actual SHOT value in the Nuke nodes)

- Ben

On 14 Jan 2014, at 9:22, Mark Visser <mvi...@...> wrote:

Hi folks,

A feature that our artists fought long and hard to have is the ability to change shots from within their software, without going back to the shell and doing a "setshot" (which sets up various environment variables) and re-starting Nuke. To make that work, we alter the current environment via Python's os.environ.

I can't for the life of me see a way via the Python API to force OCIO to refresh its context variables from the environment -- or even a way to set context variables explicitly. I've tried creating a new config with OCIO.Config.CreateFromEnv / CreateFromFile and making it current with OCIO.SetCurrentConfig, but Nuke doesn't update to reflect the new config at all, let alone refresh the context variables. I see that the github master of OCIO has additional API methods for manipulating context variables via Config.getCurrentContext, but unfortunately Nuke is using 1.0.7, which doesn't seem to have these methods available.

I'm aware of the "Context" tab in the OCIO nodes, but the goal is to make the OCIO config part of the enclosing environment, not embed parts of it in .nk files.

Short of launching a new Nuke instance, is there any way to force a refresh of context variables?

thanks
-Mark

--
You received this message because you are subscribed to the Google Groups "OpenColorIO Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ocio-dev+u...@....
For more options, visit https://groups.google.com/groups/opt_out.


Ashley Retallack <ashl...@...>
 

Or you can save the context data in metadata (if the import format supports it, like exr).

and use:

key1:SHOT
value1:[metadata "look"]


this will make it possible to do different looks based on the actual footage, rather than just an environment set during or before launching Nuke.


On 13 January 2014 23:35, dbr/Ben <dbr....@...> wrote:
If you only need a limited set of the env variables, you can set the Nuke node context tab up like so:

key1: SHOT
value1: [getenv SHOT]

..etc, then it will dynamically pick up changes to the SHOT env-var (without embedding the actual SHOT value in the Nuke nodes)

- Ben

On 14 Jan 2014, at 9:22, Mark Visser <mvi...@...> wrote:

Hi folks,

A feature that our artists fought long and hard to have is the ability to change shots from within their software, without going back to the shell and doing a "setshot" (which sets up various environment variables) and re-starting Nuke. To make that work, we alter the current environment via Python's os.environ.

I can't for the life of me see a way via the Python API to force OCIO to refresh its context variables from the environment -- or even a way to set context variables explicitly. I've tried creating a new config with OCIO.Config.CreateFromEnv / CreateFromFile and making it current with OCIO.SetCurrentConfig, but Nuke doesn't update to reflect the new config at all, let alone refresh the context variables. I see that the github master of OCIO has additional API methods for manipulating context variables via Config.getCurrentContext, but unfortunately Nuke is using 1.0.7, which doesn't seem to have these methods available.

I'm aware of the "Context" tab in the OCIO nodes, but the goal is to make the OCIO config part of the enclosing environment, not embed parts of it in .nk files.

Short of launching a new Nuke instance, is there any way to force a refresh of context variables?

thanks
-Mark

--
You received this message because you are subscribed to the Google Groups "OpenColorIO Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ocio-dev+u...@....
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "OpenColorIO Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ocio-dev+u...@....
For more options, visit https://groups.google.com/groups/opt_out.



--
Ashley Retallack | Pipeline EngineerĀ 

BlueBolt Ltd | 15-16 Margaret Street | London W1W 8RW | T: +44 (0)20 7637 5575 | F: +44 (0)20 7637 3296 | www.blue-bolt.com |


Mark Visser <mvi...@...>
 

On Monday, January 13, 2014 6:35:29 PM UTC-5, dbr/Ben wrote:
If you only need a limited set of the env variables, you can set the Nuke node context tab up like so:

Brilliant, I hadn't thought of that. Just stuck that into our viewer process gizmos and it works like charm.

I wasn't aware of the metadata trick, neat.

cheers,
-Mark


Tobias Pfeiffer <pixeld...@...>
 

Hi guys,
we were forcing Nuke restarts for a long time now just to make OCIO's context work for fresh opened scripts. This is really unconvenient and artist-unfriendly. Thats why I wanted to give fixing that problem a second try.
Im not a fan of using the Viewer Process, because than you are incorporating software specific color transforms that do not properly work in other software packages (Maya, Max, Houdini). Isn't being software agnostic one of the main reasons to use OCIO in the first place?
I fiddled around with the getCurrentContext method Mark outlined aboved and this seems to work quite easily. But how do I get Nuke to recognize that fresh and updated config?
Any tips?
Best,
Tobias

Am Donnerstag, 16. Januar 2014 20:00:50 UTC+1 schrieb Mark Visser:

On Monday, January 13, 2014 6:35:29 PM UTC-5, dbr/Ben wrote:
If you only need a limited set of the env variables, you can set the Nuke node context tab up like so:

Brilliant, I hadn't thought of that. Just stuck that into our viewer process gizmos and it works like charm.

I wasn't aware of the metadata trick, neat.

cheers,
-Mark