Hello,
We’ve been seeing an issue where the editor mode would be reset after deleting a loaded Level Instance from the world.
I tracked it down to:
UnrealEditor-UnrealEd.dll!FEditorModeTools::ActivateDefaultMode() Line 750 C++
UnrealEditor-MovieSceneTools.dll!FSubTrackEditor::OnInitialize() Line 710 C++
UnrealEditor-Sequencer.dll!FSequencer::InitSequencer(const FSequencerInitParams & InitParams, const TSharedRef<ISequencerObjectChangeListener,1> & InObjectChangeListener, const TArray<TDelegate<TSharedRef<ISequencerTrackEditor,1> __cdecl(TSharedRef<ISequencer,1>),FDefaultDelegateUserPolicy>,TSizedDefaultAllocator<32>> & TrackEditorDelegates, const TArray<TDelegate<TSharedRef<ISequencerEditorObjectBinding,1> __cdecl(TSharedRef<ISequencer,1>),FDefaultDelegateUserPolicy>,TSizedDefaultAllocator<32>> & EditorObjectBindingDelegates, const TArray<TDelegate<TSharedRef<UE::Sequencer::IOutlinerColumn,1> __cdecl(void),FDefaultDelegateUserPolicy>,TSizedDefaultAllocator<32>> & OutlinerColumnDelegates, const TArray<TDelegate<TSharedRef<UE::Sequencer::IOutlinerIndicatorBuilder,1> __cdecl(void),FDefaultDelegateUserPolicy>,TSizedDefaultAllocator<32>> & OutlinerIndicatorDelegates) Line 751 C++
UnrealEditor-Sequencer.dll!FSequencerModule::CreateSequencer(const FSequencerInitParams & InitParams) Line 299 C++
UnrealEditor-DaySequenceEditor.dll!FDaySequenceEditorToolkit::InitializeInternal(const EToolkitMode::Type Mode, const TSharedPtr<IToolkitHost,1> & InitToolkitHost, const FSequencerInitParams & SequencerInitParams, TSharedRef<FDaySequenceEditorSpawnRegister,1> & SpawnRegister) Line 301 C++
UnrealEditor-DaySequenceEditor.dll!FDaySequenceEditorToolkit::InitializeActorPreview(const EToolkitMode::Type Mode, const TSharedPtr<IToolkitHost,1> & InitToolkitHost, ADaySequenceActor * InDayActor) Line 272 C++
> UnrealEditor-DaySequenceEditor.dll!FDaySequenceActorPreview::EnablePreview(bool bEnable) Line 196 C++
UnrealEditor-DaySequenceEditor.dll!FDaySequenceActorPreview::Tick(float DeltaTime) Line 464 C++
It seemed a bit strange, so I looked into when the preview is re-created and spotted FDaySequenceActorPreview::OnWorldCleanup.
I’m not very familiar with the plugin, so was wondering if there’s a reason we’re clearing the preview regardless of the world that got cleaned up? The preview actor exists in our main world so I’m not sure if resetting the preview state when deleting a LI from the world makes sense. But since I could be missing something, I thought I’d reach out and ask.
I’m considering making the following change:
void FDaySequenceActorPreview::OnWorldCleanup(UWorld* World, bool bSessionEnded, bool bCleanupResources)
{
if (!World || World->WorldType == EWorldType::Editor)
{
return;
}
const ADaySequenceActor* DaySequenceActorPtr = DaySequenceActor.Get();
const UWorld* DaySequenceOwningWorld = DaySequenceActorPtr ? DaySequenceActorPtr->GetWorld() : nullptr;
if (!DaySequenceOwningWorld || DaySequenceOwningWorld != World)
{
// No need to reset the preview state
return;
}
EnablePreview(false);
}
Kind Regards,
Ivo