diff --git a/CHANGELOG.md b/CHANGELOG.md index 167d1705a3063866c215a8e41e12efd172ec3f35..c561f9b6f8ec4d7f0ac762e4d56994df03cea0d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,38 +1,65 @@ # Changelog + All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [0.8.0] +## [0.8.1] - 2024-04-28 + +### Added + +- Support spritesheet generation in `atlas` command by specifying sprite `--area` + ### Changed + +- `atlas` args short form changed from `w` and `h` to `x` and `y` to specify max output width, to + prevent collision with built in help command + +## [0.8.0] + +### Added + - Support non-square tiles in `split` command with `-w` and `-h` flags ## [0.7.0] + ### Added + - Support for `--extrude` param in `extrude` command ## [0.5.0] - 2023-02-22 + ### Added + - `split` command for taking a sprite sheet and converting it into individual tiles ### Changed + - Moved all arguments into subcommands, for a less confusing end user experience ## [0.4.0] - 2022-08-08 + ### Added + - Support for GlobRef definitions in a `pipeline.toml` file - - Takes a `pattern` glob expression instead of an `input_path` - - Takes a directory path as `output_dir` instead of a file path as `output_file`, and will construct the an `output_file` by appending the file name of a matched file to the output directory + - Takes a `pattern` glob expression instead of an `input_path` + - Takes a directory path as `output_dir` instead of a file path as `output_file`, and will construct the + an `output_file` by appending the file name of a matched file to the output directory ### Changed + - All paths in pipelines are now relative to the pipeline configuration file, instead of the current directory ## [0.3.0] - 2022-07-08 + ### Added + - Added `flip` command, for flipping an image along one or both axes. - Added `rotate` command to apply a rotation to an image, in steps of 90 degrees. ## [0.2.0] + ### Added + - Added `pipeline` command, for applying a series of transformations to an image. \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index f687bcfb1a17c0ceadd5b426eb7ac984b04b66ca..32f24aa4210bd962444f0cdc67823c6d39eb0ce1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -233,7 +233,7 @@ dependencies = [ [[package]] name = "crunch-cli" -version = "0.8.0" +version = "0.8.1" dependencies = [ "anyhow", "clap", diff --git a/Cargo.toml b/Cargo.toml index e883f027b478a0b8c29841304671c94d69bc9f51..173db320800fa3d667cd8e0c481d3163a78ec83f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "crunch-cli" -version = "0.8.0" +version = "0.8.1" edition = "2021" homepage = "https://microhacks.lcr.app/crunch/" @@ -9,7 +9,7 @@ repository = "https://lab.lcr.gr/microhacks/crunch" license = "GPL-3.0" description = "Command line asset manipulation, set up a pipeline once and run it against all of your files" authors = [ - "Louis Capitanchik <louis@microhacks.co.uk>" + "Louis Capitanchik <louis@microhacks.co.uk>" ] [[bin]] diff --git a/src/commands/atlas.rs b/src/commands/atlas.rs index b4018010e314299348c853f6ad153e37f24f6047..2ef6004c3a176f73dcb6cec6b235b2da8ffe398b 100644 --- a/src/commands/atlas.rs +++ b/src/commands/atlas.rs @@ -16,7 +16,7 @@ fn default_max_size() -> usize { /// Given a set of images, create a single atlas image and metadata file containing all of the original /// set #[derive(Parser, Serialize, Deserialize, Clone, Debug)] -#[clap(author, version = "0.7.0")] +#[clap(author, version = "0.8.1")] pub struct Atlas { /// A pattern evaluating to one or more image files #[serde(default)] @@ -26,12 +26,16 @@ pub struct Atlas { pub output: String, /// The maximum width of the output texture #[serde(default = "default_max_size")] - #[clap(short = 'w', long = "max_width")] + #[clap(short = 'x', long = "max_width")] pub max_frame_width: usize, /// The maximum height of the output texture #[serde(default = "default_max_size")] - #[clap(short = 'h', long = "max_height")] + #[clap(short = 'y', long = "max_height")] pub max_frame_height: usize, + /// Set a fixed size for each sprite to occupy, creating a fixed grid spritesheet. Sprites must + /// be padded to the correct size before specifying an area + #[clap(short = 'a', long = "area")] + pub area: Option<usize>, } #[derive(Copy, Clone, Hash, Eq, PartialEq)] @@ -107,7 +111,13 @@ impl Atlas { let page_content_map: HashMap<usize, Vec<(PathBuf, Rectangle)>> = pattern .into_iter() .filter_map(Result::ok) - .flat_map(|path| image_dimensions(&path).map(|(w, h)| (w, h, path))) + .flat_map(|path| { + if let Some(fixed) = &self.area { + Ok((*fixed as u32, *fixed as u32, path)) + } else { + image_dimensions(&path).map(|(w, h)| (w, h, path)) + } + }) .flat_map(|(w, h, path)| builder.insert(w, h, path)) .collect::<Vec<(AtlasIdent, SliceData)>>() .into_iter()