Closed tpoveda closed 11 months ago
The objective is simple, being able to export an Unreal Camera into an FBX, so we can import it again into other DCCs such us Maya.
This can be done manually by opening a Level Sequence into the Sequencer and then going into Actions -> Export...
This operation will export a FBX file that can be imported into Maya and will keep the animations in both the transform and the specific animated camera properties (such as the focal lenght).
API Documentation: https://docs.unrealengine.com/5.1/en-US/PythonAPI/class/SequencerTools.html
Unreal Python API exposes a function called unreal.SequencerTools.export_level_sequence_fbx
that allows to export specific sequence binding and tracks into an FBX file.
In the Unreal Engine Python API examples located here: C:\Program Files\Epic Games\UE_5.1\Engine\Plugins\MovieScene\SequencerScripting\Content\Python
there are some examples about how to use Sequencer Python API within sequencer_fbx_examples.py
file.
Within Unreal, you can execute the following code to export a Sequence into a FBX file:
import sequencer_fbx_examples
sequencer_fbx_examples.export_fbx("/Game/Assets/Levels/Showcase","/Game/Assets/Cinematics/shot0010_001", "/Game/Assets/Cinematics/SequenceMaster", "E:\\uegear\\FBX_Test.fbx")
In this example, the shot has a camera binding with some tracks for the camera:
If you try to import the generated FBX into Maya you will notice that the generated FBX contains a transform one for each one of the animated tracks. This information is not useful.
All the functionality used to export Cameras using the Sequencer UI (throug the Actions -> Export... option) can be found in the following file: C:\Program Files\Epic Games\UE_5.1\Engine\Source\Editor\Sequencer\Private\Sequencer.cpp
More specifically in the function called ExportFBX
.
We tried to implement it in the following way:
For now, I would wait until Epic Games exposes this functionality into the Unreal Python API. Meanwhile, as a temporal workaround, I would include an option into Maya ueGear that can automatically import an FBX camera previsouly exported by the user manually.
From working with Sequencer before, I think that this data is available, but it gets nested quite heavily into the clip information.
You can access the Current Level Sequence by
unreal.LevelSequenceEditorBlueprintLibrary
From there you have to handle each clip and the timeline. This is where is can get a bit complicated with juggling clip data.
Did some testing regarding the FBX export.
Note: As the exported data is only the camera data, Maya does not know the star and end frame of the LevelSequence shot. This data would need to be exported as some sort of accompanying xml
or json
.
There are also 3 types of possible Camera Tracks
Example image below, showing of animated Camera data in the level sequence.
We will need to capture every camera and check which correlates to the imported/Exported Maya Camera, so we can update it correctly.
Using Unreal 5.2
, Maya 2024
and FBX 2020
The following is a manual export of Asset and Camera, with animated transform and focal length.
File > Export Selected
Right Click Menu > Export
Both seem to be matching:
left: Maya Viewport right: Unreal Viewport
If you try and export a Instance Camera
from the Sequencer
, and the timeline is not on or over a section of the Spawnable Camera Clip, in other words, no Camera has been spawned in the Level. Then exporting the camera will result in a Component Like
export. where the imported FBX file in maya will generate multiple groups instead of a camera.
Active Range
(Green and Red Lines)This looks to be completed by the following PRs mGear: https://github.com/mgear-dev/mgear4/pull/281 ueGear: https://github.com/mgear-dev/ueGear/pull/5
Send material data from Maya to Unreal.Send material data from Unreal to Maya.Send texture data from Maya to Unreal.Send texture data from Unreal to Maya.