Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/minshug/pyue4parse
ue4 asset parser/reader
https://github.com/minshug/pyue4parse
python unreal-engine-4
Last synced: 25 days ago
JSON representation
ue4 asset parser/reader
- Host: GitHub
- URL: https://github.com/minshug/pyue4parse
- Owner: MinshuG
- License: mit
- Created: 2021-03-15T15:23:24.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2024-05-10T14:37:52.000Z (8 months ago)
- Last Synced: 2024-05-11T14:42:28.090Z (8 months ago)
- Topics: python, unreal-engine-4
- Language: Python
- Homepage:
- Size: 409 KB
- Stars: 42
- Watchers: 6
- Forks: 11
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
**UE4/5 Asset Parser**
## Installation
python -m pip install git+https://github.com/MinshuG/pyUE4Parse.git // minimal installationpython -m pip install git+https://github.com/MinshuG/pyUE4Parse.git[tex] // with texture decoders
## Features
* Parse UE4/5 asset files(.uasset, .umap, .uexp, .ubulk)
* Convert Textures to PIL Image object
* Convert assets to json
* Supports reading .pak/.utoc containers## Usages
Basic Usages
```python
from UE4Parse.Assets.Objects.FGuid import FGuid
from UE4Parse.Provider import DefaultFileProvider, MappingProvider
from UE4Parse.Versions import EUEVersion, VersionContainer
from UE4Parse.Encryption import FAESKeyimport logging
logging.getLogger("UE4Parse").setLevel(logging.INFO) # set logging level
path = r"C:\Program Files\Epic Games\Fortnite\FortniteGame\Content\Paks"
aeskeys = {
FGuid(0,0,0,0): FAESKey("0xFE478B39DF1B1D4E8D8DFD38272F216DBE933E7F80ADCC45DC4108D70428F37D"),
}import gc; gc.disable() # temporarily disabling garbage collector gives a huge performance boost
provider = DefaultFileProvider(path, VersionContainer(EUEVersion.LATEST))
provider.initialize()
provider.submit_keys(aeskeys) # mount filesprovider.load_localization("fr")
gc.enable() # enable garbage collector again
provider.mappings = MappingProvider("path/to/mappings.usmap")
package_path = 'FortniteGame/Content/Animation/Game/MainPlayer/Skydive/ParaGlide/MechanicalEngineer/BS_MechanicalEngineer_Into_NoPack_GLIDER'
package = provider.try_load_package(package_path)
if package is not None:
package_dict = package.get_dict() # get json serializable dict# write package_dict to json
import json
with open('something.json', 'w') as f:
json.dump(package_dict, f, indent=4)
```Converting Textures
```python
if texture := package.find_export_of_type("Texture2D"):
image = texture.decode() # returns PIL Image object
image.save("cool_image.png", "PNG") # save image
# for more information refer to https://pillow.readthedocs.io/en/stable/reference/Image.html?highlight=Image#PIL.Image.Image
```## Links
- [Trello](https://trello.com/b/yp0hx22L/pyue4parse)
- [CUE4Parse](https://github.com/FabianFG/CUE4Parse)
## Notes for Developers- Developers can use pyximport for development purposes (loading cython extensions)
```python
import pyximport
pyximport.install()
```