Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Per-script OpenColorIO config, working space and display transform #5354

Merged
merged 15 commits into from
Jun 26, 2023

Conversation

johnhaddon
Copy link
Member

This implements the majority of the remaining items from #5215. It adds an OpenColorIO tab to the ScriptNode settings, allowing the OCIO config, working space and context to be configured on a per-script basis :

image

@jedypod, this is probably a good moment for you to check out the latest state of things before it gets locked down into the 1.3 release. Perhaps you could download the build artifact from the CI, or get @danieldresser-ie to furnish you with a test build at IE?

Copy link
Contributor

@danieldresser-ie danieldresser-ie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found a single nitpick with the code.

Definitely not really qualified to evaluate the user experience - I'll try to make sure jedypod gets ahold of some sort of build.

if( auto stringPlug = variable->valuePlug<StringPlug>() )
{
OpenColorIOAlgo::addVariable( scriptNode->context(), name, stringPlug->getValue() );
validVariables.insert( name );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if I'm missing something, but this seems unnecessarily complex ... couldn't we just start by discarding all ocio variables in the context, since all of them are either going to be overwritten, or removed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could, but it would lead to a lot of unnecessary Context::changedSignal() emissions.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, makes sense. Maybe a comment explaining that would be nice - with the way it's implemented, it took me a little bit to convince myself that we would never leave behind some of the previous values.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added comment in 8a1c7a8.

@jedypod
Copy link

jedypod commented Jun 21, 2023

Quickly looking over this from a user perspective I think this looks great overall! Super exciting, thank you for putting these changes together! I do have a couple small comments.

Would it make sense to add a tooltip to explain what the WorkingSpace plug does? There are helpful tooltips for the Config and DisplayTransform plugs but not for this one.
workingSpace_tooltip

I'm worried that the plug name displayTransform is misleading regarding the functionality. It's clear after reading the tooltip that this dropdown specifies the picker / ui display colorspace, but the name of the plug doesn't really indicate this. Maybe something like pickerColorspace instead? There's probably a better name.

I'm also wondering if it's appropriate to use a displayTransform for this? Would it be better to allow arbitrary colorspace selection? This could allow the user to specify a role or colorspace instead of only one of the views. I'm not really sure of this, just pondering.

There's also a weird bug I noticed: When changing the config to the ACES 1.3 Studio Config, the available colorspaces in the Working Space plug stay as though the CG config were selected. Here's a screen recording demonstrating the issue:

WorkingSpace_not_updating_for_StudioConfig_2023-06-21_15-38.mp4

Hope this helps!

@johnhaddon
Copy link
Member Author

johnhaddon commented Jun 22, 2023

Thanks for taking a look @jedypod. Your main comments highlight things I'd been unsure about myself, so I welcome the chance to think about them a little more.

I'm worried that the plug name displayTransform is misleading regarding the functionality. It's clear after reading the tooltip that this dropdown specifies the picker / ui display colorspace, but the name of the plug doesn't really indicate this. Maybe something like pickerColorspace instead?

Yeah, I was worried about that too. But I also worried that something like pickerColorspace was too specific, and might lead someone to think it only applied to the color chooser dialogue. Maybe that's better than leading someone to think it relates to the Viewer though? And the tooltip can document that by picker we mean "all the places you see a colour but that aren't the viewer"? Or maybe uiColorspace?

The other reason I called it displayTransform was because it is a display transform and not a color space. Which brings us to the next question...

I'm also wondering if it's appropriate to use a displayTransform for this? Would it be better to allow arbitrary colorspace selection?

I did think about that, and this was my reasoning for choosing a display transform :

  • OpenColorIO is moving away from providing colorspaces for each display/view pair. I don't know if this is stated authoritatively in the docs, but it's what I gleaned from DisplayViewTransforms for output? AcademySoftwareFoundation/OpenColorIO-Config-ACES#82 (comment). So to appropriately account for the display, it seems that a display transform is necessary - a colorspace often won't be available.
  • I want to be able to be able to say "If you use the same settings for the UI and the Viewer, you will see the same color in the UI and the Viewer". That only works if we present the same set of options for the UI and the Viewer.

The second point does bring me to a question though : what is the right default for UI settings? Would it be better to avoid the tone-mapping and wotnot for that? Or is it better to have a one-to-one match with the Viewer by default?

Returning to the naming discussion, if we stick with using a display transform, perhaps uiDisplayTransform or pickerDisplayTransform? Any preference?

There's also a weird bug I noticed: When changing the config to the ACES 1.3 Studio Config, the available colorspaces in the Working Space plug stay as though the CG config were selected.

Thanks for spotting that, and for the video. I'll take a look, and I'll sort out the workingSpace tooltip as well...

@johnhaddon
Copy link
Member Author

Would it make sense to add a tooltip to explain what the WorkingSpace plug does?

Added in f5308e7.

There's also a weird bug I noticed: When changing the config to the ACES 1.3 Studio Config, the available colorspaces in the Working Space plug stay as though the CG config were selected.

It turned out that this wasn't a bug - I had deliberately filtered the menu to only show colorspaces in the working-space category, and the set of those is the same for the CG and Studio configs. You can run this in the PythonEditor if you want to see everything :

Gaffer.Metadata.registerValue( GafferImage.OpenColorIOConfigPlug, "workingSpace", "openColorIO:categories", "" )

Do you think that should be the default? I was trying to avoid giving folks enough rope to shoot themselves in the foot, but maybe it's too restrictive in practice?

@jedypod
Copy link

jedypod commented Jun 22, 2023

Do you think that should be the default? I was trying to avoid giving folks enough rope to shoot themselves in the foot, but maybe it's too restrictive in practice?

Now that I understand about the working-space colorspace category, I do think this makes sense as it is. I'm good with this!

@jedypod
Copy link

jedypod commented Jun 22, 2023

if we stick with using a display transform, perhaps uiDisplayTransform or pickerDisplayTransform? Any preference?

With your explanations I do think it makes sense to use a view transform instead of a colorspace for the UI. I like uiDisplayTransform or uiViewTransform as a name. I think that's pretty clear and indicates the right idea. I agree that pickerDisplayTransform is not really conveying the right idea.

what is the right default for UI settings? Would it be better to avoid the tone-mapping and wotnot for that? Or is it better to have a one-to-one match with the Viewer by default?

I would lean towards defaulting to the default view transform in the selected OCIO config: that is, the first item in the list of Active Views. By default this would give a match between what we see in the viewer and what we see in the UI, but it will still be configurable if a different behavior is desired by the user.

@jedypod
Copy link

jedypod commented Jun 22, 2023

I did a little more testing, and have a couple more little questions. (Sorry I didn't catch these before).

Working Space Label Not Updating

The first thing is very minor, and might not be a bug but i figured i would flag it anyway:

  • when changing the ocio config, the label of the working space is not updating. If the working space is set to scene_linear role, and in one config (ACES 1.0.3) the colorspace that role points to is named ACES - ACEScg, and in another ocio config (ACES Studio Config), the aliased colorspace of the same role name is ACEScg, the label doesn't change. Here's a screen recording of the behavior if it helps explain:
gaffer-workingspace_label_not_updating.mp4

DisplayTransform Behavior

I noticed that the default state of the DisplayTransform node is to do nothing. I'm not sure if there's a good Gaffery reason for this behavior, so please disregard if so.

When creating a new DisplayTransform node, both display and view plugs are set to "None". By testing, I guess this plug value bypasses the processing of the node. The user needs to manually set the display and view as needed.

Is there a good reason not to have the default plug values match the default display and view as specified by the OCIO config?

And is there a good reason for adding the None option, which is an extra item that is not necessarily defined as part of the OCIO config? (The user could just disable the node to bypass its processing right?) Does it make sense to have an Automatic (view/display) entry, instead of None?

Just curious about that one! Again here's a screen recording showing the behavior.

gaffer-displayTransform_behavior.mp4

I'm not totally confident this is in-scope for this specific pull request, so apologies if I got that wrong!

@johnhaddon
Copy link
Member Author

when changing the ocio config, the label of the working space is not updating

Well spotted - thanks for catching that. It was a more general problem in our presets widget - fixed in 06fbefc.

I noticed that the default state of the DisplayTransform node is to do nothing...Is there a good reason not to have the default plug values match the default display and view as specified by the OCIO config?

I suppose the general philosophy is to give nodes do-nothing defaults if we don't think we can read the user's mind sufficiently to choose a do-something default that's likely to be a better starting point. I'm not sure that really applies here though, so I've done as you suggested in e18eaca.

<pedantry>We're not actually changing the default values (they're still ""), because at the point the node is created we don't know what contexts it will be used in (and there could be many). Instead, we're just interpreting the default differently, to mean "read the default from the current ocio config (which is defined by Gaffer's current context).<pedantry>

@johnhaddon
Copy link
Member Author

I like uiDisplayTransform or uiViewTransform as a name.

I've relabelled the plug as "UI Display Transform" in the Settings window in 2dcc754. I've actually kept the original name (as used in the API) though, as theoretically the OpenColorIOConfigPlug could be used elsewhere, where the display transform might be used for something else. This also lets us change our mind about the label later without worrying about breaking API compatibility. Hopefully that seems reasonable.

@johnhaddon
Copy link
Member Author

@danieldresser-ie, I think that's all feedback covered now, so if you could cast your eye over the new commits that would be great.

@danieldresser-ie
Copy link
Contributor

All looks fine to me

This will replace the global `GafferUI.DisplayTransform` mechanism.
Also remove `useDisplayTransform` option, because it no longer makes sense - clients can just call `setDisplayTransform( identityDisplayTransform )` instead.

There's a change in behaviour here for ColorSwatch, because it used to apply the display transform to the background colour when `useDisplayTransform` was off. We can't really do that any more, because when the display transform is identity, we don't know what it would have been otherwise. Possibly we could see if the parent has a different display transform and use that, but that would be a gigantic guess. In practice, none of this seems to matter, because the places we used it are showing RGB colours without an alpha.
This defers most of the work to the new OpenColorIOConfigPlug and its associated UI file.
This has been completely superceded by `Widget.setDisplayTransform()`.
It didn't make much sense that the rest of the behaviour for `colorSpacePresetNames` was controlled by metadata, but this one was controlled by a function argument. The new metadata also provides more flexibility than the `noneLabel` argument.

Also updated the "None" label on ImageWriterUI to "Automatic" to match ImageReaderUI.
This allows the user to configure the working space from the settings on the ScriptNode.
At the same time, fix all PlugValueWidget updates where an auxiliary plug is computed but the primary plug is not.
@johnhaddon johnhaddon force-pushed the ocioScriptVariables branch from 2dcc754 to 6c5323c Compare June 26, 2023 08:50
@johnhaddon johnhaddon merged commit 05d6a64 into GafferHQ:main Jun 26, 2023
@johnhaddon johnhaddon deleted the ocioScriptVariables branch June 26, 2023 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants