-
-
Notifications
You must be signed in to change notification settings - Fork 22.8k
Fix ScriptEditor inline colors float handling #107904
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 ScriptEditor inline colors float handling #107904
Conversation
16c3fc5
to
1472b80
Compare
Updated to show default color if the string isn't valid so it doesn't keep dissapearing and reappearing while typing. Color(")
Color("aaa)
Color(0xawaaaaaa)
Color(0x0 + aaaa)
Color("ff"+red) There are still some colors that should be considered valid (like hex without alpha and more static methods) but those can be done later. |
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.
Works fine now.
Needs rebase.
1472b80
to
d8e6381
Compare
d8e6381
to
9184256
Compare
Thanks! |
Mostly whitespace changes since I tried to make the function easier to read.
split_floats
just gives0.0
when it encounters non-numbers, so I removed it and now checkis_valid_float
for each parameter, with a maximum of 4.It must be a float literal, variables and expressions are not allowed here. It may be possible to use Expression to handle them, but it would still need to be readonly.
Also added checks when typing a string parameter to only show the color if it is valid and to prevent some invalid color errors (not all, see #89357).
This function will need to be moved to be language independent in the future, then it can be parsed better with GDScript.