diff --git a/CHANGELOG.md b/CHANGELOG.md index d94da54..cdc0ffc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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)) @@ -48,4 +49,4 @@ * Added support for grabbing inputs by glob pattern. ## 0.1.0 (2020-01-03) -* Initial release. \ No newline at end of file +* Initial release. diff --git a/README.md b/README.md index 0a01dbc..d35e689 100644 --- a/README.md +++ b/README.md @@ -178,6 +178,8 @@ tarmac help [] * 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** diff --git a/src/commands/sync.rs b/src/commands/sync.rs index 7261e2c..a2b7abf 100644 --- a/src/commands/sync.rs +++ b/src/commands/sync.rs @@ -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(); diff --git a/src/data/config.rs b/src/data/config.rs index cdfe38e..123c2e4 100644 --- a/src/data/config.rs +++ b/src/data/config.rs @@ -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, @@ -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")]