Skip to content

Commit

Permalink
Merge pull request #11 from boatbomber/padding-config
Browse files Browse the repository at this point in the history
Add config for spritesheet padding
  • Loading branch information
Vorlias committed Jan 8, 2024
2 parents af8b153 + 242429d commit 8b702fe
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Tarmac Changelog

## Unreleased Changes
* Added `spritesheet-padding-size` to root config ([#11](https://github.com/rojo-rbx/tarmac/pull/11))

## 0.7.1 (2020-12-14)
* Added alpha-bleeding of unpacked images ([#2](https://github.com/jeparlefrancais/tarmac/pull/2))
Expand Down Expand Up @@ -48,4 +49,4 @@
* Added support for grabbing inputs by glob pattern.

## 0.1.0 (2020-01-03)
* Initial release.
* Initial release.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,8 @@ tarmac help [<subcommand>]
* The name of the Tarmac project, used in logging and error reporting.
* `max-spritesheet-size`, (int, int), **optional**
* The maximum spritesheet size that Tarmac should use. Defaults to **(1024, 1024)**, the maximum image size supported by Roblox.
* `spritesheet-padding-size`, int, **optional**
* The pixel padding between images packed into a spritesheet that Tarmac should use. Defaults to **1**.
* `asset-cache-path`, path, **optional**
* If defined, Tarmac will re-download uploaded images to a local folder at the given path. Files in this folder not associated with assets in the project will be deleted.
* `asset-list-path`, path, **optional**
Expand Down
2 changes: 1 addition & 1 deletion src/commands/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ impl SyncSession {

let packer = SimplePacker::new()
.max_size(self.root_config().max_spritesheet_size)
.padding(1);
.padding(self.root_config().spritesheet_padding_size);

let pack_results = packer.pack(packos_inputs);
let mut packed_images = Vec::new();
Expand Down
8 changes: 8 additions & 0 deletions src/data/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ pub struct Config {
#[serde(default = "default_max_spritesheet_size")]
pub max_spritesheet_size: (u32, u32),

/// The padding size that any packed spritesheets should use. Only applies if
/// this config is the root config file.
#[serde(default = "default_spritesheet_padding_size")]
pub spritesheet_padding_size: u32,

/// A path to a folder where any assets contained in the project should be
/// stored. Each asset's name will match its asset ID.
pub asset_cache_path: Option<PathBuf>,
Expand Down Expand Up @@ -124,6 +129,9 @@ impl Config {
fn default_max_spritesheet_size() -> (u32, u32) {
(1024, 1024)
}
fn default_spritesheet_padding_size() -> u32 {
1
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(deny_unknown_fields, rename_all = "kebab-case")]
Expand Down

0 comments on commit 8b702fe

Please sign in to comment.