Files
UnrealEngineUWP/Engine/Source/Editor/CurveEditor/Private/SCurveEditorToolProperties.cpp
jamie dale 107f7b0f0c Audited use of FDetailsViewArgs::ObjectsUseNameArea
CL# 15481362 changed the behavior of ObjectsUseNameArea so that the object name was visible, and upon auditing the current use of ObjectsUseNameArea it was found that all but a few cases likely intended to use HideNameArea instead.

Breaking: This change also renames FDetailsViewArgs::bShowActorLabel to FDetailsViewArgs::bShowObjectLabel to reflect what it actually does.

#rb Brooke.Hubert

#ROBOMERGE-SOURCE: CL 15496125 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v771-15082668)

[CL 15496134 by jamie dale in ue5-main branch]
2021-02-22 19:45:57 -04:00

85 lines
2.5 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "SCurveEditorToolProperties.h"
#include "Modules/ModuleManager.h"
#include "IStructureDetailsView.h"
#include "PropertyEditorDelegates.h"
#include "PropertyEditorModule.h"
void SCurveEditorToolProperties::Construct(const FArguments& InArgs, TSharedRef<FCurveEditor> InCurveEditor, FCurveEditorToolID InToolId)
{
WeakCurveEditor = InCurveEditor;
ToolId = InToolId;
FPropertyEditorModule& PropertyEditorModule = FModuleManager::GetModuleChecked<FPropertyEditorModule>("PropertyEditor");
FDetailsViewArgs DetailsViewArgs;
DetailsViewArgs.bAllowSearch = false;
DetailsViewArgs.bShowScrollBar = false;
DetailsViewArgs.NameAreaSettings = FDetailsViewArgs::HideNameArea;
FStructureDetailsViewArgs StructureDetailsViewArgs;
StructureDetailsViewArgs.bShowObjects = true;
StructureDetailsViewArgs.bShowAssets = true;
StructureDetailsViewArgs.bShowClasses = true;
StructureDetailsViewArgs.bShowInterfaces = true;
DetailsView = PropertyEditorModule.CreateStructureDetailView(DetailsViewArgs, StructureDetailsViewArgs, nullptr);
DetailsView->GetOnFinishedChangingPropertiesDelegate().AddSP(this, &SCurveEditorToolProperties::OnFinishedChangingProperties);
OnToolChanged(ToolId);
ChildSlot
[
DetailsView->GetWidget().ToSharedRef()
];
}
void SCurveEditorToolProperties::OnToolChanged(FCurveEditorToolID NewToolId)
{
ToolId = NewToolId;
TSharedPtr<FCurveEditor> CurveEditor = WeakCurveEditor.Pin();
if (CurveEditor)
{
TSharedPtr<FOnOptionsRefresh> OnOptionsRefreshDelegate;
if (CurveEditor->GetToolExtensions().Contains(ToolId))
{
CurveEditor->GetToolExtensions()[ToolId]->OnOptionsRefreshDelegate.AddSP(this, &SCurveEditorToolProperties::RebuildProperties);
}
}
RebuildProperties();
}
void SCurveEditorToolProperties::RebuildProperties()
{
TSharedPtr<FCurveEditor> CurveEditor = WeakCurveEditor.Pin();
if (CurveEditor)
{
TSharedPtr<FStructOnScope> ToolOptions;
if (CurveEditor->GetToolExtensions().Contains(ToolId))
{
ToolOptions = CurveEditor->GetToolExtensions()[ToolId]->GetToolOptions();
DetailsView->SetStructureData(ToolOptions);
}
else
{
ToolOptions = nullptr;
DetailsView->SetStructureData(nullptr);
}
}
}
void SCurveEditorToolProperties::OnFinishedChangingProperties(const FPropertyChangedEvent& PropertyChangedEvent)
{
TSharedPtr<FCurveEditor> CurveEditor = WeakCurveEditor.Pin();
if (CurveEditor)
{
if (CurveEditor->GetCurrentTool())
{
CurveEditor->GetCurrentTool()->OnToolOptionsUpdated(PropertyChangedEvent);
}
}
}