-
Notifications
You must be signed in to change notification settings - Fork 272
Support exporting UE mannequin bone coordinate #175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support exporting UE mannequin bone coordinate #175
Conversation
6ecbde3 to
7ae0d43
Compare
|
I'm very busy currently with the game and I only see now your Pull request. Thanks you very much for you work on the addon. |
|
I thought it was complete, so I was planning to submit a Pull Request. However, I discovered an issue with the animation export, so I'm currently working on fixing it. As there is currently no immediate prospect of resolving the issue, this Pull Request may need to be withdrawn. |
|
You want speak about ? You can contact me on Discord @Bleuraven |
|
Hello, I made several changes in the dev branch. I committed some fixes to resolve conflicts. |
6921e9a to
8a01778
Compare
Fix shape animation exporting bug Fix script reload failure Fix typo
8a01778 to
37a23bf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- fbxio\data_types.py
- fbxio\encode_bin.py
- fbxio\export_fbx_bin.py
- fbxio\fbx_utils.py
these are modified version of Blender's fbx importer/exporter addon located at 'Blender 3.6/3.6/scripts/addons/io_scene_fbx'
| **.blend30 | ||
| **.blend31 | ||
| **.blend32 | ||
| **.blend[1-9]* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By doing this, you can ignore not only .blender1~.blender32, but also blender999 or any other backup files. It will also ignore patterns that are not just numbers, such as .blend1foo, but that should not be a problem in practice.
| BFU_AP_UI_UTILS, | ||
| BFU_AP_UI_UTILS.BFU_OT_OpenDocumentationTargetPage, | ||
| BFU_AP_UI_UTILS.BFU_OT_OpenDocumentationTargetExportPage | ||
| BFU_OT_OpenDocumentationTargetPage, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This 'BFU_AP_UI_UTILS' class blocks script reloading.
I remove it simply because BFU_AP_UI_UTILS has no effect.
| if "bpy" in locals(): | ||
| import importlib | ||
| if "bfu_export_utils" in locals(): | ||
| importlib.reload(bfu_export_utils) | ||
| if "bbpl" in locals(): | ||
| importlib.reload(bbpl) | ||
| if "bfu_basics" in locals(): | ||
| importlib.reload(bfu_basics) | ||
| if "bfu_utils" in locals(): | ||
| importlib.reload(bfu_utils) | ||
| if "export_fbx_bin" in locals(): | ||
| importlib.reload(export_fbx_bin) | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is still needed for script reloading
may be
| my_action_curve_scale = bfu_utils.ActionCurveScale(rrf*active.scale.z) | ||
| my_action_curve_scale.ResacleForUnrealEngine() | ||
| if not action_curve_scale: | ||
| action_curve_scale = bfu_utils.ActionCurveScale(rrf*active.scale.z) | ||
| action_curve_scale.ResacleForUnrealEngine() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When there are many Actions, the process of scaling all Actions for each Action export and then returning them to their original scale was very slow, so I made it so that it only do once.
|
@xavier150 |
|
Wow that a crazy work! Thank you very much @SAM-tak for your work <3 and sorry for the delay. |
Overview
This pull request supports exporting models and animations with the Unreal Mannequin bone structure from Blender.
Also, it supports exporting Blender's custom property animation in a format that Unreal Engine can recognize as curve data animation.
To achieve these, we decided to include a modified version of the Blender standard fbx I/O api, instead of using the original one.
The UE Mannequin's bone structure
Basically, the X-axis positive direction is the bone direction, but the right side of the body is inverted on all axes compared to the corresponding left side.
In addition, the pelvis bone and foot bone have the X-axis pointing straight up. (The right foot is further inverted, so the X-axis points straight down)
Also, for some reason, the thigh bone and calf bone have the opposite direction of the bone direction as the X-axis on the left side, and the right side is inverted, so the bone direction is the negative X-axis.
Thus, depending on the part, the correspondence between the bone direction and the transform coordinate axis is different, and it is difficult to handle in Blender, where you cannot set the bone direction and transform coordinate axis independently.
New export options
Revert direction of symmetry right side bones
As described above, in UE, the right side bones are inverted on all axes compared to the left side, so this is an option to invert the coordinate axes of the right side bones.
Even if compatibility with Mannequin is not important, this option is useful if you want to use the 'Mirror' function of the Physics Asset Editor, which assumes that the corresponding opposite side bones have all axes inverted.
Apply bone alignments similar to UE Mannequin
Furthermore, it applies the hierarchy-specific alignment process mentioned earlier. That is, it makes the thigh and calf bones face the opposite direction, and the pelvis and foot bones face straight up.
This can only be enabled if 'Revert direction of symmetry right side bones' is enabled.
Disable non-uniform scale animation
UE does not support bone animation with individual scale values for each XYZ axis ('non-uniform') by default.
You can enable it by checking the 'Preserve Local Transform' option in the import settings, but it is better not to use it as it may cause performance issues or other problems.
However, in some cases, such as animations generated by Visual Keying for animation retargeting, you may unintentionally end up with non-uniform scale animations. Stretch bone constraints can also cause these unintended non-uniform scale animations.
And it occurs taking a posture that is 180 degrees inverted from what you see in Blender, as shown below.
I thought this was a bug in the 'Apply bone alignments similar to UE Mannequin' feature, so I kept this pull request in Draft for a long time. In fact, it was a phenomenon related to the animation specification of UE, and it was not a bug.
By turning on this feature, you can force a uniform scale value when exporting, instead of correcting non-uniform scale values.
Export custom properties animation to Curves UE readable
In 'Preferences > Add-ons > Import-Export: Beldner for Unreal' Panel,
If check this 'Export custom properties' check box, add-on export custom properties animation to curve data that UE readable.