-
-
Notifications
You must be signed in to change notification settings - Fork 21k
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
Auto resize icon which passed by add_custom_type(). #71818
Auto resize icon which passed by add_custom_type(). #71818
Conversation
Note for reviewers, to be checked together with #71817 (could have been kept in the same PR IMO, but now that both PRs are open it's fine to keep it like this). |
I am not sure about these two pr should be merge as one or not, icon size issues is scattered, some are fixed and some are remained, so I keep them separated, too. |
I'm not sure about that approach for either of the PRs. Why waste resources resizing the loaded resource when we can render the texture at any scale as we need it? Especially in the inspector, which is a custom control. |
I think this implemention just to keep style consistently. In other word, generate once and can keep style consistently, if user want to create a custom inspector control, they can use the origin texture directly. Additionally, there have some icon issues about icon size in inspector, such as #68962, I think user prefer use a any size of texture as icon to use a fixed size texture, it means that It's worth to implement auto resize icons. This is my reson of implement #71817 , although the implemention of it is not perfect. Please check the origin implementition( before #71817 ): |
@Daylily-Zeleen You are missing my point: why do we need to resize the icon ahead of time, spend time and resources on that and keep a copy, if we can just as well render this same original icon at 16x16, or 32x32, or whatever other size we need? This is in fact how the icon is scaled in your image for the p.1 and p.2, with some internal logic of |
@YuriSizov I check the logic of p.2, the icon is implement by setting texture for a However, the icon of p.3 is drawn directly, I will change the way to implement #71817 . |
That icon is part of the |
Ideally I think you are right, but the p.2 implemention like this:
And use If want to draw texture directly, I think it is more reasonable to provide ability of set size of button icon( for p.1) and allow set max size of Control or any other way to limit the size of TextureRect in Container( for p.2). obviously, this is another issue and need a propersal. In this situation, origin implement of By the way, I change the implemention of #71817 as you wish, in that situation, draw the icon texture directly is more reasonable. |
Sorry, I got confused and thought that EditorPath already worked as expected. However, if it uses Wherever we use textures, we can scale them on the GPU. I don't think there is a case for resizing them ahead of time as an image, on the CPU. Either it's direct drawing and we have full control, or the node that we use implements it, or the node doesn't implement it, but it should (e.g. we have an issue with the popup menu, and it should be fixed by exposing a way to control it for the popup menu). Pre-resizing shouldn't be the answer. |
3663ef2
to
f11d4c1
Compare
Okey, I avoid to pre-resize the icon texture now. But I can't sure this two enhances can cover all situation of custom icon. |
Thanks for your contribution! I've incorporated all your work in #75472, so this is superseded now. You are properly credited in the relevant commit. |
Before:
After:
Need #71872 .