You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
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]
107 lines
3.3 KiB
C++
107 lines
3.3 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
|
|
struct FGeometry;
|
|
|
|
namespace UE
|
|
{
|
|
namespace Sequencer
|
|
{
|
|
|
|
class FViewModel;
|
|
class FChannelModel;
|
|
class FSectionModel;
|
|
class FTrackModel;
|
|
|
|
/** A layout element specifying the geometry required to render a key area */
|
|
struct FSectionLayoutElement
|
|
{
|
|
/** Whether this layout element pertains to one or multiple key areas */
|
|
enum EType { Single, Group };
|
|
|
|
/** Construct this element from a grouped key area */
|
|
static FSectionLayoutElement FromGroup(const TSharedPtr<FViewModel>& InGroup, const TSharedPtr<FViewModel>& InChannelRoot, float InOffset, float InHeight);
|
|
|
|
/** Construct this element from a single Key area node */
|
|
static FSectionLayoutElement FromChannel(const TSharedPtr<FChannelModel>& InChannel, float InOffset, float InHeight);
|
|
|
|
/** Construct this element from a single Key area node */
|
|
static FSectionLayoutElement EmptySpace(const TSharedPtr<FViewModel>& InNode, float InOffset, float InHeight);
|
|
|
|
/** Retrieve the type of this layout element */
|
|
EType GetType() const;
|
|
|
|
/** Retrieve vertical offset from the top of this element's parent */
|
|
float GetOffset() const;
|
|
|
|
/** Retrieve the desired height of this element based on the specified parent geometry */
|
|
float GetHeight() const;
|
|
|
|
/** Access all the key areas that this layout element represents */
|
|
TArrayView<const TWeakPtr<FChannelModel>> GetChannels() const;
|
|
|
|
/** Access the display node that this layout element was generated for */
|
|
TSharedPtr<FViewModel> GetModel() const;
|
|
|
|
/** Computes the geometry for this layout as a child of the specified section area geometry */
|
|
FGeometry ComputeGeometry(const FGeometry& SectionAreaGeometry) const;
|
|
|
|
private:
|
|
|
|
/** Pointer to the key area that we were generated from */
|
|
TArray<TWeakPtr<FChannelModel>, TInlineAllocator<1>> WeakChannels;
|
|
|
|
/** The specific node that this key area relates to */
|
|
TWeakPtr<FViewModel> DataModel;
|
|
|
|
/** The type of this layout element */
|
|
EType Type;
|
|
|
|
/** The vertical offset from the top of the element's parent */
|
|
float LocalOffset;
|
|
|
|
/** Explicit height of the layout element */
|
|
float Height;
|
|
};
|
|
|
|
/** Class used for generating, and caching the layout geometry for a given display node's key areas */
|
|
class FSectionLayout
|
|
{
|
|
public:
|
|
|
|
/** Constructor that takes a display node, and the index of the section to layout */
|
|
FSectionLayout(TSharedPtr<UE::Sequencer::FSectionModel> SectionModel);
|
|
|
|
/** Get all layout elements that we generated */
|
|
const TArray<FSectionLayoutElement>& GetElements() const;
|
|
|
|
/** Get the desired total height of this layout */
|
|
float GetTotalHeight() const;
|
|
|
|
private:
|
|
/** Array of layout elements that we generated */
|
|
TArray<FSectionLayoutElement> Elements;
|
|
|
|
float Height;
|
|
};
|
|
|
|
/** Key funcs for using a section layout element as a key. Intentionally not supported implicitly due to performance reasons. */
|
|
struct FSectionLayoutElementKeyFuncs
|
|
{
|
|
template<typename T>
|
|
static const FSectionLayoutElement& GetSetKey(const TPair<FSectionLayoutElement, T>& Element)
|
|
{
|
|
return Element.Key;
|
|
}
|
|
|
|
static bool Matches(const FSectionLayoutElement& A, const FSectionLayoutElement& B);
|
|
static uint32 GetKeyHash(const FSectionLayoutElement& Key);
|
|
};
|
|
|
|
} // namespace Sequencer
|
|
} // namespace UE
|
|
|