Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Metadata Capitalization #8

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion MDMetaDataEditor.uplugin
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"Version": 1,
"VersionName": "1.0",
"FriendlyName": "MDMetaDataEditor",
"Description": "Unreal Engine 5.1+ plugin to enable editing meta data of Blueprint Properties and Functions",
"Description": "Unreal Engine 5.1+ plugin to enable editing metadata of Blueprint Properties and Functions",
"Category": "Editor",
"CreatedBy": "Dylan Dumesnil",
"CreatedByURL": "https://github.com/DoubleDeez",
Expand Down
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
# MDMetaDataEditor

MDMetaDataEditor enables editing the meta data of Blueprint-created variables, function parameters, functions, events, macros, and collapsed graphs.
MDMetaDataEditor enables editing the metadata of Blueprint-created variables, function parameters, functions, events, macros, and collapsed graphs.

Supports Unreal Engine 5.1 and later.

![](./Resources/readme_GameplayTagFilter.gif)

## Editing Meta Data
## Editing Metadata

The plugin adds a new `Meta Data` section to the details panel of Blueprint Variables, Functions, Events, and Function Parameters. Here, any exposed meta data values can be set.
The plugin adds a new `Metadata` section to the details panel of Blueprint Variables, Functions, Events, and Function Parameters. Here, any exposed metadata values can be set.

### Advanced

An advanced raw meta data editor can be enabled via Editor Preferences -> General -> Meta Data Editor (Local Only). This will enabling the raw strings of key-value meta data pairs.
An advanced raw metadata editor can be enabled via Editor Preferences -> General -> Metadata Editor (Local Only). This will enabling the raw strings of key-value metadata pairs.

![](./Resources/readme_ForceInlineRow.gif)

![](./Resources/readme_EditCondition.gif)

## Configuring Meta Data Keys
By default, the plugin comes with some common meta data keys pre-configured.
The list of available Meta Data Keys that are exposed to Blueprint can be configured in **Project Settings -> Editor -> Meta Data Editor**.
## Configuring Metadata Keys
By default, the plugin comes with some common metadata keys pre-configured.
The list of available Metadata Keys that are exposed to Blueprint can be configured in **Project Settings -> Editor -> Metadata Editor**.

Here, Meta Data Keys can be added, removed, and modified. By default, new keys are set up to work for any variable type in any blueprint.
Here, Metadata Keys can be added, removed, and modified. By default, new keys are set up to work for any variable type in any blueprint.

The **Key Type** should match the expected type of the meta data key, that will also determine which widget is displayed for setting the value of the meta data.
The **Key Type** should match the expected type of the metadata key, that will also determine which widget is displayed for setting the value of the metadata.

For Meta Data Keys meant only for functions, the **Supported Property Types** list should be empty and have **Can be Used by Functions** checked.
For Metadata Keys meant only for functions, the **Supported Property Types** list should be empty and have **Can be Used by Functions** checked.

See these pages for documentation on various meta data options:
See these pages for documentation on various metadata options:
- [benui's all UPROPERTY specifiers](https://benui.ca/unreal/uproperty/)
- [benui's all UFUNCTION specifiers](https://benui.ca/unreal/ufunction/)
- [benui's all UPARAM specifiers](https://benui.ca/unreal/uparam/)
Expand All @@ -43,6 +43,6 @@ See these pages for documentation on various meta data options:

## FYI

* If a meta data key is removed from the Project Settings, or the specific meta data type is disabled, that meta data key will continue to exist on variables, functions, events, and parameters.
* If a metadata key is removed from the Project Settings, or the specific metadata type is disabled, that metadata key will continue to exist on variables, functions, events, and parameters.

* I couldn't find any useful Meta Data Keys for collapsed graphs/macros so I disabled it by default. It can be re-enabled in the Project Settings.
* I couldn't find any useful Metadata Keys for collapsed graphs/macros so I disabled it by default. It can be re-enabled in the Project Settings.
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ void UMDMetaDataEditorConfig::PostInitProperties()

FText UMDMetaDataEditorConfig::GetSectionText() const
{
return INVTEXT("Meta Data Editor");
return INVTEXT("Metadata Editor");
}

void UMDMetaDataEditorConfig::ForEachVariableMetaDataKey(const UBlueprint* Blueprint, const FProperty* Property, const TFunction<void(const FMDMetaDataKey&)>& Func) const
Expand Down
22 changes: 11 additions & 11 deletions Source/MDMetaDataEditor/Private/Config/MDMetaDataEditorConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "MDMetaDataEditorConfig.generated.h"

/**
* Configure which meta data keys will display on blueprint Properties and Functions.
* Configure which metadata keys will display on blueprint Properties and Functions.
* Can be setup per Blueprint type and Property type.
*/
UCLASS(DefaultConfig, Config = Editor, MinimalAPI)
Expand All @@ -30,27 +30,27 @@ class UMDMetaDataEditorConfig : public UDeveloperSettings
void ForEachPropertyMetaDataKey(const UBlueprint* Blueprint, const FProperty* Property, const TFunction<void(const FMDMetaDataKey&)>& Func) const;
void ForEachFunctionMetaDataKey(const UBlueprint* Blueprint, const TFunction<void(const FMDMetaDataKey&)>& Func) const;

// If true, the meta data keys will automatically be sorted alphabetically
UPROPERTY(EditDefaultsOnly, Config, Category = "Meta Data Editor")
// If true, the metadata keys will automatically be sorted alphabetically
UPROPERTY(EditDefaultsOnly, Config, Category = "Metadata Editor")
bool bSortMetaDataAlphabetically = true;

UPROPERTY(EditDefaultsOnly, Config, Category = "Meta Data Editor")
UPROPERTY(EditDefaultsOnly, Config, Category = "Metadata Editor")
bool bEnableMetaDataEditorForVariables = true;

UPROPERTY(EditDefaultsOnly, Config, Category = "Meta Data Editor")
UPROPERTY(EditDefaultsOnly, Config, Category = "Metadata Editor")
bool bEnableMetaDataEditorForLocalVariables = true;

UPROPERTY(EditDefaultsOnly, Config, Category = "Meta Data Editor")
UPROPERTY(EditDefaultsOnly, Config, Category = "Metadata Editor")
bool bEnableMetaDataEditorForFunctions = true;

UPROPERTY(EditDefaultsOnly, Config, Category = "Meta Data Editor")
UPROPERTY(EditDefaultsOnly, Config, Category = "Metadata Editor")
bool bEnableMetaDataEditorForCustomEvents = true;

UPROPERTY(EditDefaultsOnly, Config, Category = "Meta Data Editor", DisplayName = "Enable Meta Data Editor for Collapsed Graphs and Macros")
UPROPERTY(EditDefaultsOnly, Config, Category = "Metadata Editor", DisplayName = "Enable Metadata Editor for Collapsed Graphs and Macros")
bool bEnableMetaDataEditorForTunnels = false;

// Param meta data only works for Function/Event parameters
UPROPERTY(EditDefaultsOnly, Config, Category = "Meta Data Editor")
// Param metadata only works for Function/Event parameters
UPROPERTY(EditDefaultsOnly, Config, Category = "Metadata Editor")
bool bEnableMetaDataEditorForFunctionParameters = true;

#if WITH_EDITOR
Expand All @@ -61,6 +61,6 @@ class UMDMetaDataEditorConfig : public UDeveloperSettings
UFUNCTION()
TArray<FName> GetMetaDataKeyNames() const;

UPROPERTY(EditAnywhere, Config, Category = "Meta Data Keys", meta = (TitleProperty = "{Key} ({KeyType})"))
UPROPERTY(EditAnywhere, Config, Category = "Metadata Keys", meta = (TitleProperty = "{Key} ({KeyType})"))
TArray<FMDMetaDataKey> MetaDataKeys;
};
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@

FText UMDMetaDataEditorUserConfig::GetSectionText() const
{
return INVTEXT("Meta Data Editor (Local Only)");
return INVTEXT("Metadata Editor (Local Only)");
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "MDMetaDataEditorUserConfig.generated.h"

/**
* Configure meta data editor behaviours.
* Configure metadata editor behaviours.
* Settings are specific to the local user.
*/
UCLASS(Config = EditorPerProjectUserSettings, MinimalAPI)
Expand All @@ -17,8 +17,8 @@ class UMDMetaDataEditorUserConfig : public UDeveloperSettings
public:
virtual FText GetSectionText() const override;

// If true, a raw key-value editor will be displayed on variables/functions that can have meta data
// This viewing/editing of all meta data, even if not exposed by the Meta Data Editor config.
// If true, a raw key-value editor will be displayed on variables/functions that can have metadata
// This viewing/editing of all metadata, even if not exposed by the Metadata Editor config.
UPROPERTY(EditDefaultsOnly, Config, Category = "Editor Config")
bool bEnableRawMetaDataEditor = false;
};
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ namespace MDMDECB_Private

FProperty* FindNodeProperty(const UK2Node_EditablePinBase* Node, const TSharedPtr<FUserPinInfo>& PinInfo)
{
// Specifically grab the generated class, not the skeleton class so that UMDMetaDataEditorBlueprintCompilerExtension can grab the meta data after the BP is compiled
// Specifically grab the generated class, not the skeleton class so that UMDMetaDataEditorBlueprintCompilerExtension can grab the metadata after the BP is compiled

const UBlueprint* Blueprint = IsValid(Node) ? Node->GetBlueprint() : nullptr;
const UClass* Class = IsValid(Blueprint) ? Blueprint->GeneratedClass : nullptr;
Expand Down Expand Up @@ -196,16 +196,16 @@ void FMDMetaDataEditorCustomizationBase::CustomizeDetails(IDetailLayoutBuilder&

if (bIsProperty)
{
// Put Meta Data above Default Value for Variables
// Put Metadata above Default Value for Variables
int32 MetaDataSortOrder = DetailLayout.EditCategory("Variable").GetSortOrder();
DetailLayout.EditCategory("MetaData").SetSortOrder(++MetaDataSortOrder);
DetailLayout.EditCategory("Metadata").SetSortOrder(++MetaDataSortOrder);
DetailLayout.EditCategory("DefaultValue").SetSortOrder(++MetaDataSortOrder);
}
else if (bIsFunction)
{
// Put Meta Data above Inputs for Functions
// Put Metadata above Inputs for Functions
int32 MetaDataSortOrder = DetailLayout.EditCategory("Graph").GetSortOrder();
DetailLayout.EditCategory("MetaData").SetSortOrder(++MetaDataSortOrder);
DetailLayout.EditCategory("Metadata").SetSortOrder(++MetaDataSortOrder);
DetailLayout.EditCategory("Inputs").SetSortOrder(++MetaDataSortOrder);
DetailLayout.EditCategory("Outputs").SetSortOrder(++MetaDataSortOrder);
}
Expand All @@ -227,7 +227,7 @@ void FMDMetaDataEditorCustomizationBase::CustomizeDetails(IDetailLayoutBuilder&
}
}

IDetailCategoryBuilder& Category = DetailLayout.EditCategory("MetaData");
IDetailCategoryBuilder& Category = DetailLayout.EditCategory("Metadata");
IDetailGroup* Group = nullptr;

FName GroupName = NAME_None;
Expand Down Expand Up @@ -292,7 +292,7 @@ void FMDMetaDataEditorCustomizationBase::CustomizeDetails(IDetailLayoutBuilder&
[
SNew(SButton)
.IsFocusable(false)
.ToolTipText(INVTEXT("Remove this meta data from this property"))
.ToolTipText(INVTEXT("Remove this metadata from this property"))
.ButtonStyle(FAppStyle::Get(), "SimpleButton")
.ContentPadding(0)
.Visibility(this, &FMDMetaDataEditorCustomizationBase::GetRemoveMetaDataButtonVisibility, Key.Key, TWeakFieldPtr<FProperty>())
Expand Down Expand Up @@ -341,7 +341,7 @@ void FMDMetaDataEditorCustomizationBase::CustomizeDetails(IDetailLayoutBuilder&
Config->ForEachFunctionMetaDataKey(Blueprint, AddMetaDataKey);
}

// TODO - Refactor - Adding the param meta data logic made this file/class a mess. Consider pulling that logic out.
// TODO - Refactor - Adding the param metadata logic made this file/class a mess. Consider pulling that logic out.
if (Config->bEnableMetaDataEditorForFunctionParameters)
{
TMap<FName, IDetailGroup*> ParamGroupMap;
Expand All @@ -352,7 +352,7 @@ void FMDMetaDataEditorCustomizationBase::CustomizeDetails(IDetailLayoutBuilder&
{
if (InputsGroupPtr == nullptr)
{
InputsGroupPtr = &DetailLayout.EditCategory("Inputs").AddGroup(TEXT("ParamMetaData"), INVTEXT("Param Meta Data"));
InputsGroupPtr = &DetailLayout.EditCategory("Inputs").AddGroup(TEXT("ParamMetadata"), INVTEXT("Param Metadata"));
}

return *InputsGroupPtr;
Expand All @@ -363,7 +363,7 @@ void FMDMetaDataEditorCustomizationBase::CustomizeDetails(IDetailLayoutBuilder&
{
if (OutputsGroupPtr == nullptr)
{
OutputsGroupPtr = &DetailLayout.EditCategory("Outputs").AddGroup(TEXT("ParamMetaData"), INVTEXT("Param Meta Data"));
OutputsGroupPtr = &DetailLayout.EditCategory("Outputs").AddGroup(TEXT("ParamMetadata"), INVTEXT("Param Metadata"));
}

return *OutputsGroupPtr;
Expand Down Expand Up @@ -456,7 +456,7 @@ void FMDMetaDataEditorCustomizationBase::CustomizeDetails(IDetailLayoutBuilder&
[
SNew(SButton)
.IsFocusable(false)
.ToolTipText(INVTEXT("Remove this meta data from this parameter"))
.ToolTipText(INVTEXT("Remove this metadata from this parameter"))
.ButtonStyle(FAppStyle::Get(), "SimpleButton")
.ContentPadding(0)
.Visibility(this, &FMDMetaDataEditorCustomizationBase::GetRemoveMetaDataButtonVisibility, Key.Key, MakeWeakFieldPtr(ParamProperty))
Expand All @@ -481,7 +481,7 @@ void FMDMetaDataEditorCustomizationBase::CustomizeDetails(IDetailLayoutBuilder&
? ParamGroupMap.FindRef(GroupName)
: ParamGroupMap.Add(GroupName, &RootGroup.AddGroup(GroupName, ParamProperty->GetDisplayNameText()));

IDetailGroup& RawMetaDataGroup = Group->AddGroup(TEXT("RawMetaData"), INVTEXT("Raw Meta Data"), true);
IDetailGroup& RawMetaDataGroup = Group->AddGroup(TEXT("RawMetadata"), INVTEXT("Raw Metadata"), true);
AddRawMetaDataEditor(ParamMetaDataMap, RawMetaDataGroup, bIsReadOnly, ParamProperty);
}
}
Expand All @@ -491,8 +491,8 @@ void FMDMetaDataEditorCustomizationBase::CustomizeDetails(IDetailLayoutBuilder&
if (UserConfig->bEnableRawMetaDataEditor && (!bIsReadOnly || (MetaDataMap != nullptr && !MetaDataMap->IsEmpty())))
{
IDetailGroup& RawMetaDataGroup = DetailLayout
.EditCategory("MetaData")
.AddGroup(TEXT("RawMetaData"), INVTEXT("Raw Meta Data"), true);
.EditCategory("Metadata")
.AddGroup(TEXT("RawMetadata"), INVTEXT("Raw Metadata"), true);
AddRawMetaDataEditor(MetaDataMap, RawMetaDataGroup, bIsReadOnly, nullptr);
}
}
Expand Down Expand Up @@ -656,7 +656,7 @@ void FMDMetaDataEditorCustomizationBase::AddRawMetaDataEditor(const TMap<FName,
[
SNew(SButton)
.IsFocusable(false)
.ToolTipText(INVTEXT("Remove this meta data"))
.ToolTipText(INVTEXT("Remove this metadata"))
.ButtonStyle(FAppStyle::Get(), "SimpleButton")
.ContentPadding(0)
.Visibility(this, &FMDMetaDataEditorCustomizationBase::GetRemoveMetaDataButtonVisibility, MetaDataPair.Key, MakeWeakFieldPtr(Property))
Expand All @@ -671,18 +671,18 @@ void FMDMetaDataEditorCustomizationBase::AddRawMetaDataEditor(const TMap<FName,
}
}

// Add meta data row
// Add metadata row
if (!bIsReadOnly)
{
RawMetaDataGroup.AddWidgetRow()
.FilterString(INVTEXT("Add Meta Data"))
.FilterString(INVTEXT("Add Metadata"))
.IsEnabled(!bIsReadOnly)
.NameContent()
.HAlign(HAlign_Fill)
[
SNew(SEditableTextBox)
.Text(FText::GetEmpty())
.HintText(INVTEXT("New Meta Data entry..."))
.HintText(INVTEXT("New Metadata entry..."))
.OnTextCommitted(this, &FMDMetaDataEditorCustomizationBase::OnMetaDataKeyTextCommitted, FName(NAME_None), MakeWeakFieldPtr(Property))
.RevertTextOnEscape(true)
]
Expand All @@ -709,7 +709,7 @@ void FMDMetaDataEditorCustomizationBase::SetMetaDataValue(const FName& Key, cons
return;
}

FScopedTransaction Transaction(FText::Format(INVTEXT("Set Meta Data [{0}={1}]"), FText::FromName(Key), FText::FromString(Value)));
FScopedTransaction Transaction(FText::Format(INVTEXT("Set Metadata [{0}={1}]"), FText::FromName(Key), FText::FromString(Value)));

if (FProperty* ParamProperty = PropertyPtr.Get())
{
Expand Down Expand Up @@ -859,11 +859,11 @@ void FMDMetaDataEditorCustomizationBase::SetMetaDataKey(const FName& OldKey, con
TOptional<FString> Value = GetMetaDataValue(OldKey, PropertyPtr);
if (!Value.IsSet())
{
// Not set means we don't have meta data with OldKey
// Not set means we don't have metadata with OldKey
return;
}

FScopedTransaction Transaction(FText::Format(INVTEXT("Changed Meta Data Key [{0} -> {1}]"), FText::FromName(OldKey), FText::FromName(NewKey)));
FScopedTransaction Transaction(FText::Format(INVTEXT("Changed Metadata Key [{0} -> {1}]"), FText::FromName(OldKey), FText::FromName(NewKey)));
RemoveMetaDataKey(OldKey, PropertyPtr);
SetMetaDataValue(NewKey, Value.GetValue(), PropertyPtr);
}
Expand All @@ -875,7 +875,7 @@ void FMDMetaDataEditorCustomizationBase::RemoveMetaDataKey(const FName& Key, TWe
return;
}

FScopedTransaction Transaction(FText::Format(INVTEXT("Removed Meta Data [{0}]"), FText::FromName(Key)));
FScopedTransaction Transaction(FText::Format(INVTEXT("Removed Metadata [{0}]"), FText::FromName(Key)));

if (FProperty* ParamProperty = PropertyPtr.Get())
{
Expand Down Expand Up @@ -1111,7 +1111,7 @@ ECheckBoxState FMDMetaDataEditorCustomizationBase::IsChecked(FName Key, TWeakFie

if constexpr (bIsBoolean)
{
// Don't assume unset == false, a meta data key could have different behaviour between the 2.
// Don't assume unset == false, a metadata key could have different behaviour between the 2.
if (!Value.IsSet())
{
return ECheckBoxState::Undetermined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,23 +55,23 @@ struct FMDMetaDataEditorPropertyType

void FixUp();

UPROPERTY(EditAnywhere, Config, Category = "Meta Data Editor")
UPROPERTY(EditAnywhere, Config, Category = "Metadata Editor")
FName PropertyType = NAME_None;

UPROPERTY(EditAnywhere, Config, Category = "Meta Data Editor")
UPROPERTY(EditAnywhere, Config, Category = "Metadata Editor")
FName PropertySubType = NAME_None;

UPROPERTY(EditAnywhere, Config, Category = "Meta Data Editor")
UPROPERTY(EditAnywhere, Config, Category = "Metadata Editor")
TSoftObjectPtr<UObject> PropertySubTypeObject;

UPROPERTY(EditAnywhere, Config, Category = "Meta Data Editor")
UPROPERTY(EditAnywhere, Config, Category = "Metadata Editor")
FSimpleMemberReference PropertySubTypeMemberReference;

UPROPERTY(EditAnywhere, Config, Category = "Meta Data Editor")
UPROPERTY(EditAnywhere, Config, Category = "Metadata Editor")
FInstancedStruct ValueType;
FMDMetaDataEditorPropertyType& SetValueType(FMDMetaDataEditorPropertyType&& InValueType) { ValueType.InitializeAs<FMDMetaDataEditorPropertyType>(InValueType); return *this; }

UPROPERTY(EditAnywhere, Config, Category = "Meta Data Editor")
UPROPERTY(EditAnywhere, Config, Category = "Metadata Editor")
EMDMetaDataPropertyContainerType ContainerType = EMDMetaDataPropertyContainerType::None;
FMDMetaDataEditorPropertyType& SetContainerType(EMDMetaDataPropertyContainerType InContainerType) { ContainerType = InContainerType; return *this; }

Expand Down
2 changes: 1 addition & 1 deletion Source/MDMetaDataEditor/Private/Types/MDMetaDataKey.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ FText FMDMetaDataKey::GetToolTipText() const
FString ToolTip = Description;
if (bUseDisplayNameOverride)
{
ToolTip += "\r\n\r\nMeta Data Key: \"" + Key.ToString() + "\"";
ToolTip += "\r\n\r\nMetadata Key: \"" + Key.ToString() + "\"";
}
return FText::FromString(ToolTip);
}
Expand Down
Loading