Files
UnrealEngineUWP/Engine/Source/Runtime/InteractiveToolsFramework/Public/InteractiveToolsSelectionStoreSubsystem.h
michael balzer 5a20a5e3d0 Move InteractiveToolsFramework and GeometryFramework out of Experimental
#jira UETOOL-3823
#rb brooke.hubert
#preflight 6109d1e9b4288d0001acb7ef

#ROBOMERGE-SOURCE: CL 17055606 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v850-17047176)

[CL 17055619 by michael balzer in ue5-release-engine-test branch]
2021-08-04 13:59:17 -04:00

85 lines
2.4 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "InteractiveToolStorableSelection.h"
#include "Subsystems/EngineSubsystem.h"
#include "InteractiveToolsSelectionStoreSubsystem.generated.h"
class FSubsystemCollectionBase;
/**
* Stores an arbitrary storable selection object so that it can be accessed across
* tools, modes, and potentially asset editors.
* When possible, this subsystem should be accessed through a relevant api class (for instance, through
* a tool manager), so that if the implementation changes, changes will be constrained to the api class.
*
* Note that because engine subsystems get initialized on module load, InteractiveToolsFramework
* must be loaded for the subsystem to work.
*/
UCLASS()
class INTERACTIVETOOLSFRAMEWORK_API UInteractiveToolsSelectionStoreSubsystem : public UEngineSubsystem
{
GENERATED_BODY()
public:
// These classes are currently not used- they are a space to add parameters if we decide to change
// the operation of this subsystem. Don't use them.
struct FStoreParams
{};
struct FRetrieveParams
{};
struct FClearParams
{};
virtual void Initialize(FSubsystemCollectionBase& Collection) override
{
// We support being called Modify() on and being part of undo transactions.
SetFlags(RF_Transactional);
}
virtual void Deinitialize() override
{
ClearStoredSelection();
}
/**
* Sets the current selection object.
*
* @param StorableSelection Pointer to hold on to.
* @param Params Currently not used, kept to make future changes easier.
*/
void SetStoredSelection(const UInteractiveToolStorableSelection* StorableSelection,
const FStoreParams& Params = FStoreParams())
{
StoredSelection = StorableSelection;
}
/**
* Removes the hold on the current selection object.
*
* @param Params Currently not used, kept to make future changes easier.
*/
void ClearStoredSelection(const FClearParams& Params = FClearParams())
{
StoredSelection = nullptr;
}
/**
* Retrieves a pointer to the currently stored selection object.
*
* @param Params Currently not used, kept to make future changes easier.
*/
const UInteractiveToolStorableSelection* GetStoredSelection(const FRetrieveParams& Params = FRetrieveParams()) const
{
return StoredSelection;
}
private:
UPROPERTY()
TObjectPtr<const UInteractiveToolStorableSelection> StoredSelection = nullptr;
};