Add ability to disable shadow blur on StyleBoxFlat
#98162
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was no way to implement this PR without any compatibility breakages, so I did it in the way that I see the most fit.
The alternative to this implementation would be to add a new boolean property, something like "shadow_enabled" - this would break compatibility even more than my implementation because all old styleboxes with shadows created prior to this version would have their shadows disabled due to a default value of
false
What I opted to do was change the behavior of
shadow_size
The previous behavior had a value of
0
disable shadows.The new behavior has a value of
-1
disable shadows. A value of0
now disables the feathering on the shadows and leaves them completely rigid.This breaks compatibility but it should not effect pre-existing projects unless they are setting this value through code. To my knowledge, default values are not saved into the PackedScene and the value of
0
is the default value. Now, when changed to this version, the default value will instead become-1
due to not having any default value previously saved. Therefore, all editor-saved scenes will maintain their correct shadow displays when upgraded.This PR is a simple change that is good for stylized UI
With this PR:
Shadow size of 0, now allows unblurred shadows instead of "0 = disabled"
Shadow size of 1, works as it previously did