// Copyright Epic Games, Inc. All Rights Reserved. #pragma once #include "Containers/Map.h" #include "HAL/Platform.h" #include "Misc/Optional.h" #include "Curves/KeyHandle.h" #include "Templates/SharedPointer.h" #include "MVVM/ViewModels/ChannelModel.h" #include "MVVM/ViewModelPtr.h" namespace UE::Sequencer { class FViewModel; } enum class ESelectionPreviewState { Undefined, Selected, NotSelected }; /** * Manages the selection of keys, sections, and outliner nodes for the sequencer. */ class FSequencerSelectionPreview { public: /** Access the defined key states */ const TMap& GetDefinedKeyStates() const { return RawDefinedKeyStates; } /** Access the defined model states */ const TMap, ESelectionPreviewState>& GetDefinedModelStates() const { return DefinedModelStates; } /** Adds a key to the selection */ void SetSelectionState(const UE::Sequencer::TWeakViewModelPtr& Channel, FKeyHandle Key, ESelectionPreviewState InState); /** Adds a model to the selection */ void SetSelectionState(TWeakPtr InModel, ESelectionPreviewState InState); /** Returns the selection state for the the specified key. */ ESelectionPreviewState GetSelectionState(FKeyHandle Key) const; /** Returns the selection state for the the specified model. */ ESelectionPreviewState GetSelectionState(TWeakPtr InModel) const; /** Finds the channel associated with the specified key. */ UE::Sequencer::TViewModelPtr GetChannelForKey(FKeyHandle KeyHandle) const; /** Empties all selections. */ void Empty(); /** Empties the key selection. */ void EmptyDefinedKeyStates(); /** Empties the model selection. */ void EmptyDefinedModelStates(); /** Hash the contents of this selection preview. */ uint32 GetSelectionHash() const; private: TMap> KeyHandleToModel; TMap RawDefinedKeyStates; TMap, ESelectionPreviewState> DefinedModelStates; /** Cached hash of this whole selection preview state. */ mutable TOptional CachedSelectionHash; };