From 47b211844218f874a76c6f6dab451d7d47311ff1 Mon Sep 17 00:00:00 2001 From: boatbomber Date: Sun, 17 Dec 2023 11:39:31 -0500 Subject: [PATCH 1/7] Add config for padding size --- src/data/config.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/data/config.rs b/src/data/config.rs index cdfe38e..1759558 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")] From f0e71912308e08dff2446877d9d00489558d6b07 Mon Sep 17 00:00:00 2001 From: boatbomber Date: Sun, 17 Dec 2023 11:39:42 -0500 Subject: [PATCH 2/7] Use new padding config --- src/commands/sync.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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(); From 095a4c394bcc84e8d98b363175cad6972508a730 Mon Sep 17 00:00:00 2001 From: boatbomber Date: Sun, 17 Dec 2023 11:39:50 -0500 Subject: [PATCH 3/7] Add to changelog --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d94da54..829efd7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Tarmac Changelog ## Unreleased Changes +* Added `spritesheet-padding-size` to root config ([#8](https://github.com/rojo-rbx/tarmac/pull/8)) ## 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. From ee233fcd7e9b6858fd7376ed6521421de4cd237f Mon Sep 17 00:00:00 2001 From: boatbomber Date: Sun, 17 Dec 2023 11:40:00 -0500 Subject: [PATCH 4/7] Add to README --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 0a01dbc..2dcad91 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 padding size in pixels 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** From 66274476d3e0a64452fc4be7abd1eda490bc71fe Mon Sep 17 00:00:00 2001 From: boatbomber Date: Sun, 17 Dec 2023 11:41:07 -0500 Subject: [PATCH 5/7] Less clunky wording --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2dcad91..d35e689 100644 --- a/README.md +++ b/README.md @@ -179,7 +179,7 @@ tarmac help [] * `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 padding size in pixels between images packed into a spritesheet that Tarmac should use. Defaults to **1**. + * 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** From 958ff6cae551cdc1abca3d2d9e3648ed1bc15f66 Mon Sep 17 00:00:00 2001 From: boatbomber Date: Sun, 17 Dec 2023 11:42:58 -0500 Subject: [PATCH 6/7] Use real PR number now that it's opened --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 829efd7..cdc0ffc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ # Tarmac Changelog ## Unreleased Changes -* Added `spritesheet-padding-size` to root config ([#8](https://github.com/rojo-rbx/tarmac/pull/8)) +* 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)) From 242429dd2cfa903ad7c9e4246c7ba8ac8a2b4edc Mon Sep 17 00:00:00 2001 From: boatbomber Date: Sun, 17 Dec 2023 18:45:54 -0500 Subject: [PATCH 7/7] Fix whitespace --- src/data/config.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/data/config.rs b/src/data/config.rs index 1759558..123c2e4 100644 --- a/src/data/config.rs +++ b/src/data/config.rs @@ -26,7 +26,7 @@ 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 + /// 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,