MinshuG / pyUE4Parse

ue4 asset parser/reader
MIT License
47 stars 15 forks source link

Loading package_dict from Single .uasset Without Provider? #17

Open k----n opened 9 months ago

k----n commented 9 months ago

How can you extract the package_dict from a single .uasset file? The .uasset file lives in a path like: /SpaceTradingShooter/Content/Blueprints/AI/BB_AI_Ship.uasset


This is related to #11 which writes:

Use LegacyPackageReader directly https://github.com/MinshuG/pyUE4Parse/blob/1c7b64cf95be6c234f6f45e3dbd5f9e84b25f99f/UE4Parse/Assets/PackageReader.py#L80


To use initialize LegacyPackageReader, you need a to pass a BinaryStream.

The first issue is that by directly initializing a BinaryStream for the LegacyPackageReader, you will not get the mappings attribute in the BinaryStream. https://github.com/MinshuG/pyUE4Parse/blob/1c7b64cf95be6c234f6f45e3dbd5f9e84b25f99f/UE4Parse/Assets/PackageReader.py#L90

The second issue is although it seems like you can initialize LegacyPackageReader without a provider, it will error out because set_ar_verion uses None and has no Versions attribute. https://github.com/MinshuG/pyUE4Parse/blob/1c7b64cf95be6c234f6f45e3dbd5f9e84b25f99f/UE4Parse/Assets/PackageReader.py#L91

mortalis13 commented 2 months ago

Check this info: #23 I also needed to check a single asset, so I modified some code. Worked for me, exporing a Texture2D from UE 4.26 assets.

mortalis13 commented 2 months ago

ok also #14 could help, setting BinaryStream.mappings to None explicitly and creating provider passing the path to the uasset.
So the DefaultFileProvider acts like a generic container I guess, not only dedicated to .pak or .utoc.