Serialization fixes

This commit is contained in:
Piotr Siuszko 2025-01-14 12:22:31 +01:00
parent b6395891bc
commit c7a56c6060
3 changed files with 9 additions and 2 deletions

View File

@ -15,7 +15,7 @@ basis = ["dep:basis-universal"]
dds = ["dep:image_dds"]
[dependencies]
bevy_rpack = { default-features = false, path = "../bevy_rpack" }
bevy_rpack = { default-features = false, path = "../bevy_rpack", version = "0.1" }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
texture_packer = { version = "0.29", features = ["common"] }
@ -27,4 +27,4 @@ clap = { version = "4", features = ["derive"], optional = true }
basis-universal = { version = "0.3.1", optional = true }
image_dds = { version = "0.7", optional = true }
glob = { version = "0.3", optional = true }
anyhow = "1"
anyhow = "1"

View File

@ -44,8 +44,10 @@ pub enum Commands {
#[clap(short, long)]
source_paths: Vec<String>,
/// Size of the padding between frames in pixel. Default value is `2`
#[clap(short, long)]
texture_padding: Option<u32>,
/// Size of the padding on the outer edge of the packed image in pixel. Default value is `0`.
#[clap(short, long)]
border_padding: Option<u32>,
},
/// Generates a tilemap from config

View File

@ -307,12 +307,16 @@ pub struct TilemapGenerationConfig {
pub asset_patterns: Vec<String>,
pub output_path: String,
/// Image format, png by default
#[serde(skip_serializing_if = "Option::is_none", default)]
pub format: Option<SaveImageFormat>,
/// Size of the tilemap texture. Default value is `2048`.
#[serde(skip_serializing_if = "Option::is_none", default)]
pub size: Option<u32>,
/// Size of the padding between frames in pixel. Default value is `2`
#[serde(skip_serializing_if = "Option::is_none", default)]
pub texture_padding: Option<u32>,
/// Size of the padding on the outer edge of the packed image in pixel. Default value is `0`.
#[serde(skip_serializing_if = "Option::is_none", default)]
pub border_padding: Option<u32>,
#[serde(skip)]
pub working_dir: Option<PathBuf>,
@ -354,6 +358,7 @@ impl TilemapGenerationConfig {
println!("{}", p);
glob::glob(&p).expect("Wrong pattern for assets").flatten()
})
.filter(|e| e.is_file())
.collect();
file_paths.sort();
let prefix = get_common_prefix(&file_paths);