Re: Allow config's context to be replaced?


Jeremy Selan <jeremy...@...>
 

It was definitely our intent to have a setCurrentContext, that looks
like an oversight.

In the meantime, can you see if your config object has a
"addEnvironmentVar" option? This was introduced rather recently, so I
am not sure if it's available in Nuke, but this would allow you to
modify value of existing entries in the context, and also add new
ones).

-- Jeremy

On Wed, Feb 5, 2014 at 4:06 PM, Nathan Rusch <natha...@...> wrote:
Hey all,

I'm wondering if there has been any thought or discussion internally about
allowing a config's Context to be replaced in place. I've been looking at
ways to change the context variables of the active config on the fly using
the Python bindings, and actually having them affect the existing processing
environment, but after perusing the library and binding sources, it seems
there isn't any way to do this currently.

Some of the machinery is already there: You can get an editable copy of the
active config's current context and modify its context variables to your
heart's content. However, at that point, there isn't really anything useful
you can do with that object unless you're actually doing color processing
yourself. I was hoping to find a way to inject the updated context back into
the currently active config via Python, to affect all future processor
lookups within Nuke, but there's a distinct lack of symmetry to the
interface in that regard.

What I'm hoping for:

config = ocio.GetCurrentConfig()
ctx = config.getCurrentContext().createEditableCopy()
ctx.setStringVar('FOO', 'BAR')
config.setCurrentContext(ctx) # <-- The missing link

Unless I'm mistaken, the only way to do something like this right now (at
either the C++ or Python level) would be to modify the process environment
(not ideal), and then call
ocio.SetCurrentConfig(ocio.Config.CreateFromEnv()), which feels... dirty.

Now, I'm guessing this isn't the first time you've crossed paths with an
idea like this, so I feel like it's worth asking: Am I overlooking something
blatantly obvious here? I've done my best to sniff out any existing
functionality like this, but haven't found anything. However, if this is in
fact a nonexistent feature, I'm wondering if there is a specific reason for
excluding it, and if you would be willing to consider adding it in the
future.

Thanks for any information,

-Nathan

P.S. In the case of Nuke, I know it's possible to work around this using
node-level context overrides and making Nuke do the environment lookups for
you using TCL, but that's far from an ideal solution when a simple context
replacement would let me do the same thing much more cleanly (and doesn't
address other applications).

--
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.

Join {ocio-dev@lists.aswf.io to automatically receive all group messages.