Files
UnrealEngineUWP/Engine/Source/Editor/Sequencer/Private/DisplayNodes/SequencerKeyTimeCache.h
Max Chen 0167d4ea0f Sequencer: MVVM2 branch and Layer Bars
Copying //Tasks/UE5/Dev-SequencerMVVM2 to Main (//UE5/Main) @20364093

#preflight 628866dfb94f739b152c1e29
#preflight 628866e4585e8f793ee80943
#rb ludovic.chabant, andrew.rodham
#fyi ludovic.chabant, andrew.rodham, andrew.porter
#jira UE-105322

[CL 20364493 by Max Chen in ue5-main branch]
2022-05-25 10:39:33 -04:00

61 lines
1.7 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "Math/Range.h"
#include "Misc/Guid.h"
#include "Containers/ArrayView.h"
#include "Curves/KeyHandle.h"
#include "Templates/SharedPointer.h"
#include "Misc/Optional.h"
#include "IKeyArea.h"
#include "Misc/FrameRate.h"
namespace UE
{
namespace Sequencer
{
class FChannelModel;
}
}
/** Simple structure that caches the sorted key times for a given key area */
struct FSequencerCachedKeys
{
FSequencerCachedKeys(TSharedPtr<UE::Sequencer::FChannelModel> InChannel)
: WeakChannel(InChannel)
{}
/**
* Update this cache to store key times and handles from the specified key area
* @return true if this cache was updated, false if it was already up to date
*/
bool Update(FFrameRate SourceResolution);
/** Get an view of the cached array for keys that fall within the specified range */
void GetKeysInRange(const TRange<double>& Range, TArrayView<const double>* OutTimes, TArrayView<const FFrameNumber>* OutKeyFrames, TArrayView<const FKeyHandle>* OutHandles) const;
/** Get the key area this cache was generated for, or nullptr if the cache has never been updated */
TSharedPtr<UE::Sequencer::FChannelModel> GetChannel() const
{
return WeakChannel.Pin();
}
private:
/** Cached key information */
TArray<double> CachedKeyTimes;
TArray<FFrameNumber> CachedKeyFrames;
TArray<FKeyHandle> CachedKeyHandles;
/** The guid with which the above array was generated */
FGuid CachedSignature;
/** The tick resolution of the sequence that this cache was generated with */
FFrameRate CachedTickResolution;
/** The key area this cache is for */
TWeakPtr<UE::Sequencer::FChannelModel> WeakChannel;
};