Edited include format
parent
5279eeb7d4
commit
b7d12ac875
2
assets
2
assets
|
@ -1 +1 @@
|
|||
Subproject commit 66b7aab8af273cac9b805d813f2e5cb70a920000
|
||||
Subproject commit fa116c0e4056200ad945d241a9980e49ada293fc
|
|
@ -1,10 +1,11 @@
|
|||
use anyhow::Result;
|
||||
use std::{collections::HashMap, fs::File, io::Read, path::Path};
|
||||
use std::{collections::HashMap, fs::File, io::Read, path::Path, path::PathBuf};
|
||||
|
||||
use super::{rawtexture::RawTexture, Texture, TextureArrayConfig};
|
||||
|
||||
mod fields {
|
||||
use super::{File, Path, RawTexture, Read, Result, TextureArrayConfig};
|
||||
|
||||
use super::{File, HashMap, Path, PathBuf, RawTexture, Read, Result, TextureArrayConfig};
|
||||
use serde::Deserialize;
|
||||
|
||||
// Config is used outside of this file,
|
||||
|
@ -13,7 +14,7 @@ mod fields {
|
|||
#[derive(Deserialize)]
|
||||
pub struct Index {
|
||||
pub config: TextureArrayConfig,
|
||||
pub include: Option<Vec<String>>,
|
||||
pub include: Option<HashMap<PathBuf, String>>,
|
||||
pub texture: Vec<Texture>,
|
||||
}
|
||||
|
||||
|
@ -31,7 +32,7 @@ mod fields {
|
|||
|
||||
#[derive(Deserialize)]
|
||||
pub struct SubIndex {
|
||||
pub include: Option<Vec<String>>,
|
||||
pub include: Option<HashMap<PathBuf, String>>,
|
||||
pub texture: Vec<Texture>,
|
||||
}
|
||||
|
||||
|
@ -152,8 +153,8 @@ impl TextureLoader {
|
|||
|
||||
// Load included files
|
||||
if let Some(include) = index.include {
|
||||
for i in include {
|
||||
let sub_root = texture_root.join(&i);
|
||||
for (path, sub_prefix) in include {
|
||||
let sub_root = texture_root.join(&path);
|
||||
let index: fields::SubIndex = {
|
||||
let mut texture_index_string = String::new();
|
||||
let _ = File::open(sub_root.join(Self::INDEX_NAME))?
|
||||
|
@ -167,9 +168,9 @@ impl TextureLoader {
|
|||
index,
|
||||
&sub_root,
|
||||
if prefix.is_empty() {
|
||||
i
|
||||
sub_prefix
|
||||
} else {
|
||||
format!("{prefix}::{i}")
|
||||
format!("{prefix}::{sub_prefix}")
|
||||
},
|
||||
)?;
|
||||
for (s, data) in sub_textures {
|
||||
|
|
Loading…
Reference in New Issue