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

43 lines
1.0 KiB
C
Raw Normal View History

2022-05-23 18:41:30 +00:00
// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "Templates/UnrealTemplate.h"
#include "UObject/WeakObjectPtrTemplates.h"
#include "UObject/ObjectKey.h"
#include "GameSettingFilterState.h"
class UGameSettingRegistry;
class UGameSetting;
/**
*
*/
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;
};