Skip to content

Conversation

@jobe-m
Copy link
Member

@jobe-m jobe-m commented Feb 1, 2026

No description provided.

Koschak and others added 30 commits December 9, 2025 08:40
- Start to add more frame and slice info into ASEInfo
- Update NewTexturePacker writeImage function
@augmentcode
Copy link

augmentcode bot commented Feb 1, 2026

🤖 Augment PR Summary

Summary: Adds a new korgeFleks extension to the Korge Gradle plugin to support a “KorgeFleks” asset pipeline.

Changes:

  • Introduced AssetConfig plus world/cluster variants to orchestrate asset export and atlas generation
  • Added Aseprite-based exporters for images, nine-patches, and parallax layers/planes
  • Added installers/exporters for generic files (incl. pixel fonts) and tileset PNGs
  • Added atlas builders for images and tilesets that write atlas PNGs and JSON metadata
  • Extended NewTexturePacker with tileset packing (tileWidth/Height), configurable atlas size, and “write image only” support
  • Updated ASE parsing to read (and ignore) default layer width/height fields
  • Added/updated unit tests and test resources for ASE, tileset packing, and LDtk fixtures

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 👎

Copy link

@augmentcode augmentcode bot left a comment

Choose a reason for hiding this comment

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

Review completed. 8 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.


// (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)
Copy link

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.

Fix This in Augment

🤖 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
Copy link

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.

Fix This in Augment

🤖 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
Copy link

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.

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

}
println(tileSetDataByUid)

return
Copy link

Choose a reason for hiding this comment

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

This return exits exportTileMapLDtk before any level/layer processing, so the method is effectively a no-op beyond logging tileset info. If this isn’t intentional, it will prevent LDtk tilemaps from being exported.

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

Copy link
Member Author

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) {
Copy link

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

Fix This in Augment

🤖 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
Copy link

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.

Fix This in Augment

🤖 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()
Copy link

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.

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

)
)

assetLevelMapExporter.exportTileMapLDtk(
Copy link

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.

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants