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

Add ability to disable shadow blur on StyleBoxFlat #98162

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

FireCatMagic
Copy link

@FireCatMagic FireCatMagic commented Oct 14, 2024

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 of 0 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"
image
Shadow size of 1, works as it previously did
image

@FireCatMagic
Copy link
Author

I would add the breaks compat label too since it does break compatibility

@Mickeon Mickeon modified the milestones: 4.4, 4.x Dec 2, 2024
@Mickeon Mickeon requested review from a team and removed request for a team December 2, 2024 20:18
@Mickeon
Copy link
Contributor

Mickeon commented Dec 2, 2024

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

It would not. It could default to true just fine.

@adamscott
Copy link
Member

I don't really like the -1 value meaning disabling shadows. I would set shadow_enabled to true by default, just as @Mickeon said.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

No option to disable shadow blur for StyleBoxFlat
4 participants