You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
- Window menu is now sectioned and labeled based on the current editor. There's now a local workspace root member in FTabManager and a workspace category in FAssetEditorToolkit (both are FWorkspaceItem objects). Individual editors attach their local category to the tab manager's local root. Workflow app modes have their own category members that are swapped out when the mode changes.
- Finally, the AssetEditorCategory of FWorkspaceMenuStructure has been removed entirely.
- Replaced the AddMenuSeparator() call in FTabManager::PopulateSpawnerMenu_Helper() with a section of the same title as the workspace category.
- Tab spawner menu entries for the local editor now properly show the icon of the associated tab. To accomplish this it was necessary to change FWorkflowTabFactory::TabIcon to be an FSlateIcon instead of an FSlateBrush*. All factory instances have been updated accordingly.
- Added & updated lots of icons! (those missing will be TTP'd)
- The nomad tab spawner section (named "General" in the menu) has been largely compressed into the Developer Tools submenu, which has also been organized into sections for readability.
- Unreal frontend options were also moved into a context menu within the General section
- Moved all experimental tools to their own section of the Window menu. When they're no longer experimental they should register as nomads in the appropriate category
- Undo history now under Edit menu
[CL 2324285 by Dan Hertzka in Main branch]
265 lines
6.8 KiB
C++
265 lines
6.8 KiB
C++
// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "DataTableEditorPrivatePCH.h"
|
|
|
|
#include "DataTableEditor.h"
|
|
#include "Toolkits/IToolkitHost.h"
|
|
#include "Editor/WorkspaceMenuStructure/Public/WorkspaceMenuStructureModule.h"
|
|
|
|
#define LOCTEXT_NAMESPACE "DataTableEditor"
|
|
|
|
const FName FDataTableEditor::DataTableTabId( TEXT( "DataTableEditor_DataTable" ) );
|
|
|
|
void FDataTableEditor::RegisterTabSpawners(const TSharedRef<class FTabManager>& TabManager)
|
|
{
|
|
WorkspaceMenuCategory = TabManager->GetLocalWorkspaceMenuRoot()->AddGroup(LOCTEXT("WorkspaceMenu_Data Table Editor", "Data Table Editor"));
|
|
|
|
TabManager->RegisterTabSpawner( DataTableTabId, FOnSpawnTab::CreateSP(this, &FDataTableEditor::SpawnTab_DataTable) )
|
|
.SetDisplayName( LOCTEXT("DataTableTab", "Data Table") )
|
|
.SetGroup( WorkspaceMenuCategory.ToSharedRef() );
|
|
}
|
|
|
|
void FDataTableEditor::UnregisterTabSpawners(const TSharedRef<class FTabManager>& TabManager)
|
|
{
|
|
TabManager->UnregisterTabSpawner( DataTableTabId );
|
|
}
|
|
|
|
FDataTableEditor::FDataTableEditor()
|
|
{
|
|
FReimportManager::Instance()->OnPostReimport().AddRaw(this, &FDataTableEditor::OnPostReimport);
|
|
}
|
|
|
|
FDataTableEditor::~FDataTableEditor()
|
|
{
|
|
FReimportManager::Instance()->OnPostReimport().RemoveAll(this);
|
|
}
|
|
|
|
|
|
void FDataTableEditor::InitDataTableEditor( const EToolkitMode::Type Mode, const TSharedPtr< class IToolkitHost >& InitToolkitHost, UDataTable* Table )
|
|
{
|
|
TSharedRef<FTabManager::FLayout> StandaloneDefaultLayout = FTabManager::NewLayout( "Standalone_DataTableEditor_Layout" )
|
|
->AddArea
|
|
(
|
|
FTabManager::NewPrimaryArea()
|
|
->Split
|
|
(
|
|
FTabManager::NewStack()
|
|
->AddTab( DataTableTabId, ETabState::OpenedTab )
|
|
)
|
|
);
|
|
|
|
const bool bCreateDefaultStandaloneMenu = true;
|
|
const bool bCreateDefaultToolbar = false;
|
|
FAssetEditorToolkit::InitAssetEditor( Mode, InitToolkitHost, FDataTableEditorModule::DataTableEditorAppIdentifier, StandaloneDefaultLayout, bCreateDefaultStandaloneMenu, bCreateDefaultToolbar, Table );
|
|
|
|
FDataTableEditorModule& DataTableEditorModule = FModuleManager::LoadModuleChecked<FDataTableEditorModule>( "DataTableEditor" );
|
|
AddMenuExtender(DataTableEditorModule.GetMenuExtensibilityManager()->GetAllExtenders(GetToolkitCommands(), GetEditingObjects()));
|
|
|
|
// @todo toolkit world centric editing
|
|
/*// Setup our tool's layout
|
|
if( IsWorldCentricAssetEditor() )
|
|
{
|
|
const FString TabInitializationPayload(TEXT("")); // NOTE: Payload not currently used for table properties
|
|
SpawnToolkitTab( DataTableTabId, TabInitializationPayload, EToolkitTabSpot::Details );
|
|
}*/
|
|
|
|
// NOTE: Could fill in asset editor commands here!
|
|
}
|
|
|
|
FName FDataTableEditor::GetToolkitFName() const
|
|
{
|
|
return FName("DataTableEditor");
|
|
}
|
|
|
|
FText FDataTableEditor::GetBaseToolkitName() const
|
|
{
|
|
return LOCTEXT( "AppLabel", "DataTable Editor" );
|
|
}
|
|
|
|
|
|
FString FDataTableEditor::GetWorldCentricTabPrefix() const
|
|
{
|
|
return LOCTEXT("WorldCentricTabPrefix", "DataTable ").ToString();
|
|
}
|
|
|
|
|
|
FLinearColor FDataTableEditor::GetWorldCentricTabColorScale() const
|
|
{
|
|
return FLinearColor( 0.0f, 0.0f, 0.2f, 0.5f );
|
|
}
|
|
|
|
void FDataTableEditor::OnPostReimport(UObject* InObject, bool bSuccess)
|
|
{
|
|
// Ignore if this is regarding a different object
|
|
if ( InObject == DataTable && bSuccess)
|
|
{
|
|
CachedDataTable.Empty();
|
|
ReloadVisibleData();
|
|
}
|
|
}
|
|
|
|
TSharedPtr<SUniformGridPanel> FDataTableEditor::CreateGridPanel()
|
|
{
|
|
TSharedPtr<SUniformGridPanel> GridPanel = SNew(SUniformGridPanel).SlotPadding( FMargin( 2.0f ) );
|
|
|
|
if (DataTable != NULL)
|
|
{
|
|
if (CachedDataTable.Num() == 0)
|
|
{
|
|
CachedDataTable = DataTable->GetTableData();
|
|
|
|
RowsVisibility.SetNum(CachedDataTable.Num());
|
|
for (int32 i = 0; i < RowsVisibility.Num(); ++i)
|
|
{
|
|
RowsVisibility[i] = true;
|
|
}
|
|
}
|
|
|
|
check(CachedDataTable.Num() > 0 && CachedDataTable.Num() == RowsVisibility.Num());
|
|
|
|
int32 RowIndex = 0;
|
|
TArray<FString>& ColumnTitles = CachedDataTable[0];
|
|
for(int i = 0;i<CachedDataTable.Num();++i)
|
|
{
|
|
if (RowsVisibility[i])
|
|
{
|
|
bool bIsHeader = (i == 0);
|
|
|
|
FLinearColor RowColor = (RowIndex % 2 == 0) ? FLinearColor::Gray : FLinearColor::Black;
|
|
if (bIsHeader)
|
|
{
|
|
RowColor = FLinearColor::Gray;
|
|
}
|
|
|
|
TArray<FString>& Row = CachedDataTable[i];
|
|
for(int Column = 0;Column<Row.Num();++Column)
|
|
{
|
|
GridPanel->AddSlot(Column, RowIndex)
|
|
[
|
|
SNew(SBorder)
|
|
.Padding(1)
|
|
.BorderImage( FEditorStyle::GetBrush( "ToolPanel.GroupBorder" ) )
|
|
.BorderBackgroundColor(RowColor)
|
|
[
|
|
SNew(STextBlock)
|
|
.Text(Row[Column])
|
|
.ToolTipText(bIsHeader
|
|
? (FString::Printf(TEXT("Column '%s"), *ColumnTitles[Column]))
|
|
: (FString::Printf(TEXT("%s: %s"), *ColumnTitles[Column], *Row[Column])))
|
|
]
|
|
];
|
|
}
|
|
|
|
++RowIndex;
|
|
}
|
|
}
|
|
}
|
|
return GridPanel;
|
|
}
|
|
|
|
void FDataTableEditor::OnSearchTextChanged(const FText& SearchText)
|
|
{
|
|
FString SearchFor = SearchText.ToString();
|
|
if (!SearchFor.IsEmpty())
|
|
{
|
|
check(CachedDataTable.Num() == RowsVisibility.Num());
|
|
|
|
// starting from index 1, because 0 is header
|
|
for (int32 RowIdx = 1; RowIdx < CachedDataTable.Num(); ++RowIdx)
|
|
{
|
|
RowsVisibility[RowIdx] = false;
|
|
|
|
for (int32 i = 0; i < CachedDataTable[RowIdx].Num(); ++i)
|
|
{
|
|
if (SearchFor.Len() < CachedDataTable[RowIdx][i].Len())
|
|
{
|
|
if (CachedDataTable[RowIdx][i].Contains(SearchFor))
|
|
{
|
|
RowsVisibility[RowIdx] = true;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
for (int32 RowIdx = 0; RowIdx < RowsVisibility.Num(); ++RowIdx)
|
|
{
|
|
RowsVisibility[RowIdx] = true;
|
|
}
|
|
}
|
|
|
|
ReloadVisibleData();
|
|
}
|
|
|
|
void FDataTableEditor::ReloadVisibleData()
|
|
{
|
|
if (ScrollBoxWidget.IsValid())
|
|
{
|
|
ScrollBoxWidget->ClearChildren();
|
|
ScrollBoxWidget->AddSlot()
|
|
[
|
|
CreateGridPanel().ToSharedRef()
|
|
];
|
|
}
|
|
}
|
|
|
|
TSharedRef<SVerticalBox> FDataTableEditor::CreateContentBox()
|
|
{
|
|
return SNew(SVerticalBox)
|
|
+SVerticalBox::Slot()
|
|
.AutoHeight()
|
|
[
|
|
SAssignNew(SearchBox, SSearchBox)
|
|
.OnTextChanged(this, &FDataTableEditor::OnSearchTextChanged)
|
|
]
|
|
+SVerticalBox::Slot()
|
|
[
|
|
SAssignNew(ScrollBoxWidget, SScrollBox)
|
|
+SScrollBox::Slot()
|
|
[
|
|
CreateGridPanel().ToSharedRef()
|
|
]
|
|
];
|
|
}
|
|
|
|
void FDataTableEditor::OnDataTableReloaded()
|
|
{
|
|
CachedDataTable.Reset();
|
|
|
|
TSharedRef<SVerticalBox> ContentBox = CreateContentBox();
|
|
|
|
GridPanelOwner->SetContent(ContentBox);
|
|
}
|
|
|
|
TSharedRef<SDockTab> FDataTableEditor::SpawnTab_DataTable( const FSpawnTabArgs& Args )
|
|
{
|
|
check( Args.GetTabId().TabType == DataTableTabId );
|
|
|
|
DataTable = Cast<UDataTable>(GetEditingObject());
|
|
|
|
TSharedRef<SVerticalBox> ContentBox = CreateContentBox();
|
|
|
|
GridPanelOwner =
|
|
SNew(SBorder)
|
|
.Padding(2)
|
|
.VAlign(VAlign_Top)
|
|
.HAlign(HAlign_Left)
|
|
.BorderImage( FEditorStyle::GetBrush( "ToolPanel.GroupBorder" ) )
|
|
[
|
|
ContentBox
|
|
];
|
|
|
|
return SNew(SDockTab)
|
|
.Icon( FEditorStyle::GetBrush("DataTableEditor.Tabs.Properties") )
|
|
.Label( LOCTEXT("DataTableTitle", "Data Table") )
|
|
.TabColorScale( GetTabColorScale() )
|
|
[
|
|
GridPanelOwner.ToSharedRef()
|
|
];
|
|
}
|
|
|
|
|
|
#undef LOCTEXT_NAMESPACE
|