-
-
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
Make some Image methods static #63332
Conversation
core/io/image.cpp
Outdated
void Image::set_data(int p_width, int p_height, bool p_use_mipmaps, Format p_format, const Vector<uint8_t> &p_data) { | ||
create(p_width, p_height, p_use_mipmaps, p_format, p_data); | ||
} | ||
|
||
void Image::create(int p_width, int p_height, bool p_use_mipmaps, Format p_format) { |
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 this warrants further refactoring, it's weird to have static create_empty
and create_from_data
and non-static create
with two variants.
Maybe:
- Move
create(int p_width, int p_height, bool p_use_mipmaps, Format p_format)
logic tocreate_empty
(and rename tocreate
to match bindings)- Or keep the
create_empty
name and use that for the bindings too. We should strive to have consistent between core C++ API and bindings for GDExtension's sake.
- Or keep the
- Move
create(int p_width, int p_height, bool p_use_mipmaps, Format p_format, const Vector<uint8_t> &p_data)
logic toset_data
and use it increate_from_data
.
I misunderstood what you were doing. I am not entirely sure its good to make these static, since they are operating on the image itself. |
It's only the |
I think the internal |
90a69cf
to
148a636
Compare
I renamed the internal |
148a636
to
307355d
Compare
307355d
to
2ff2c03
Compare
2ff2c03
to
93b98ed
Compare
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.
We discussed this in a PR meeting.
The change seems good, but we're concerned that it will lead to more problematic situations where users are unaware that their code is no longer working when using the previous format (which would still work silently).
We should find a proper solution to this UX issue in GDScript before merging more such changes that will impact users of the beta version.
93b98ed
to
072f6fe
Compare
Thanks! |
Follow-up to #60739 (comment)