Skip to content

Commit

Permalink
unreal_asset: add support for NON_OUTER_PACKAGE_IMPORT
Browse files Browse the repository at this point in the history
  • Loading branch information
jariz committed Apr 14, 2024
1 parent 84e60cc commit 7c56622
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
9 changes: 9 additions & 0 deletions unreal_asset/src/asset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -880,6 +880,14 @@ impl<'a, C: Read + Seek> Asset<C> {
let class_name = self.read_fname()?;
let outer_index = PackageIndex::new(self.read_i32::<LE>()?);
let object_name = self.read_fname()?;

let package_name = match self.get_object_version()
>= ObjectVersion::VER_UE4_NON_OUTER_PACKAGE_IMPORT
{
true => Some(self.read_fname()?),
false => None,
};

let optional =
match self.get_object_version_ue5() >= ObjectVersionUE5::OPTIONAL_RESOURCES {
true => self.read_i32::<LE>()? == 1,
Expand All @@ -891,6 +899,7 @@ impl<'a, C: Read + Seek> Asset<C> {
class_name,
outer_index,
object_name,
package_name,
optional,
);
self.imports.push(import);
Expand Down
4 changes: 4 additions & 0 deletions unreal_asset/unreal_asset_base/src/import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ pub struct Import {
pub outer_index: PackageIndex,
/// Object name
pub object_name: FName,
/// Package name
pub package_name: Option<FName>,
/// Is the import optional
pub optional: bool,
}
Expand All @@ -34,13 +36,15 @@ impl Import {
class_name: FName,
outer_index: PackageIndex,
object_name: FName,
package_name: Option<FName>,
optional: bool,
) -> Self {
Import {
class_package,
class_name,
object_name,
outer_index,
package_name,
optional,
}
}
Expand Down

0 comments on commit 7c56622

Please sign in to comment.