-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
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 pixel_size property to Sprite node #27935
Conversation
I was really confused by the term "pixel size" for a second, wouldn't "image size" be better? |
Honestly I don't think this feature is needed. It's a one liner in GDscript, so I don't think it is worth the bloat in the sprite properties. |
Well, the PR is there. Related issue could be closed whether it's merged or not. Although if by any chance it's going to be merged, I guess it should use another way to detect size change, other than subscribing to notification. I just didn't know how to do it properly, so any advice is welcome >.> |
I also don't think this is very useful, you know the pixel size when you create the art and in Godot most 2D games are pixel perfect anyway. |
I'm also unsure how useful this is. If you need pixel level precision, chances are that you don't want to scale at all, or scale only by powers of two, so abstracting the scale behind a "pixel size" seems misleading. Can we know more about the use case? The feature request only says "add this", but not why. |
One issue I often face is that I have to resize my assets for Godot because they are too large, and resizing them with the |
I like @Jummit's idea, something like 'Self Opacity' and 'Opacity' but for scaling. |
I don't think it's an issue about scaling. A local scale variable would not change the root of the problem. "Pixel size" is a misleading name in my opinion even if I understand that KoBeWi chosed it because the distance unit in Godot 2D is the pixel. |
@CedNaru Ah, you want something like a target size? Like "always render that Sprite at X by Y pixels, regardless of texture size"? |
@timoschwarzer Exactly! |
I think that's what TextureRect does with stretch_mode, with the overhead/disadvantage of being a Control node. |
TextureRect is a Control Node and it misses a lot of options that Sprite2D have. |
A even simpler option would be to have a boolean like "Keep the same apparent size when changing texture". |
I could change the "sprite size" to a property that enforces certain size when set above 0, if that would be more useful. |
This sounds more like a Texture importing option than sprite property. |
We are talking about enforcing the size of the sprite, not the size of the texture. |
Reading the above discussion, it does seem like the original request from #23145 is not particularly useful. Some further use cases have been outlined which are not covered in this PR:
|
Closes #23145
Works as an alias for scale, as changing one updates the other.