Add CameraComponent in Sequencer

I am trying to add the Camera actor and its component to the sequencer.

UCameraComponent* CineCameraComponent = CineCameraActor->GetCameraComponent();
FGuid ComponentGuid = LevelMovieScene->AddPossessable(TEXT("CameraComponent"), CineCameraComponent->GetClass());
FGuid CineCameraGUID = LevelMovieScene->AddPossessable(CineCameraActor->GetActorLabel(), CineCameraActor->GetClass());	
FMovieScenePossessable* CineCameraComponentPossesable = LevelMovieScene->FindPossessable(ComponentGuid);	
LevelSequenceAsset->BindPossessableObject(CineCameraGUID, *CineCameraActor, CineCameraActor->GetWorld());
LevelSequenceAsset->BindPossessableObject(ComponentGuid, *CineCameraComponent, CineCameraActor->GetWorld());

The above code adds both the objects as separate possesable objects. And the binding to the component isnt lost. When I set the parent as : CineCameraComponentPossesable->SetParent(CineCameraGUID). The CameraComponent in sequencer shows red text “The object bound to this track is missing”.
Is there anything wrong with the above approach.?

That seems to work for me. I used your exact code and put the SetParent at the end and the binding wasn’t red for me. The only extra thing I did was to call this so that the sequencer tracks refresh (if you don’t have this, you’ll probably need to close and reopen your sequence)

NotifyMovieSceneDataChanged( EMovieSceneDataChangeType::MovieSceneStructureItemAdded );

I did it like this :

FAssetEditorManager& AssetEditorManager = FAssetEditorManager::Get();

AssetEditorManager.OpenEditorForAsset(LevelSequenceAsset);

CineCameraComponentPossesable->SetParent(CineCameraGUID);

IAssetEditorInstance* AssetEditor = FAssetEditorManager::Get().FindEditorForAsset(LevelSequenceAsset, true);

FLevelSequenceEditorToolkit* LevelSequenceEditor = (FLevelSequenceEditorToolkit*)AssetEditor;

if (LevelSequenceEditor != nullptr)

{
ISequencer* Sequencer = LevelSequenceEditor->GetSequencer().Get();

Sequencer->NotifyMovieSceneDataChanged (EMovieSceneDataChangeType::MovieSceneStructureItemAdded);

}

Still doesnt work. I still get the reference error.

Not sure. I stuck your original code, plus the SetParent and the NotifyMovieSceneDataChanged into one of the functions in FSequencer to test and it worked fine for me.

If you want to package up your code, I’ll try to take a look.

I’m not sure that the NotifyMovieSceneDataChanged is the problem here. That function is used to update the sequencer display when data changes. If you close sequencer and reopen, it’ll effectively reinitialize based on the data.

So, in your case, if the level sequence asset you’re building isn’t already loaded in sequencer, calling NotifyMovieSceneDataChanged won’t solve your problems. One way to test whether this is your problem is to create the asset you need, save it, close any sequencer you have open, and reopen that asset. If the binding still shows red, the issue lies somewhere in the AddPossessable, BindPossessable, SetParent combinations…

I am implementing the sequencer functionality within an editor module in a plugin. I need to be able to call the NotifyMovieSceneDataChanged from within my own class and functions. How can I do that? I would appreciate the help.

Took another path. Following line did the trick without having to AddPossessable/BindPossessable/SetParent.

Sequencer->GetHandleToObject(CineCameraComponent);

It exposed the CameraComponent in the sequencer.

So how can I get the properties like Current Focal Length in sequencer for the component.?

It should be like this:

UMovieSceneFloatTrack* FloatTrack = LevelMovieScene->AddTrack(ComponentGuid);
FloatTrack->SetPropertyNameAndPath(TEXT("CurrentFocalLength"), TEXT("CurrentFocalLength"));

i’m having pretty much the same problem as the OP. I was going to open a new thread but my code is so close to his and it seems that there is something I must be missing with SetParent. I did try pasting the code above but no dice. I’ve tried about 6 other ways as well to try to get the component to show up properly in the sequencer under the actor. The change notification on the sequencer did help but the component is still unbound and red while the actor is now showing bound properly.