mirror of https://github.com/Leinnan/rpack.git
Atlas asset- sort frames by key values
This commit is contained in:
parent
de3c04c6d6
commit
c9a28a328e
|
|
@ -135,7 +135,7 @@ impl Spritesheet {
|
||||||
return Err(SpritesheetError::FailedToExportImage);
|
return Err(SpritesheetError::FailedToExportImage);
|
||||||
};
|
};
|
||||||
|
|
||||||
let atlas_asset = bevy_rpack::AtlasAsset {
|
let mut atlas_asset = bevy_rpack::AtlasAsset {
|
||||||
size: [image_data.width(), image_data.height()],
|
size: [image_data.width(), image_data.height()],
|
||||||
filename: filename.as_ref().to_owned(),
|
filename: filename.as_ref().to_owned(),
|
||||||
frames: packer
|
frames: packer
|
||||||
|
|
@ -154,6 +154,7 @@ impl Spritesheet {
|
||||||
})
|
})
|
||||||
.collect(),
|
.collect(),
|
||||||
};
|
};
|
||||||
|
atlas_asset.frames.sort_by(|a,b| a.key.cmp(&b.key));
|
||||||
let atlas_asset_json = serde_json::to_value(&atlas_asset)?;
|
let atlas_asset_json = serde_json::to_value(&atlas_asset)?;
|
||||||
|
|
||||||
Ok(Spritesheet {
|
Ok(Spritesheet {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue