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,57 @@
// Fill out your copyright notice in the Description page of Project Settings.


#include "DetailCustomizations/FlowActorDetails.h"
#include "ActorDetailsDelegates.h"
#include "DetailCategoryBuilder.h"
#include "DetailLayoutBuilder.h"
#include "FlowComponent.h"
#include "Graph/FlowGraphSettings.h"


FFlowActorDetails::~FFlowActorDetails()
{
OnExtendActorDetails.RemoveAll(this);
}

void FFlowActorDetails::Register()
{
if (GetDefault<UFlowGraphSettings>()->bShowFlowTagsInActorDetails)
{
OnExtendActorDetails.AddSP(this, &FFlowActorDetails::AddFlowCategory);
}
}

void FFlowActorDetails::AddFlowCategory(class IDetailLayoutBuilder& Details, const FGetSelectedActors& GetSelectedActors)
{
if (GetSelectedActors.IsBound())
{
TArray<UObject*> Components;
const TArray<TWeakObjectPtr<AActor>>& SelectedActors = GetSelectedActors.Execute();
for (auto& WeakActor : SelectedActors)
{
if (const AActor* Actor = WeakActor.Get())
{
TInlineComponentArray<UFlowComponent*> FlowComps(Actor);
Components.Append(FlowComps);
}
}

if (!Components.IsEmpty())
{
const ECategoryPriority::Type Priority = GetDefault<UFlowGraphSettings>()->bMarkFlowCategoryImportant ? ECategoryPriority::Important : ECategoryPriority::Default;

const FText CategoryName = FText::Format(NSLOCTEXT("FlowDetails", "FlowCategoryFormat", "Flow Components: {0} "), FText::AsNumber(Components.Num()));
const FString Tooltip = FString::JoinBy(Components, LINE_TERMINATOR, [](const UObject* Object)
{
const UActorComponent* Component = CastChecked<UActorComponent>(Object);
const FString Actor = Component->GetOwner() ? Component->GetOwner()->GetActorNameOrLabel() : TEXT("None");
return FString(Actor + TEXT(".") + Object->GetName());
});

IDetailCategoryBuilder& Category = Details.EditCategory(TEXT("_FlowDetails"), CategoryName, Priority);
Category.SetToolTip(FText::FromString(Tooltip));
Category.AddExternalObjectProperty(Components, GET_MEMBER_NAME_CHECKED(UFlowComponent, IdentityTags));
}
}
}
6 changes: 6 additions & 0 deletions Source/FlowEditor/Private/FlowEditorModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "DetailCustomizations/FlowAssetParamsPtrCustomization.h"
#include "DetailCustomizations/FlowDataPinValueOwnerCustomizations.h"
#include "DetailCustomizations/FlowDataPinValueStandardCustomizations.h"
#include "DetailCustomizations/FlowActorDetails.h"

#include "FlowAsset.h"
#include "AddOns/FlowNodeAddOn.h"
Expand Down Expand Up @@ -90,6 +91,9 @@ void FFlowEditorModule::StartupModule()
FlowTrackCreateEditorHandle = SequencerModule.RegisterTrackEditor(FOnCreateTrackEditor::CreateStatic(&FFlowTrackEditor::CreateTrackEditor));

RegisterDetailCustomizations();

ActorDetails = MakeShared<FFlowActorDetails>();
ActorDetails->Register();

// register asset indexers
if (FModuleManager::Get().IsModuleLoaded(AssetSearchModuleName))
Expand Down Expand Up @@ -120,6 +124,8 @@ void FFlowEditorModule::ShutdownModule()
UnregisterDetailCustomizations();

UnregisterAssets();

ActorDetails.Reset();

// unregister track editors
ISequencerModule& SequencerModule = FModuleManager::Get().LoadModuleChecked<ISequencerModule>("Sequencer");
Expand Down
17 changes: 17 additions & 0 deletions Source/FlowEditor/Public/DetailCustomizations/FlowActorDetails.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "ActorDetailsDelegates.h"

/**
*
*/
class FLOWEDITOR_API FFlowActorDetails : public TSharedFromThis<FFlowActorDetails>
{
public:
virtual ~FFlowActorDetails();
virtual void Register();
virtual void AddFlowCategory(class IDetailLayoutBuilder& Details, const FGetSelectedActors& GetSelectedActors);
};
1 change: 1 addition & 0 deletions Source/FlowEditor/Public/FlowEditorModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class FLOWEDITOR_API FFlowEditorModule : public IModuleInterface

bool bIsRegisteredForAssetChanges = false;

TSharedPtr<class FFlowActorDetails> ActorDetails;
public:
virtual void StartupModule() override;
virtual void ShutdownModule() override;
Expand Down
8 changes: 8 additions & 0 deletions Source/FlowEditor/Public/Graph/FlowGraphSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,14 @@ class FLOWEDITOR_API UFlowGraphSettings : public UDeveloperSettings

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


UPROPERTY(EditAnywhere, config, Category = "Details", meta = (ConfigRestartRequired = true))
bool bShowFlowTagsInActorDetails = true;

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

public:
virtual FName GetCategoryName() const override { return FName("Flow Graph"); }
Expand Down