Skip to content
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// Fill out your copyright notice in the Description page of Project Settings.


#include "DetailCustomizations/FlowComponentDetails.h"
#include "FlowComponent.h"

#include "DetailCategoryBuilder.h"
#include "DetailLayoutBuilder.h"
#include "GameplayTagsManager.h"
#include "Graph/FlowGraphSettings.h"

FFlowComponentDetails::~FFlowComponentDetails()
{
UGameplayTagsManager::Get().OnGetCategoriesMetaFromPropertyHandle.RemoveAll(this);
}

void FFlowComponentDetails::CustomizeDetails(IDetailLayoutBuilder& DetailBuilder)
{
const UFlowGraphSettings* Settings = GetDefault<UFlowGraphSettings>();
UGameplayTagsManager::Get().OnGetCategoriesMetaFromPropertyHandle.AddSP(this, &FFlowComponentDetails::ResolveCategoriesMeta);


IdentityTagsHandle = DetailBuilder.GetProperty(GET_MEMBER_NAME_CHECKED(UFlowComponent, IdentityTags));

const ECategoryPriority::Type Priority = Settings->bMarkFlowCategoryImportant ? ECategoryPriority::Important : ECategoryPriority::Default;
IDetailCategoryBuilder& Category = DetailBuilder.EditCategory("Flow", FText::GetEmpty(), Priority);

Category.AddProperty(IdentityTagsHandle);
}

void FFlowComponentDetails::ResolveCategoriesMeta(TSharedPtr<IPropertyHandle> PropertyHandle, FString& MetaString) const
{
if (PropertyHandle->IsSamePropertyNode(IdentityTagsHandle))
{
const UFlowGraphSettings* Settings = GetDefault<UFlowGraphSettings>();

if (Settings->ComponentClassIdentityTagCategories.IsEmpty())
{
MetaString = FString::JoinBy(Settings->DefaultIdentityTagCategories, TEXT(","), [](const FGameplayTag& Tag) { return Tag.ToString(); });
}
else
{
for (const UClass* Class = IdentityTagsHandle->GetOuterBaseClass(); Class; Class = Class->GetSuperClass())
{
if (const FGameplayTagContainer* Tags = Settings->ComponentClassIdentityTagCategories.Find(Class))
{
MetaString = FString::JoinBy(*Tags, TEXT(","), [](const FGameplayTag& Tag) { return Tag.ToString(); });
};
}
}
}
}
3 changes: 3 additions & 0 deletions Source/FlowEditor/Private/FlowEditorModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@
#include "DetailCustomizations/FlowAssetParamsPtrCustomization.h"
#include "DetailCustomizations/FlowDataPinValueOwnerCustomizations.h"
#include "DetailCustomizations/FlowDataPinValueStandardCustomizations.h"
#include "DetailCustomizations/FlowComponentDetails.h"

#include "FlowAsset.h"
#include "FlowComponent.h"
#include "AddOns/FlowNodeAddOn.h"
#include "Asset/FlowAssetParamsTypes.h"
#include "Find/FindInFlow.h"
Expand Down Expand Up @@ -254,6 +256,7 @@ void FFlowEditorModule::RegisterDetailCustomizations()
RegisterCustomClassLayout(UFlowNode_CustomOutput::StaticClass(), FOnGetDetailCustomizationInstance::CreateStatic(&FFlowNode_CustomOutputDetails::MakeInstance));
RegisterCustomClassLayout(UFlowNode_PlayLevelSequence::StaticClass(), FOnGetDetailCustomizationInstance::CreateStatic(&FFlowNode_PlayLevelSequenceDetails::MakeInstance));
RegisterCustomClassLayout(UFlowNode_SubGraph::StaticClass(), FOnGetDetailCustomizationInstance::CreateStatic(&FFlowNode_SubGraphDetails::MakeInstance));
RegisterCustomClassLayout(UFlowComponent::StaticClass(), FOnGetDetailCustomizationInstance::CreateStatic(&FFlowComponentDetails::MakeInstance));
RegisterCustomStructLayout(*FFlowActorOwnerComponentRef::StaticStruct(), FOnGetPropertyTypeCustomizationInstance::CreateStatic(&FFlowActorOwnerComponentRefCustomization::MakeInstance));
RegisterCustomStructLayout(*FFlowPin::StaticStruct(), FOnGetPropertyTypeCustomizationInstance::CreateStatic(&FFlowPinCustomization::MakeInstance));
RegisterCustomStructLayout(*FFlowNamedDataPinProperty::StaticStruct(), FOnGetPropertyTypeCustomizationInstance::CreateStatic(&FFlowNamedDataPinPropertyCustomization::MakeInstance));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Copyright https://github.com/MothCocoon/FlowGraph/graphs/contributors
#pragma once

#include "IDetailCustomization.h"


class FFlowComponentDetails : public IDetailCustomization
{
public:
static TSharedRef<IDetailCustomization> MakeInstance()
{
return MakeShareable(new FFlowComponentDetails());
}

virtual ~FFlowComponentDetails() override;

// IDetailCustomization
virtual void CustomizeDetails(IDetailLayoutBuilder& DetailBuilder) override;
// --

protected:
virtual void ResolveCategoriesMeta(TSharedPtr<IPropertyHandle> PropertyHandle, FString& MetaString) const;

private:
TSharedPtr<IPropertyHandle> IdentityTagsHandle;
};
15 changes: 14 additions & 1 deletion Source/FlowEditor/Public/Graph/FlowGraphSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "Graph/FlowGraphNodesPolicy.h"
#include "FlowGraphSettings.generated.h"

class UFlowComponent;
class UFlowNodeBase;

USTRUCT()
Expand Down Expand Up @@ -181,7 +182,19 @@ class FLOWEDITOR_API UFlowGraphSettings : public UDeveloperSettings

UPROPERTY(EditAnywhere, config, Category = "Wires", meta = (ClampMin = 0.0f))
float SelectedWireThickness;



/** FlowComponent only. Move category Flow to the top of details panel */
UPROPERTY(EditAnywhere, config, Category = "Details")
bool bMarkFlowCategoryImportant = true;

/** Use these tags If identity Categories are no overriden */
UPROPERTY(EditAnywhere, config, Category = "Details")
TArray<FGameplayTag> DefaultIdentityTagCategories;

/** Per component class categories. Overrides DefaultIdentityTagCategories */
UPROPERTY(EditAnywhere, config, Category = "Details")
TMap<TSoftClassPtr<UFlowComponent>, FGameplayTagContainer> ComponentClassIdentityTagCategories;
public:
virtual FName GetCategoryName() const override { return FName("Flow Graph"); }
virtual FText GetSectionText() const override { return INVTEXT("Graph Settings"); }
Expand Down