DarklightGames / io_scene_psk_psa

A Blender extension for importing and exporting Unreal PSK and PSA files
GNU General Public License v3.0
378 stars 24 forks source link

Can't import PSA to armature due to bones not existing in the animation #46

Closed CraftPig closed 1 year ago

CraftPig commented 1 year ago

Screenshot 2023-09-01 000925

Title says it all, just simply state the solution and or workaround so others may troubleshoot quickly. I haven't found any good resources in the past few hours to fix this and it was never a problem with other PSA/PSK plugins.

cmbasnett commented 1 year ago

This seems like you might not have selected the actions you wanted to import from the list on the import dialog. You must explicitly choose the sequences you want imported.

cmbasnett commented 1 year ago

@CraftPig Are you still unable to resolve the issue on your end?

CraftPig commented 1 year ago

Same error, I simply imported the model and tried to add a sequence while also having the action I wanna add selected.

Edit: Yeah no, ive tinkered around for longer and the result was the same.

cmbasnett commented 1 year ago

Can you send over the PSK and PSA combo so I can try it here?

CraftPig commented 1 year ago

Some of them were from UE 4.21 games and exported from UModel instead of FModel but point is it worked just fine on previous plugins I used. PSK&PSA.zip

cmbasnett commented 1 year ago

It seems that the issue is that the PSA files from FModel are technically malformed due to a bug in the underlying library it uses for exporting the PSA files (CUE4Parse).

image

All of the key data is stored in a big data section that the sequences index into with an offset. The problem is that CUE4Parse writes incorrect data to the offset, resulting in buffer underflow errors as seen above. In practice, the value is unimportant since the offsets can be calculated after-the-fact. It is however, incorrect, and creates compatibility issues.

I verified this by manually correcting the data in the file and was able to import the animation just fine:

image

I have reported a bug on the CUE4Parse project (https://github.com/FabianFG/CUE4Parse/issues/103), but I can come up with a workaround that will detect the bad data and correct it automatically. I will release a patch to address this within the week.

P.S. I am able to import the animations for SK_Troy just fine, though. This makes sense as it was exported with UModel.

image

cmbasnett commented 1 year ago

@CraftPig A patch for handling the malformed files has been added to the latest version (5.0.5). Thank you for reporting the issue!

The bug in CUE4Parse has also been fixed (https://github.com/FabianFG/CUE4Parse/pull/104), so this handling will be eventually removed.