-
Notifications
You must be signed in to change notification settings - Fork 11
Generating FBX
For asset types requiring .fbx
files, CAS reads the cooked asset and the generated .fbx
file to create the serialized JSON
The asset generator will then use the model hash from the JSON to import the FBX file. This model hash is used when reimporting a changed FBX asset, without having to delete it and import again. If the hash changes, then it will regenerate the FBX file.
The following asset types need .fbx
files to be generated first to work:
- Static Mesh
- Skeletal Mesh
- Animation Sequence
- Animation Composite
- Animation Montage
To obtain static meshes, skeletal meshes and animations, you will need to follow through a few steps. Please make sure you follow each step carefully as usual!
ActorX files are those with the .psk
, .pskx
and .psa
extensions. To obtain these files and their metadata, you will use a fork of CUE4Parse specially created for this task.
git clone https://github.com/Buckminsterfullerene02/CUE4Parse.git --recursive
cd CUE4Parse
git checkout mass-export
Next, open the solution in your tool of choice, Visual Studio (not Code) or Rider are recommended.
Go into AnimExport/Program.cs
and change the settings constants at the top of the program above the Main
function. For CAS, you need to set _exportMaterials = false
.
Finally, run the Main
method of the AnimExport project. This will create the following in your output directory:
- Anims: Animation Sequences, Montages and Compositions
- SKMs: Skeletal Meshes
- SMs: Static Meshes
- SKs: Skeletons
As it may fail on a small number of files (such as additives with missing ref pose), my recommendation is to rerun the program a second time with _printSuccess = false
and _replaceFiles = false
so that your console only has the errors of the missing files in it. You can then decide what to do with those error messages, such as making an issue in the fork, or generating those missing assets using UModel (assuming they are not animation additives).
The exporter will also output the text file additives.txt
to the specified output directory with a list of all the animation additives as there is no other easy way to tell.
If you don't already have Blender installed, you can download the latest version from the Blender downloads page (the scripts work fine in 2.9, 3.2, 3.6, 4.0 so probably all the other ones are fine too).
With Blender installed, you will need to add two plugins from GitHub:
- blender3d_import_psk_psa: download the repository as zip
- psk_psa_batch_export.py: download just the python file
Place these under %AppData%\Roaming\Blender Foundation\Blender\3.6\scripts\addons
.
You might need to open Blender first for it to create this path. You can add any missing directories yourself.
You may need to fix these two imports in psk_psa_batch_export.py
manually:
# ...
from io_import_scene_unreal_psa_psk_280.io_import_scene_unreal_psa_psk_280 import pskimport
from io_import_scene_unreal_psa_psk_280.io_import_scene_unreal_psa_psk_280 import psaimport
# ...
You may also need to delete this line (119) in psk_psa_batch_export.py
:
bBoneNameCaseSensitiveCmp = True,
With the addons in place, you will need to enable them from the Blender interface.
Go to Edit -> Preferences -> Addons
,
and enable the Import: ActorX to FBX for Unreal
and Import-Export: Import Unreal Skeleton Mesh (.psk)/Animation Set (.psa) (280)
addons.
Before you do the next steps, navigate to Window -> Toggle system console
.
This will help give you an indicator of what it's currently doing,
as the main blender window will completely freeze when running the mass export.
Next, open the toolshelf by going toggling View -> Sidebar
, or by simply pressing N
.
Then in the tool shelf, you should see PSK2FBX tab, and do the following:
- Run
Convert PSK to UE FBX Recursive
with- the file type
PSK
- the PSK Folder Path set to
SKMs
- the file type
- Run
Convert PSK to UE FBX Recursive
with- the file type
PSKX
- the PSK Folder Path set to
SMs
- the file type
- Run
Convert PSA to UE FBX Recursive
with- the file type
USE FOLDER
- the PSA Folder
Anims
- the Skeleton Folder set to
SKs/Blender
- the file type
So overall, you should need to click the export buttons once for each asset type, with some waiting in-between!
Now you need to copy only the FBX files to the directory UEAssetToolkitGenerator will output serialized assets to. To do this correctly, you can use the copy_fbx_to_cas.py Python script.
cd C:\Users\YourUser\Documents\AssetToolkit
python copy_fbx_to_cas.py .\AnimExport .\CASOutput --internalname FSD --types Anims,SMs,SKMs
The first argument is the directory containing the Anims
, SMs
and SKMs
subdirectories.
The second argument is the Result Dir
you have set in CAS.
Open the UEAssetToolkitGenerator, and check your settings:
- AnimSequence, AnimMontage, SkeletalMesh, Skeleton and StaticMesh should not be selected under
Asset Types to Skip Serializing
- All checkboxes under
Use ActorX?
should be disabled -
Force mesh JSON to have one LOD?
should be enabled
Important note: The JSON files that are output from the AnimExport
program are ONLY for skeleton reference for the Blender conversion process. They are NOT to be used for the asset generator! Likewise, the whole SKs
folder is only for the Blender conversion process!