Files
UnrealEngineUWP/Engine/Source/Editor/Persona/Private/MeshMode/MeshMode.cpp

139 lines
4.0 KiB
C++
Raw Normal View History

// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
#include "PersonaPrivatePCH.h"
#include "Persona.h"
#include "Editor/PropertyEditor/Public/PropertyEditorModule.h"
#include "Editor/PropertyEditor/Public/IDetailsView.h"
#include "Editor/Kismet/Public/BlueprintEditorTabs.h"
#include "Editor/KismetWidgets/Public/SSingleObjectDetailsPanel.h"
#include "PersonaMeshDetails.h"
#include "MeshMode.h"
#define LOCTEXT_NAMESPACE "PersonaMeshMode"
/////////////////////////////////////////////////////
// SMeshPropertiesTabBody
class SMeshPropertiesTabBody : public SSingleObjectDetailsPanel
{
public:
SLATE_BEGIN_ARGS(SMeshPropertiesTabBody) {}
SLATE_END_ARGS()
private:
// Pointer back to owning Persona instance (the keeper of state)
TWeakPtr<class FPersona> PersonaPtr;
public:
void Construct(const FArguments& InArgs, TSharedPtr<FPersona> InPersona)
{
PersonaPtr = InPersona;
SSingleObjectDetailsPanel::Construct(SSingleObjectDetailsPanel::FArguments().HostCommandList(InPersona->GetToolkitCommands()), true, true);
PropertyView->SetGenericLayoutDetailsDelegate( FOnGetDetailCustomizationInstance::CreateStatic( &FPersonaMeshDetails::MakeInstance, InPersona ) );
}
// SSingleObjectDetailsPanel interface
virtual UObject* GetObjectToObserve() const override
{
return PersonaPtr.Pin()->GetMesh();
}
// End of SSingleObjectDetailsPanel interface
};
/////////////////////////////////////////////////////
// FMeshPropertiesSummoner
FMeshPropertiesSummoner::FMeshPropertiesSummoner(TSharedPtr<class FAssetEditorToolkit> InHostingApp)
: FWorkflowTabFactory(FPersonaTabs::MeshAssetPropertiesID, InHostingApp)
{
TabLabel = LOCTEXT("MeshProperties_TabTitle", "Mesh Details");
Window menu refactor & polish - 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]
2014-10-09 12:34:55 -04:00
TabIcon = FSlateIcon(FEditorStyle::GetStyleSetName(), "ClassIcon.SkeletalMesh");
bIsSingleton = true;
ViewMenuDescription = LOCTEXT("MeshProperties_MenuTitle", "Mesh Details");
ViewMenuTooltip = LOCTEXT("MeshProperties_MenuToolTip", "Shows the skeletal mesh properties");
}
TSharedRef<SWidget> FMeshPropertiesSummoner::CreateTabBody(const FWorkflowTabSpawnInfo& Info) const
{
TSharedPtr<FPersona> PersonaApp = StaticCastSharedPtr<FPersona>(HostingApp.Pin());
return SNew(SMeshPropertiesTabBody, PersonaApp);
}
/////////////////////////////////////////////////////
// FMeshEditAppMode
FMeshEditAppMode::FMeshEditAppMode(TSharedPtr<FPersona> InPersona)
: FPersonaAppMode(InPersona, FPersonaModes::MeshEditMode)
{
PersonaTabFactories.RegisterFactory(MakeShareable(new FSelectionDetailsSummoner(InPersona)));
PersonaTabFactories.RegisterFactory(MakeShareable(new FMeshPropertiesSummoner(InPersona)));
TabLayout = FTabManager::NewLayout( "Persona_MeshEditMode_Layout_v7" )
->AddArea
(
FTabManager::NewPrimaryArea()
->SetOrientation(Orient_Vertical)
->Split
(
// Top toolbar area
FTabManager::NewStack()
->SetSizeCoefficient(0.186721f)
->SetHideTabWell(true)
->AddTab( InPersona->GetToolbarTabId(), ETabState::OpenedTab )
)
->Split
(
// Rest of screen
FTabManager::NewSplitter()
->SetOrientation(Orient_Horizontal)
->Split
(
// Left 1/3rd - Skeleton tree and mesh panel
FTabManager::NewSplitter()
->SetOrientation(Orient_Vertical)
->SetSizeCoefficient(0.3f)
->Split
(
FTabManager::NewStack()
->AddTab( FPersonaTabs::MeshAssetPropertiesID, ETabState::OpenedTab )
)
)
->Split
(
// Middle 1/3rd - Viewport
FTabManager::NewSplitter()
->SetOrientation(Orient_Vertical)
->SetSizeCoefficient(0.5f)
->Split
(
FTabManager::NewStack()
->SetHideTabWell(true)
->AddTab( FPersonaTabs::PreviewViewportID, ETabState::OpenedTab )
)
)
->Split
(
// Right 1/3rd - Details panel and quick browser
FTabManager::NewSplitter()
->SetOrientation(Orient_Vertical)
->SetSizeCoefficient(0.2f)
->Split
(
FTabManager::NewStack()
->AddTab( FPersonaTabs::MorphTargetsID, ETabState::OpenedTab )
)
)
)
);
}
/////////////////////////////////////////////////////
#undef LOCTEXT_NAMESPACE