Files
UnrealEngineUWP/Engine/Source/Editor/CurveTableEditor/Private/CurveTableEditorHandle.h
Louise Rasmussen 24d436a1f1 Curve Table Editor Undo / Redo
- also fixes memory leak

#JIRA UETOOL-3357
#rb Lauren.Barnes
#preflight 618c0571b253729fe22756ae

[CL 18140736 by Louise Rasmussen in ue5-main branch]
2021-11-10 18:16:07 -05:00

62 lines
1.7 KiB
C

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "Curves/CurveOwnerInterface.h"
#include "UObject/WeakObjectPtr.h"
#include "Engine/CurveTable.h"
/**
* Handle to a particular row in a table, used for editing individual curves
*/
struct FCurveTableEditorHandle : public FCurveOwnerInterface
{
FCurveTableEditorHandle()
: CurveTable(nullptr)
, RowName(NAME_None)
{ }
FCurveTableEditorHandle(UCurveTable* InCurveTable, FName InRowName)
: CurveTable(InCurveTable)
, RowName(InRowName)
{ }
/** Pointer to table we want a row from */
TWeakObjectPtr<UCurveTable> CurveTable;
/** Name of row in the table that we want */
FName RowName;
//~ Begin FCurveOwnerInterface Interface.
virtual TArray<FRichCurveEditInfoConst> GetCurves() const override;
virtual TArray<FRichCurveEditInfo> GetCurves() override;
virtual void ModifyOwner() override;
virtual void MakeTransactional() override;
virtual void OnCurveChanged(const TArray<FRichCurveEditInfo>& ChangedCurveEditInfos) override;
virtual bool IsValidCurve(FRichCurveEditInfo CurveInfo) override;
virtual TArray<const UObject*> GetOwners() const override;
//~ End FCurveOwnerInterface Interface.
/** Returns true if the curve is valid */
bool IsValid() const
{
return (GetCurve() != nullptr);
}
/** Returns true if this handle is specifically pointing to nothing */
bool IsNull() const
{
return CurveTable == nullptr && RowName == NAME_None;
}
/** Get the curve straight from the row handle */
FRealCurve* GetCurve() const;
FRichCurve* GetRichCurve() const;
/** Returns true if the owning table uses RichCurves instead of Real Curves */
bool HasRichCurves() const;
};