RealtimeStyleTransferRuntime/Plugins/GameSettings/Source/Public/GameSettingRegistryChangeTr...

45 lines
1.1 KiB
C
Raw Permalink Normal View History

2022-05-23 18:41:30 +00:00
// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
2022-09-13 07:18:28 +00:00
#include "Containers/Map.h"
#include "GameSettingFilterState.h"
2022-05-23 18:41:30 +00:00
#include "Templates/UnrealTemplate.h"
#include "UObject/ObjectKey.h"
2022-09-13 07:18:28 +00:00
#include "UObject/WeakObjectPtrTemplates.h"
2022-05-23 18:41:30 +00:00
class UGameSetting;
2022-09-13 07:18:28 +00:00
class UGameSettingRegistry;
struct FObjectKey;
2022-05-23 18:41:30 +00:00
/**
*
*/
class GAMESETTINGS_API FGameSettingRegistryChangeTracker : public FNoncopyable
{
public:
FGameSettingRegistryChangeTracker();
~FGameSettingRegistryChangeTracker();
void WatchRegistry(UGameSettingRegistry* InRegistry);
void StopWatchingRegistry();
void ApplyChanges();
void RestoreToInitial();
void ClearDirtyState();
bool IsRestoringSettings() const { return bRestoringSettings; }
bool HaveSettingsBeenChanged() const { return bSettingsChanged; }
private:
void HandleSettingChanged(UGameSetting* Setting, EGameSettingChangeReason Reason);
bool bSettingsChanged = false;
bool bRestoringSettings = false;
TWeakObjectPtr<UGameSettingRegistry> Registry;
TMap<FObjectKey, TWeakObjectPtr<UGameSetting>> DirtySettings;
};