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

Prevent generating preview for zero sized texture #93255

Merged
merged 1 commit into from
Jun 18, 2024

Conversation

jsjtxietian
Copy link
Contributor

Fixes #93151

@akien-mga
Copy link
Member

I'm not sure that's a good idea, given this:

int AtlasTexture::get_width() const {
        if (region.size.width == 0) {
                if (atlas.is_valid()) {
                        return atlas->get_width();
                }
                return 1;
        } else {
                return region.size.width + margin.size.width;
        }
}

int AtlasTexture::get_height() const {
        if (region.size.height == 0) {
                if (atlas.is_valid()) {
                        return atlas->get_height();
                }
                return 1;
        } else {
                return region.size.height + margin.size.height;
        }
}

It seems like it's expected that a region of size 0 will fall back to the full size atlas.

@jsjtxietian
Copy link
Contributor Author

I just had another idea of fixing this bug !

@jsjtxietian jsjtxietian changed the title Make AtlasTexture's region default to (1,1) Prevent generating preview for zero sized texture Jun 18, 2024

Verified

This commit was signed with the committer’s verified signature.
Kobzol Jakub Beránek
Copy link
Contributor

@Mickeon Mickeon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like the more sensible solution to me

@akien-mga akien-mga added bug and removed enhancement labels Jun 18, 2024
@akien-mga akien-mga modified the milestones: 4.x, 4.3 Jun 18, 2024
@akien-mga akien-mga merged commit 2a47014 into godotengine:master Jun 18, 2024
16 checks passed
@akien-mga
Copy link
Member

Thanks!

@jsjtxietian jsjtxietian deleted the atlas-default branch June 18, 2024 14:57
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.

ERROR: The Image width specified (0 pixels) must be greater than 0 pixels.
5 participants