-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Optional ImageScaleMode #11780
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
Optional ImageScaleMode #11780
Conversation
…tched variant Reduced the computed slices iteration count
@mockersf does this adress your concerns ? @alice-i-cecile what do you think of this "extra component" concept ? |
It looks like your PR is a breaking change, but you didn't provide a migration guide. Could you add some context on what users should update when this change get released in a new version of Bevy? |
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 like the additional component: this feels very much like how the ECS architecture is supposed to work. I think you did an excellent job documenting the fact that this exists as well.
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 that's a fair change on this field and can rather improve perf when we don't need this feature, so all good
IMO no, the docs about this feature is good enough, the user can pretty much find this on they own, and we even have examples showing how to use this |
@mockersf expressed some valid concerns about the current system this PR attempts to fix:
The
ComputedTextureSlices
reacts to asset change in bothbevy_sprite
andbevy_ui
, meaning that if theImageScaleMode
is inserted by default in the bundles, we will iterate through most 2d items every time an asset is updated.Solution
ImageScaleMode
only has two variants:Sliced
andTiled
. I removed theStretched
defaultImageScaleMode
is no longer part of any bundle, but the relevant bundles explain that this additional component can be insertedThis way, the absence of
ImageScaleMode
means the image will be stretched, and its presence will include the entity to the various slicing systemsOptional components in bundles would make this more straigthfoward
Additional work
Should I add new bundles with the
ImageScaleMode
component ?