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

ColorChooser : Maintain hue and saturation at zero #5909

Merged
merged 1 commit into from
Jun 24, 2024

Conversation

ericmehl
Copy link
Collaborator

This changes the behavior of the color chooser somewhat, so that setting the saturation to zero does not cause the hue to be reset to zero, and setting the value to zero does not cause the hue and saturation to be reset to zero.

I'm not super-excited about storing and syncing the HSV color to the RGB color, but I think it's better than the alternatives. We need some way of knowing what the HS value should be if we're deciding not to set it, and that's now coming from the synchronized self.__colorHsv variable.

I also looked at converting the whole ColorChooser to use HSV values internally and not store RGB. That worked also, but as we talked about, it also has the side effect that ColorChooser.setColor( x ).getColor() != x because of floating point round off, which does not seem like the right way to go.

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.

Copy link
Member

@johnhaddon johnhaddon 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 - very nice to have this fixed. Couple of comments inline - the latter of which is definitely worth addressing I think. And we also need to target the PR to 1.4_maintenance1.
Cheers...
John

python/GafferUI/ColorChooser.py Outdated Show resolved Hide resolved
python/GafferUI/ColorChooser.py Outdated Show resolved Hide resolved
python/GafferUI/ColorChooser.py Outdated Show resolved Hide resolved
@ericmehl ericmehl changed the base branch from main to 1.4_maintenance June 19, 2024 16:00
@ericmehl ericmehl force-pushed the hsvPreventZero branch 2 times, most recently from 5498333 to adc7559 Compare June 19, 2024 17:33
Copy link
Member

@johnhaddon johnhaddon 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! And sorry, one last round of comments from me. The "not public" one is definitely important - see what you think about the others...
Cheers...
John

python/GafferUI/ColorChooser.py Outdated Show resolved Hide resolved
python/GafferUI/ColorChooser.py Outdated Show resolved Hide resolved
python/GafferUI/ColorChooser.py Outdated Show resolved Hide resolved
@ericmehl
Copy link
Collaborator Author

I pushed up a fix to the previous fix (squashed into the fixup in f2fd617) and all seems to be working well in practice. Ready for a new look!

@johnhaddon johnhaddon merged commit fff0f55 into GafferHQ:1.4_maintenance Jun 24, 2024
5 checks passed
@johnhaddon
Copy link
Member

Thanks Eric! I've squashed in the fixups and merged.

johnhaddon added a commit to johnhaddon/gaffer that referenced this pull request Jun 24, 2024
We want all our ducks in a row before being exposed to the arbitrary code execution represented by connected slots. I haven't observed any problems from the old code in practice, but noticed the pre-exising bug while reviewing GafferHQ#5909 and thought it probably worth addressing just in case.
johnhaddon added a commit to johnhaddon/gaffer that referenced this pull request Jun 24, 2024
We want all our ducks in a row before being exposed to the arbitrary code execution represented by connected slots. I haven't observed any problems from the old code in practice, but noticed the pre-exising bug while reviewing GafferHQ#5909 and thought it probably worth addressing while we're looking at this part of the codebase.
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.

None yet

2 participants