Files
UnrealEngineUWP/Engine/Source/Editor/PropertyEditor/Private/DetailsViewConfig.h
sebastian nordgren 8eafe4f70e Editor configs now correctly diff against the CDO when serializing.
Previously, I had assumed that FProperty::InitializeValue() would initialize a simple member (eg. a float) to the correct value, but this appears not to be the case, rather values are zero-initialized and the CDO stores the correct default values. In the case of structs, InitializeStruct() does in fact initialize correctly.

However, this means that we can't use GetMutableDefault() to get an instance of the UObject, since then we're changing what we're diffing against and serialize no values. Changed the usages of this pattern to use singletons instead.

#jira UE-141150
#review-19900014 @lauren.barnes, @aditya.ravichandran
#preflight 6267fa44a021c91a50f26a65

[CL 19919719 by sebastian nordgren in ue5-main branch]
2022-04-26 10:20:56 -04:00

84 lines
1.8 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "EditorConfigBase.h"
#include "DetailsViewConfig.generated.h"
USTRUCT()
struct FDetailsSectionSelection
{
GENERATED_BODY()
public:
UPROPERTY()
TSet<FName> SectionNames;
};
USTRUCT()
struct FDetailsViewConfig
{
GENERATED_BODY()
public:
/** If we should show the favorites category. */
UPROPERTY()
bool bShowFavoritesCategory { false };
/** When enabled, the Advanced Details will always auto expand. */
UPROPERTY()
bool bShowAllAdvanced { false };
/** When Playing or Simulating, shows all properties (even non-visible and non-editable properties), if the object belongs to a simulating world. This is useful for debugging. */
UPROPERTY()
bool bShowHiddenPropertiesWhilePlaying { false };
/** Show all category children if the category matches the filter. */
UPROPERTY()
bool bShowAllChildrenIfCategoryMatches { false };
/** Show only keyable properties. */
UPROPERTY()
bool bShowOnlyKeyable { false };
/** Show only animated properties. */
UPROPERTY()
bool bShowOnlyAnimated { false };
/** Show only modified properties. */
UPROPERTY()
bool bShowOnlyModified { false };
/** Show sections. */
UPROPERTY()
bool bShowSections { true };
/** Width of the value column in the details view (0.0-1.0). */
UPROPERTY()
float ValueColumnWidth { 0 };
/** A map of class name to a set of selected sections for that class. */
UPROPERTY()
TMap<FName, FDetailsSectionSelection> SelectedSections;
};
UCLASS(EditorConfig="DetailsView")
class UDetailsConfig : public UEditorConfigBase
{
GENERATED_BODY()
public:
UPROPERTY(meta=(EditorConfig))
TMap<FName, FDetailsViewConfig> Views;
static void Initialize();
static UDetailsConfig* Get();
private:
static TObjectPtr<UDetailsConfig> Instance;
};