forked from StrafesNET/map-tool
use search paths
This commit is contained in:
parent
894584f855
commit
8bd0765290
10
src/main.rs
10
src/main.rs
@ -1087,8 +1087,8 @@ fn get_some_texture(material:vmt_parser::material::Material)->AResult<VMTContent
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn get_vmt<F:Fn(String)->AResult<Option<Vec<u8>>>>(find_stuff:&F,search_name:String)->AResult<Option<vmt_parser::material::Material>>{
|
fn get_vmt<F:Fn(String)->AResult<Option<Vec<u8>>>>(find_stuff:&F,search_name:String)->AResult<Option<vmt_parser::material::Material>>{
|
||||||
|
println!("looking for {}",search_name);
|
||||||
if let Some(stuff)=find_stuff(search_name)?{
|
if let Some(stuff)=find_stuff(search_name)?{
|
||||||
//println!("woahh its a vmt {:?}",search_name);
|
|
||||||
//decode vmt and then write
|
//decode vmt and then write
|
||||||
let stuff=String::from_utf8(stuff)?;
|
let stuff=String::from_utf8(stuff)?;
|
||||||
let material=vmt_parser::from_str(stuff.as_str())?;
|
let material=vmt_parser::from_str(stuff.as_str())?;
|
||||||
@ -1149,9 +1149,11 @@ fn extract_textures(paths:Vec<std::path::PathBuf>,vpk_path:std::path::PathBuf)->
|
|||||||
(Ok(mdl),Ok(vvd),Ok(vtx))=>{
|
(Ok(mdl),Ok(vvd),Ok(vtx))=>{
|
||||||
let model=vmdl::Model::from_parts(mdl,vtx,vvd);
|
let model=vmdl::Model::from_parts(mdl,vtx,vvd);
|
||||||
for texture in model.textures(){
|
for texture in model.textures(){
|
||||||
println!("prop texture={}",texture.name.as_str());
|
for search_path in &texture.search_paths{
|
||||||
println!("search paths={:?}",texture.search_paths);
|
let mut path=std::path::PathBuf::from(search_path.as_str());
|
||||||
deduplicate.insert(std::path::PathBuf::from(texture.name.as_str()));
|
path.push(texture.name.as_str());
|
||||||
|
deduplicate.insert(path);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
_=>print!("model_name={} error",model_name),
|
_=>print!("model_name={} error",model_name),
|
||||||
|
Loading…
Reference in New Issue
Block a user