unsafe fn save_variant_meshes_data(&self, data: &[HashMap<String, String>]) -> Result<Vec<PackedFile>> {
        let mut packed_files = vec![];
        for unit_data in data {
            let mut variant_meshes = unit_data.iter()
                .filter(|(key, _)| key.starts_with(VARIANT_MESH_DATA))
                .filter_map(|(key, value)| {
                    let subkeys = key.split('|').collect::<Vec<&str>>();
                    let file_name = if subkeys.len() > 1 {
                        unit_data.get(&format!("variants_variant_filename|{}", subkeys[1..].join("|")))?
                    } else {
                        unit_data.get(key)?
                    };

                    let mut text = Text::new();
                    text.set_contents(value);
                    text.set_text_type(TextType::Xml);

                    let path = format!("{}{}.{}", VARIANT_MESH_PATH, file_name, VARIANT_MESH_EXTENSION).split('/').map(|x| x.to_owned()).collect::<Vec<String>>();
                    let packed_file = PackedFile::new_from_decoded(&DecodedPackedFile::Text(text), &path);
                    Some(packed_file)
                })
                .collect::<Vec<PackedFile>>();
            packed_files.append(&mut variant_meshes);
        }

        Ok(packed_files)
    }
/// This function takes care of saving all the edited variant meshes into PackedFiles.
This function takes care of saving all the edited variant meshes into PackedFiles.
This function takes care of saving all the edited variant meshes into PackedFiles .
unsafe fn save_variant_meshes_data(&self, data: &[HashMap<String, String>]) -> Result<Vec<PackedFile>> {
        let mut packed_files = vec![];
        for unit_data in data {
            let mut variant_meshes = unit_data.iter()
                .filter(|(key, _)| key.starts_with(VARIANT_MESH_DATA))
                .filter_map(|(key, value)| {
                    let subkeys = key.split('|').collect::<Vec<&str>>();
                    let file_name = if subkeys.len() > 1 {
                        unit_data.get(&format!("variants_variant_filename|{}", subkeys[1..].join("|")))?
                    } else {
                        unit_data.get(key)?
                    };
                    let mut text = Text::new();
                    text.set_contents(value);
                    text.set_text_type(TextType::Xml);
                    let path = format!("{}{}.{}", VARIANT_MESH_PATH, file_name, VARIANT_MESH_EXTENSION).split('/').map(|x| x.to_owned()).collect::<Vec<String>>();
                    let packed_file = PackedFile::new_from_decoded(&DecodedPackedFile::Text(text), &path);
                    Some(packed_file)
                })
                .collect::<Vec<PackedFile>>();
            packed_files.append(&mut variant_meshes);
        }
        Ok(packed_files)
    }
unsafe fn save_variant_meshes_data ( & self , data : & [ HashMap < String , String > ] ) -> Result < Vec < PackedFile > > { let mut packed_files = vec ! [ ] ; for unit_data in data { let mut variant_meshes = unit_data . iter ( ) . filter ( | ( key , _ ) | key . starts_with ( VARIANT_MESH_DATA ) ) . filter_map ( | ( key , value ) | { let subkeys = key . split ( '|' ) . collect :: < Vec < & str > > ( ) ; let file_name = if subkeys . len ( ) > 1 { unit_data . get ( & format ! ( " " subkeys [ 1 ] join ( " " ) ) ) ? } else { unit_data . get ( key ) ? } ; let mut text = Text :: new ( ) ; text . set_contents ( value ) ; text . set_text_type ( TextType :: Xml ) ; let path = format ! ( " " VARIANT_MESH_PATH file_name VARIANT_MESH_EXTENSION ) . split ( '/' ) . map ( | x | x . to_owned ( ) ) . collect :: < Vec < String > > ( ) ; let packed_file = PackedFile :: new_from_decoded ( & DecodedPackedFile :: Text ( text ) , & path ) ; Some ( packed_file ) } ) . collect :: < Vec < PackedFile > > ( ) ; packed_files . append ( & mut variant_meshes ) ; } Ok ( packed_files ) }
This function takes care of saving all the edited variant meshes into PackedFiles.
This function takes care of saving all the edited variant meshes into PackedFiles .
&self
data
&[HashMap<String, String>]
&self
data
&[HashMap<String, String>]