From 7c56622580663e91f7d822a42b36c38cc87652aa Mon Sep 17 00:00:00 2001 From: Jari Zwarts Date: Sun, 14 Apr 2024 15:45:42 +0200 Subject: [PATCH] unreal_asset: add support for NON_OUTER_PACKAGE_IMPORT --- unreal_asset/src/asset.rs | 9 +++++++++ unreal_asset/unreal_asset_base/src/import.rs | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/unreal_asset/src/asset.rs b/unreal_asset/src/asset.rs index 85056040..fa67c0f5 100644 --- a/unreal_asset/src/asset.rs +++ b/unreal_asset/src/asset.rs @@ -880,6 +880,14 @@ impl<'a, C: Read + Seek> Asset { let class_name = self.read_fname()?; let outer_index = PackageIndex::new(self.read_i32::()?); 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::()? == 1, @@ -891,6 +899,7 @@ impl<'a, C: Read + Seek> Asset { class_name, outer_index, object_name, + package_name, optional, ); self.imports.push(import); diff --git a/unreal_asset/unreal_asset_base/src/import.rs b/unreal_asset/unreal_asset_base/src/import.rs index f3eaf39c..663d6261 100644 --- a/unreal_asset/unreal_asset_base/src/import.rs +++ b/unreal_asset/unreal_asset_base/src/import.rs @@ -18,6 +18,8 @@ pub struct Import { pub outer_index: PackageIndex, /// Object name pub object_name: FName, + /// Package name + pub package_name: Option, /// Is the import optional pub optional: bool, } @@ -34,6 +36,7 @@ impl Import { class_name: FName, outer_index: PackageIndex, object_name: FName, + package_name: Option, optional: bool, ) -> Self { Import { @@ -41,6 +44,7 @@ impl Import { class_name, object_name, outer_index, + package_name, optional, } }