Skip to content

Conversation

@reosfire
Copy link
Contributor

@reosfire reosfire commented May 14, 2025

Autogenerated atlas texture packing in this pr can be configured through .atlas file in the following manner:

#enable-rotation=false
#enable-trimming=false
#padding=1
folder1
folder2

@soywiz soywiz requested review from Copilot and soywiz May 15, 2025 19:07

open class KorgeTexturePacker : KorgeResourceProcessor {
override fun processFolder(context: KorgeResourceProcessorContext) {
context.resourceFolders
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess this line should be removed?

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces configurable atlas texture packing by allowing texture packing settings—rotation, trimming, and padding—to be defined in an external .atlas file rather than using hardcoded values.

  • Introduces a new padding parameter (default 2) in the texture packer classes.
  • Adds parsing logic to read atlas settings from configuration files, propagating these settings into the generation logic.
  • Mirrors these changes in both the main and buildSrc modules to ensure consistency.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
korge-gradle-plugin/src/main/kotlin/korlibs/korge/gradle/texpacker/NewTexturePacker.kt Replaced hardcoded padding with a configurable parameter.
korge-gradle-plugin/src/main/kotlin/korlibs/korge/gradle/processor/KorgeTexturePacker.kt Added atlas configuration parsing and passed settings to the generate function.
buildSrc/src/main/kotlin/korlibs/korge/gradle/texpacker/NewTexturePacker.kt Applied the configurable padding changes echoing the changes in the main module.
buildSrc/src/main/kotlin/korlibs/korge/gradle/processor/KorgeTexturePacker.kt Implemented atlas settings parsing and usage in the generate method.


open class KorgeTexturePacker : KorgeResourceProcessor {
override fun processFolder(context: KorgeResourceProcessorContext) {
context.resourceFolders
Copy link

Copilot AI May 15, 2025

Choose a reason for hiding this comment

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

The use of 'context.resourceFolders' as a standalone expression does not affect the control flow and appears to be a no-op; consider removing it for clarity.

Suggested change
context.resourceFolders

Copilot uses AI. Check for mistakes.

open class KorgeTexturePacker : KorgeResourceProcessor {
override fun processFolder(context: KorgeResourceProcessorContext) {
context.resourceFolders
Copy link

Copilot AI May 15, 2025

Choose a reason for hiding this comment

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

The standalone invocation of 'context.resourceFolders' is redundant and does not contribute to the processing logic; it is recommended to remove it to avoid confusion.

Copilot uses AI. Check for mistakes.
}
}

private fun parseAtlasSettingsFile(atlasFile: File): AtlasGenerationSettings {
Copy link

Copilot AI May 15, 2025

Choose a reason for hiding this comment

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

Since similar atlas settings parsing logic exists in both the main and buildSrc processor files, consider extracting this logic into a shared utility to reduce duplication and ease future maintenance.

Copilot uses AI. Check for mistakes.
}
}

private fun parseAtlasSettingsFile(atlasFile: File): AtlasGenerationSettings {
Copy link

Copilot AI May 15, 2025

Choose a reason for hiding this comment

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

The atlas settings parsing in this module duplicates functionality found in the main module; consider refactoring this into a common utility to improve maintainability.

Copilot uses AI. Check for mistakes.
@soywiz soywiz merged commit 76cc17c into korlibs:main May 15, 2025
6 checks passed
@reosfire reosfire deleted the configurable-texture-packing branch May 20, 2025 11:48
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