TSharedPtr<ISequencer>& FWidgetBlueprintEditor::GetSequencer() { if(!Sequencer.IsValid()) { FSequencerViewParams ViewParams( TEXT( "UMGSequencerSettings" ) ); ViewParams.InitalViewRange = TRange<float>(-0.02f, 3.2f); ViewParams.InitialScrubPosition = 0; ViewParams.OnGetAddMenuContent = FOnGetAddMenuContent::CreateSP(this, &FWidgetBlueprintEditor::OnGetAnimationAddMenuContent); SequencerObjectBindingManager = MakeShareable(new FUMGSequencerObjectBindingManager(*this, *UWidgetAnimation::GetNullAnimation())); Sequencer = FModuleManager::LoadModuleChecked< ISequencerModule >("Sequencer").CreateSequencer(UWidgetAnimation::GetNullAnimation()->MovieScene, ViewParams, SequencerObjectBindingManager.ToSharedRef()); ChangeViewedAnimation(*UWidgetAnimation::GetNullAnimation()); } return Sequencer; }
void FNiagaraEffectEditor::InitNiagaraEffectEditor(const EToolkitMode::Type Mode, const TSharedPtr< class IToolkitHost >& InitToolkitHost, UNiagaraEffect* InEffect) { Effect = InEffect; check(Effect != NULL); EffectInstance = new FNiagaraEffectInstance(InEffect); const float InTime = -0.02f; const float OutTime = 3.2f; if (!Sequencer.IsValid()) { MovieScene = NewObject<UMovieScene>(InEffect, FName("Niagara Effect MovieScene"), RF_RootSet); auto NewAnimation = NewObject<UNiagaraSequence>(MovieScene); MovieScene->StartTime = InTime; MovieScene->InTime = InTime; MovieScene->OutTime = OutTime; MovieScene->EndTime = OutTime; NewAnimation->MovieScene = MovieScene; FSequencerViewParams ViewParams(TEXT("NiagaraSequencerSettings")); { ViewParams.InitalViewRange = TRange<float>(InTime, OutTime); ViewParams.InitialScrubPosition = 0; } FSequencerInitParams SequencerInitParams; { SequencerInitParams.ViewParams = ViewParams; SequencerInitParams.RootSequence = NewAnimation; SequencerInitParams.bEditWithinLevelEditor = false; SequencerInitParams.ToolkitHost = nullptr; } ISequencerModule &SeqModule = FModuleManager::LoadModuleChecked< ISequencerModule >("Sequencer"); FDelegateHandle CreateTrackEditorHandle = SeqModule.RegisterTrackEditor_Handle(FOnCreateTrackEditor::CreateStatic(&FNiagaraEffectEditor::CreateTrackEditor)); Sequencer = SeqModule.CreateSequencer(SequencerInitParams); for (TSharedPtr<FNiagaraSimulation> Emitter : EffectInstance->GetEmitters()) { UEmitterMovieSceneTrack *Track = Cast<UEmitterMovieSceneTrack> (MovieScene->AddMasterTrack(UEmitterMovieSceneTrack::StaticClass()) ); Track->SetEmitter(Emitter); } } TSharedRef<FTabManager::FLayout> StandaloneDefaultLayout = FTabManager::NewLayout("Standalone_Niagara_Effect_Layout_v7") ->AddArea ( FTabManager::NewPrimaryArea()->SetOrientation(Orient_Vertical) ->Split ( FTabManager::NewStack() ->SetSizeCoefficient(0.1f) ->AddTab(GetToolbarTabId(), ETabState::OpenedTab) ->SetHideTabWell(true) ) ->Split ( FTabManager::NewSplitter()->SetOrientation(Orient_Horizontal) ->Split ( FTabManager::NewStack() ->SetSizeCoefficient(0.1f) ->AddTab(ViewportTabID, ETabState::OpenedTab) ) ->Split ( FTabManager::NewStack() ->SetSizeCoefficient(0.3f) ->AddTab(EmitterEditorTabID, ETabState::OpenedTab) ->AddTab(DevEmitterEditorTabID, ETabState::OpenedTab) ) ) ->Split ( FTabManager::NewStack() ->SetSizeCoefficient(0.3f) ->AddTab(CurveEditorTabID, ETabState::OpenedTab) ->AddTab(SequencerTabID, ETabState::OpenedTab) ) ); const bool bCreateDefaultStandaloneMenu = true; const bool bCreateDefaultToolbar = true; FAssetEditorToolkit::InitAssetEditor(Mode, InitToolkitHost, FNiagaraEditorModule::NiagaraEditorAppIdentifier, StandaloneDefaultLayout, bCreateDefaultStandaloneMenu, bCreateDefaultToolbar, Effect); FNiagaraEditorModule& NiagaraEditorModule = FModuleManager::LoadModuleChecked<FNiagaraEditorModule>("NiagaraEditor"); AddMenuExtender(NiagaraEditorModule.GetMenuExtensibilityManager()->GetAllExtenders(GetToolkitCommands(), GetEditingObjects())); ExtendToolbar(); RegenerateMenusAndToolbars(); }