-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Fix ColorPicker committing extra action to history #83786
Conversation
Can you check, #82514 |
Fix ColorPicker giving less precise value on hide ColorPicker changed set value upon exit due to HTML value getting submitted. You had to Ctrl+Z twice to undo setting color in inspector.
a643883
to
b1e4de8
Compare
This is the same as #44895 and introduces the same regression. |
Hmm, that's a bit though. Does visual shader skip changing values to avoid recompiling the shader? In that case the requirements for VS editor and inspector are different. Is there any way to know from inside EditorProperty what context is it in? |
Such checks should be performed by the EditorProperty itself. There's this condition in the code you deleted:
Its problem is that it compares the color stored at opening the picker, not after the changes. Though fixing this would probably still affect VisualShader.
The EditorProperty is manually created in VisualShader (I think?), so there might be some way to pass this information. |
Looks like only other EditorProperty which uses the I think that EditorProperty's interface needs to be better described and build usage of that interface depending on it. One cannot rely on a interface that is implemented differently by inheriting classes. Here's some possible ways to do it:
I'm a bit leaning towards option 1 being the easiest to implement, since visual shader editor seems to be the only one ignoring changing properties now (haven't checked though). |
@@ -563,7 +563,7 @@ void ColorPicker::_html_submitted(const String &p_html) { | |||
color.a = previous_color.a; | |||
} | |||
|
|||
if (color == previous_color) { | |||
if (color.to_abgr32() == previous_color.to_abgr32()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this check may be too late here. At this point, the internal color
state (that's a class member, not a local variable) has already been overwritten with the return value of Color::from_string
, so this only skips the change notification, doesn't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, you're right.
I assume this is still needed to address linked issues, even after #85749? If so, could you please rebase your PR? |
As @KoBeWi said, this pr introduces regression on visual shader color picker, so more than just a rebase is needed. I would appreciate feedback on which, if any, of my 3 options sounds most feasible (see my comment above). |
Superseded by #88690. Thanks for the contribution! |
Fixes #83642 Fixes #45186
ColorPicker committed value on both on
color_change
andpopup_closed
signals, so same value got submitted twice to undoredo.Addionally, ColorPicker changed set value upon exit due to HTML value getting submitted. Since HTML color codes are 32-bit color, but Godot uses higher precision colors internally, this meant that color from HTML value differed from currently selected value, thus it was submitted resulting less precision on colors chosen via picker.
Fixed by checking if color is different with precision offered by 32-bit color.
EDIT: Combined #83787 into this pr since they are both needed to fix the problem.