Does anyone know if it’s possible to get the focal length to import from an fbx onto a camera that exists(as a spawnable) in sequencer?
I’ve never written python code before but I’m attempting to make a UI for importing animation, and building sequences. I’ve got pretty much everything working, except I can’t get focal length animation to import onto a camera in sequencer. I can get translation animation to import, but not focal length. I’m guessing it has something to do with the fact that the focal length attribute is on the CameraComponent, or maybe unreal.SequencerTools.import_fbx() doesn’t read focal length from the fbx? I dunno…
Another weird thing is that the ‘reduce_keys’ property of unreal.MovieSceneUserImportFBXSettings() just gets ignored, whether True or False. All the other properties work, but that one doesn’t. If I manually import a camera before running my script, my script will use whatever the property was set at during the manual import. I guess I can live with this, but it’s a bit weird.
Here is the code I am using to import camera animation. Am I doing something incorrectly?:
import unreal world = unreal.EditorLevelLibrary.get_editor_world() sequencer_asset_path = '/Game/Sequences/CameraTest_seq' sequence = unreal.load_asset(sequencer_asset_path) input_file = 'D:/PretendDirectory/Animation/camera.fbx' # Set camera's import options def import_camera_FBX(): import_options = unreal.MovieSceneUserImportFBXSettings() import_options.set_editor_property('create_cameras', False) import_options.set_editor_property('force_front_x_axis', False) import_options.set_editor_property('match_by_name_only', False) import_options.set_editor_property('reduce_keys', False) import_options.set_editor_property('reduce_keys_tolerance', 0.001) return import_options # Find the camera bindings in the sequence def camera_bindings(): bindings = sequence.get_bindings() return bindings # unreal.SequencerTools.import_fbx(world, sequence, bindings, import_fbx_settings, import_filename) unreal.SequencerTools.import_fbx(world, sequence, camera_bindings(), import_camera_FBX(), input_file)