-
Notifications
You must be signed in to change notification settings - Fork 138
Add korge-fleks extension to gradle plugin #2352
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
base: main
Are you sure you want to change the base?
Conversation
- Start to add more frame and slice info into ASEInfo - Update NewTexturePacker writeImage function
- All tilesets shall have the same size of 4096 tiles
🤖 Augment PR SummarySummary: Adds a new Changes:
Technical Notes: The tileset packer now supports duplicate-tile removal and represents empty tiles as 0x0 rects in atlas metadata. 🤖 Was this summary useful? React with 👍 or 👎 |
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.
|
|
||
| // (1) Check if this frame is an image (animation) | ||
| imagesInfo[frameTag]?.let { imageInfo -> | ||
| saveImageInfo(imageInfo as LinkedHashMap<String, Any>, frameEntry as Map<String, Int>, frameTag, idx, animIndex) |
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.
saveImageInfo(..., frameEntry as Map<String, Int>, ...) makes lookups like frameEntry["spriteSourceSize"] try to cast a nested map into an Int, which will throw a ClassCastException at runtime. This likely needs a non-Map<String, Int> type for the frame entry data.
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
| } | ||
| else -> error("ParallaxImageBuilder - Parallax mode must be set to HORIZONTAL_PLANE or VERTICAL_PLANE in parallax plane '$planeName'!") | ||
| } | ||
| val index = if (attachBottomRight) offset else offset |
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.
val index = if (attachBottomRight) offset else offset ignores attachBottomRight (both branches are identical), so bottom-attached layers won’t differ in index computation. This looks like a logic bug given the parameter name and the differing indexForSpeed calculation.
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
| tileFramesInfo[tileIndex] = tileInfo | ||
| } | ||
|
|
||
| // Check if all tilesets consists of the expected amount of tiles |
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.
The tileSetMap validation runs inside the per-atlas loop, so it can fail when tiles from a tileset are distributed across multiple atlas pages. As written, it will require each tileset to be fully present after processing the current page.
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
| } | ||
| println(tileSetDataByUid) | ||
|
|
||
| return |
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.
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.
Intended, code beyond is not yet ready.
| val stackedTile = stackedTileMapData[tileIndex] | ||
|
|
||
| for ((idx, tile) in stackedTile.withIndex()) { | ||
| if (tile == 0) { |
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.
Using 0 as the “empty slot” marker means tile id 0 (which is a valid LDtk tileset index) can’t be represented and will be dropped when stacking tiles. The same tile == 0 sentinel logic appears in the other stackTilesIntoTileMap overload too.
Other Locations
korge-gradle-plugin/src/main/kotlin/korlibs/korge/gradle/korgefleks/AssetLevelMapExporter.kt:511
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
| fun SimpleBitmap.isEmpty(): Boolean { | ||
| for (y in 0 until height) { | ||
| for (x in 0 until width) { | ||
| if (this[x, y].r != 0) return false |
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.
SimpleBitmap.isEmpty() treats any pixel with RGB=0 as empty, so an opaque black tile would be considered “empty” and packed as a 0x0 rect. If the intent is “fully transparent”, this likely needs to consider alpha instead of RGB.
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
| val ninepatch = linkedMapOf<String, Any>() | ||
| // For nine-patches we only store the frame info of the first frame | ||
| if (slicename.isEmpty()) { | ||
| val ninePatchslice = aseInfo.slices.first() |
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.
aseInfo.slices.first() will throw NoSuchElementException if an ASE file has no slices, which bypasses the more descriptive error handling below. This could fail with a confusing stacktrace for missing-slice nine-patch inputs.
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
| ) | ||
| ) | ||
|
|
||
| assetLevelMapExporter.exportTileMapLDtk( |
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.
This test currently has no assertions, so it will pass even if exportTileMapLDtk produces no output (including the current early-return behavior). It may be worth asserting that expected entries are added to assetInfo for at least one layer/tile.
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
No description provided.