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

Static color sliders / field #6111

Merged
merged 5 commits into from
Nov 13, 2024

Conversation

ericmehl
Copy link
Collaborator

This adds the option to set the color sliders and field to dynamically update. In dynamic mode, which is how they have been thus far, the sliders show the color you will get if you move the indicator to the position at that color. They update as you change other channels.

The default mode is now non-dynamic.

With dynamic mode turned off, the slider shows the pure 0-1 (-1 to 1 for temperature and magenta) range for that channel only. So the red slider will always go from black to fully red, and similar for the other colors. The only exception is the saturation slider and the color field when the static component is set to hue. These will still update because they depend on the hue to show their full range.

With dynamic mode off, we can also optimize when we calculate the gradients and field so they don' t update as often. Not updating the gradient gives about a 90% speedup which does feel a little snappier when dragging the sliders.

Checklist

  • I have read the contribution guidelines.
  • I have updated the documentation, if applicable.
  • I have tested my change(s) in the test suite, and added new test cases where necessary.
  • My code follows the Gaffer project's prevailing coding style and conventions.

@ericmehl ericmehl changed the base branch from main to 1.5_maintenance October 28, 2024 13:58
@ericmehl
Copy link
Collaborator Author

ericmehl commented Nov 1, 2024

Based on offline conversations, I've pushed a few new commits today. I changed the name of the variables to be variations on dynamicBackground instead of dynamicColor to clarify that it's the background only, not the actual color being chosen that is dynamic.

I also changed the wording in the settings menu to be "Sliders / Dynamic Backgrounds" for the same reason.

And lastly, I changed the default style to be dynamic instead of static. That's based on some user polling that favored the dynamic style.

Ready for a new look!

Copy link
Contributor

@murraystevenson murraystevenson left a comment

Choose a reason for hiding this comment

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

Thanks Eric! A couple of nitpicky thoughts inline, but otherwise this is looking pretty good to me.

Changes.md Outdated Show resolved Hide resolved
python/GafferUI/ColorChooser.py Outdated Show resolved Hide resolved
python/GafferUI/ColorChooser.py Show resolved Hide resolved
python/GafferUI/ColorChooser.py Show resolved Hide resolved
"/Dynamic Backgrounds",
{
"command": Gaffer.WeakMethod( self.setDynamicSliderBackgrounds ),
"checkBox": self.getDynamicSliderBackgrounds(),
Copy link
Contributor

Choose a reason for hiding this comment

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

Could be worth adding a "description" here to provide a short tooltip explaining the behaviour.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done in 7e709db.

Though I'm not super happy with the cosmetic formatting of that solution. I couldn't find a way to get it formatted better / independently of the source line layout the way the plug tooltips do.

Copy link
Contributor

Choose a reason for hiding this comment

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

To match the more flexible formatting of the plug tooltips, we'd likely need a GafferUI.DocumentationAlgo.markdownToHTML( action.statusTip() ) here :

QtWidgets.QToolTip.showText( qEvent.globalPos(), action.statusTip(), self )

But that could start doing undesirable things in tooltips elsewhere such as wrapping file paths and the like, so I'd avoid that for now.

If you're unhappy with the current text, we could simplify this down to something more along the lines of :

"Dynamic backgrounds show the color that will result from moving the indicator to a given position."

Feel free to make a call on that while you squash everything down ready for merging. Thanks!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I just went with the original text I had, I think it's a better explanation and not worth worrying over the formatting.

@ericmehl
Copy link
Collaborator Author

Pushed a few new commits to address the comments above. I think except for the API naming we should be in good shape.

@ericmehl
Copy link
Collaborator Author

Thanks Murray! Squashed down and verified everything matches up to the pre-squash state. Merging

@ericmehl ericmehl merged commit 193e1cf into GafferHQ:1.5_maintenance Nov 13, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants