I am working on a suite of tools to generate and render LevelSequences for reviewing AnimSequences on a variety of skeletal meshes. It is critical that the camera settings on the CineCameras in the level sequences I am creating match those of the shipping game. However, I am unable to modify certain properties in the camera component using the guidance I have found in the sequencer_examples module, in the Epic forums or in other EPS/UDN posts (see [Access to a spawnable cameras component using [Content removed]
Using the approach outlined in the create_level_sequence_with_spawnable_camera function of the sequencer_examples module means that I can only modify properties that can be exposed through tracks in sequencer, and I cannot figure out a way to add a track for non-keyable properties such as the squeeze factor in the Lens Settings, the camera focus method, or the Crop Settings Aspect Ratio.
I am unable to query the object template for the component binding (it returns None), even when opening the new level sequence in Sequencer through the script.
I have tried modifying the properties on the actor spawned in the level before converting its component to a possessable, much like in the repro steps included in this question, but the binding under the spawned camera fails to respect those values.
I have also tried to use the LevelSequenceEditorSubsystem.create_camera function, which is not ideal, because I would hope not to rely on Sequencer being open. I am able to query the component from the actor it returns and make modifications to its properties, and I can even see the values I set when I select the component. However, a soon as I save the sequence or close Sequencer and reopen it, the values are reset to default.
Steps to Reproduce
1.- Modify the example module sequencer_examples.py found in the SequencerScripting plugin to include any modification to the CineCameraComponent before converting it into a possessable. For example (insert between lines 475 and 476):
2.- Run call the modified function (create_level_sequence_with_spawnable_camera) from the Python console with any valid arguments.
3.- Open the created level sequence in the current world (do not open a new level).
4.- Notice how the camera component of the actor in the level has the correct focal length value, but the component under the spawned camera binding in Sequencer does not.
When adding and working with spawnables and you want to change the default values, not just whatever is on the track, you need to work against the template object. Spawnables use templates to store that initial data from whatever they are defined from. So in your script you can go about this two different ways.
Set the variable earlier in the script, usually doing it on the actor in the level before you add the spawnable.
sequence = unreal.AssetToolsHelpers.get_asset_tools().create_asset(asset_name, package_path, unreal.LevelSequence, unreal.LevelSequenceFactoryNew())
# Create a cine camera actor
camera_actor = unreal.EditorLevelLibrary().spawn_actor_from_class(unreal.CineCameraActor, unreal.Vector(0,0,0), unreal.Rotator(0,0,0))
camera_actor.camera_component.set_editor_property("CurrentFocalLength", 70) //Add it here.
# Add a spawnable using that cine camera actor
camera_binding = sequence.add_spawnable_from_instance(camera_actor)
//Don't add it here.
# Add a cine camera component binding using the component of the camera actor
camera_component_binding = sequence.add_possessable(camera_actor.get_cine_camera_component()) camera_component_binding.set_parent(camera_binding)
camera_component_binding.set_display_name('renamed')
They’re equally valid because the use case is dependent on what you’re doing. The example case is the simplest case of adding a camera and so that’s the primary focus of the info in that function.
For posterity’s sake, it would be great to update sequencer_examples.py to include this tip.
I agree, probably in a separate function to show how to handle spawnable information. For the most part, we recommend using possessables or replaceables now.
Thanks for the quick reply! I have tried out both of your suggestions, and they work great.
For what it’s worth, I had tried something very similar to your second suggestion but instead of template.camera_component I had use template.get_cine_camera_component() and that returned None.
Are the two approaches you outlined equally valid? Are they better suited for different situations?
For posterity’s sake, it would be great to update sequencer_examples.py to include this tip. Perhaps it’s just me, but I didn’t find it intuitive that the changes need to happen before adding the spawnable actor instead of before adding the possessable component.