X Tutup
Skip to content

Round AtlasTexture size#101342

Merged
Repiteo merged 1 commit intogodotengine:masterfrom
KoBeWi:roundabout_solution
Nov 19, 2025
Merged

Round AtlasTexture size#101342
Repiteo merged 1 commit intogodotengine:masterfrom
KoBeWi:roundabout_solution

Conversation

@KoBeWi
Copy link
Member

@KoBeWi KoBeWi commented Jan 9, 2025

Fixes #101341

The image size uses integer vector, so the region needed some special handling. There are various solutions, I went with adding a second Rect2 with rounded size. Keeping the original float value makes the property editing more intuitive (because Rect2 size is edited as float vector) and works better with region editor.

@KoBeWi KoBeWi added this to the 4.4 milestone Jan 9, 2025
@KoBeWi KoBeWi requested a review from a team as a code owner January 9, 2025 13:14
@arkology
Copy link
Contributor

arkology commented Jan 9, 2025

#101341 :)

I think margin size should also be rounded. not necessary.

@arkology
Copy link
Contributor

arkology commented Jan 9, 2025

Interesting, is it possible to do the same without adding new variable?

@KoBeWi
Copy link
Member Author

KoBeWi commented Jan 9, 2025

Yes, but it involves rounding the size every time you want to use it. I think it's better to do it once.

I think margin size should also be rounded up.

It doesn't print any errors and has no conditional behavior. Seems fine as is.

@akien-mga akien-mga changed the title Round Atlastexture size Round AtlasTexture size Jan 9, 2025
@KoBeWi KoBeWi force-pushed the roundabout_solution branch from a1fdc43 to 4c5a495 Compare January 10, 2025 14:33
@Repiteo Repiteo modified the milestones: 4.4, 4.5 Feb 24, 2025
@Repiteo Repiteo modified the milestones: 4.5, 4.6 Sep 8, 2025
@WhalesState
Copy link
Contributor

WhalesState commented Sep 29, 2025

I just wonder if set_region(Rect2(Point2(0.5, 0.5), Size2(8, 8))) or set_margin(Rect2(Point2(), Size2(0.5, 0.5))) can still reproduce the issue since it's only solving it for the region rect size.

Copy link
Contributor

@Repiteo Repiteo left a comment

Choose a reason for hiding this comment

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

Simple enough!

@Repiteo Repiteo merged commit 7716a4c into godotengine:master Nov 19, 2025
20 checks passed
@Repiteo
Copy link
Contributor

Repiteo commented Nov 19, 2025

Thanks!

@KoBeWi KoBeWi deleted the roundabout_solution branch November 19, 2025 17:17
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.

Round region and margin size of AtlasTexture to integer

4 participants

X Tutup