Hi. Wanted to share some info on how I could export a single asset using the direct asset file loading. Since I used UnrealPak for extracting the package already, I just needed to get data from the assets themselves. And I didn't have usmap also.
Basically, I used LegacyPackageReader which accepts uasset stream and also had to modify a bit the PackageReader.py so it doesn't give me errors for missing provider for example.
So the base code for loading an asset would be:
from UE4Parse.Assets.PackageReader import LegacyPackageReader
from UE4Parse.BinaryReader import BinaryStream
uasset = BinaryStream('Texture.uasset')
uexp = BinaryStream('Texture.uexp')
reader = LegacyPackageReader(uasset, uexp)
What I did was adding version parameter to specify the UE version directly without provider, which I don't pass.
And as the provider is optional, I added branches for using it when it's not None.
Also I don't have mapping files, so uasset will not have the mappings attribute. (Not sure what it is, maybe it's present in the UE5 packages)
And also added full versioned dependencies in requirements.txt so it should install in a venv without problems.
Hi. Wanted to share some info on how I could export a single asset using the direct asset file loading. Since I used UnrealPak for extracting the package already, I just needed to get data from the assets themselves. And I didn't have
usmap
also.Basically, I used
LegacyPackageReader
which acceptsuasset
stream and also had to modify a bit thePackageReader.py
so it doesn't give me errors for missingprovider
for example.So the base code for loading an asset would be:
I created the following commit in my fork so it should be easier to follow: https://github.com/mortalis13/UE4Parse/commit/0c78cdaf066411fdad9186f1f83433d11e757edc And the Readme has a sample for loading and exporting a texture.
What I did was adding
version
parameter to specify the UE version directly without provider, which I don't pass.And as the provider is optional, I added branches for using it when it's not None.
Also I don't have mapping files, so uasset will not have the
mappings
attribute. (Not sure what it is, maybe it's present in the UE5 packages)And also added full versioned dependencies in
requirements.txt
so it should install in a venv without problems.