2014-12-07 19:09:38 -05:00
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
2014-03-14 14:13:41 -04:00
# include "PersonaPrivatePCH.h"
# include "Persona.h"
# include "Editor/Kismet/Public/BlueprintEditorTabs.h"
# include "Editor/KismetWidgets/Public/SSingleObjectDetailsPanel.h"
# include "AnimationMode.h"
# include "IDocumentation.h"
# define LOCTEXT_NAMESPACE "PersonaAnimationMode"
/////////////////////////////////////////////////////
// SAnimAssetPropertiesTabBody
class SAnimAssetPropertiesTabBody : public SSingleObjectDetailsPanel
{
public :
SLATE_BEGIN_ARGS ( SAnimAssetPropertiesTabBody ) { }
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 ;
2015-04-10 02:12:40 -04:00
SSingleObjectDetailsPanel : : Construct ( SSingleObjectDetailsPanel : : FArguments ( ) . HostCommandList ( InPersona - > GetToolkitCommands ( ) ) , true , true ) ;
2014-03-14 14:13:41 -04:00
}
virtual EVisibility GetAssetDisplayNameVisibility ( ) const
{
return ( GetObjectToObserve ( ) ! = NULL ) ? EVisibility : : Visible : EVisibility : : Collapsed ;
}
2015-01-07 09:52:40 -05:00
virtual FText GetAssetDisplayName ( ) const
2014-03-14 14:13:41 -04:00
{
if ( UObject * Object = GetObjectToObserve ( ) )
{
2015-01-07 09:52:40 -05:00
return FText : : FromString ( Object - > GetName ( ) ) ;
2014-03-14 14:13:41 -04:00
}
else
{
2015-01-07 09:52:40 -05:00
return FText : : GetEmpty ( ) ;
2014-03-14 14:13:41 -04:00
}
}
// SSingleObjectDetailsPanel interface
2014-06-13 06:14:46 -04:00
virtual UObject * GetObjectToObserve ( ) const override
2014-03-14 14:13:41 -04:00
{
return PersonaPtr . Pin ( ) - > GetAnimationAssetBeingEdited ( ) ;
}
2014-06-13 06:14:46 -04:00
virtual TSharedRef < SWidget > PopulateSlot ( TSharedRef < SWidget > PropertyEditorWidget ) override
2014-03-14 14:13:41 -04:00
{
return SNew ( SVerticalBox )
+ SVerticalBox : : Slot ( )
. AutoHeight ( )
[
// Header, shows name of the blend space we are editing
SNew ( SBorder )
. BorderImage ( FEditorStyle : : GetBrush ( TEXT ( " Graph.TitleBackground " ) ) )
. HAlign ( HAlign_Center )
. Visibility ( this , & SAnimAssetPropertiesTabBody : : GetAssetDisplayNameVisibility )
[
SNew ( SHorizontalBox )
+ SHorizontalBox : : Slot ( )
. AutoWidth ( )
. VAlign ( VAlign_Center )
[
SNew ( STextBlock )
. Font ( FSlateFontInfo ( FPaths : : EngineContentDir ( ) / TEXT ( " Slate/Fonts/Roboto-Regular.ttf " ) , 14 ) )
. ColorAndOpacity ( FLinearColor ( 1 , 1 , 1 , 0.5 ) )
. Text ( this , & SAnimAssetPropertiesTabBody : : GetAssetDisplayName )
]
]
]
+ SVerticalBox : : Slot ( )
. FillHeight ( 1 )
[
PropertyEditorWidget
] ;
}
// End of SSingleObjectDetailsPanel interface
} ;
/////////////////////////////////////////////////////
// FAnimAssetPropertiesSummoner
struct FAnimAssetPropertiesSummoner : public FWorkflowTabFactory
{
FAnimAssetPropertiesSummoner ( TSharedPtr < class FAssetEditorToolkit > InHostingApp ) ;
// FWorkflowTabFactory interface
2014-06-13 06:14:46 -04:00
virtual TSharedRef < SWidget > CreateTabBody ( const FWorkflowTabSpawnInfo & Info ) const override ;
2014-03-14 14:13:41 -04:00
// Create a tooltip widget for the tab
2014-06-13 06:14:46 -04:00
virtual TSharedPtr < SToolTip > CreateTabToolTipWidget ( const FWorkflowTabSpawnInfo & Info ) const override
2014-03-14 14:13:41 -04:00
{
return IDocumentation : : Get ( ) - > CreateToolTip ( LOCTEXT ( " AnimAssetPropertiesTooltip " , " The Anim Asset Details tab lets you edit properties of the selection animation asset (animation, blend space etc). " ) , NULL , TEXT ( " Shared/Editors/Persona " ) , TEXT ( " AnimationAssetDetail_Window " ) ) ;
}
// FWorkflowTabFactory interface
} ;
FAnimAssetPropertiesSummoner : : FAnimAssetPropertiesSummoner ( TSharedPtr < class FAssetEditorToolkit > InHostingApp )
: FWorkflowTabFactory ( FPersonaTabs : : AnimAssetPropertiesID , InHostingApp )
{
TabLabel = LOCTEXT ( " AnimAssetProperties_TabTitle " , " Anim Asset Details " ) ;
2015-04-30 16:52:00 -04:00
TabIcon = FSlateIcon ( FEditorStyle : : GetStyleSetName ( ) , " Persona.Tabs.AnimAssetDetails " ) ;
2014-03-14 14:13:41 -04:00
bIsSingleton = true ;
ViewMenuDescription = LOCTEXT ( " AnimAssetProperties_MenuTitle " , " Anim Asset Details " ) ;
ViewMenuTooltip = LOCTEXT ( " AnimAssetProperties_MenuToolTip " , " Shows the animation asset properties " ) ;
}
TSharedRef < SWidget > FAnimAssetPropertiesSummoner : : CreateTabBody ( const FWorkflowTabSpawnInfo & Info ) const
{
TSharedPtr < FPersona > PersonaApp = StaticCastSharedPtr < FPersona > ( HostingApp . Pin ( ) ) ;
2014-07-22 09:54:58 -04:00
return SNew ( SAnimAssetPropertiesTabBody , PersonaApp ) ;
2014-03-14 14:13:41 -04:00
}
/////////////////////////////////////////////////////
// FAnimEditAppMode
FAnimEditAppMode : : FAnimEditAppMode ( TSharedPtr < FPersona > InPersona )
: FPersonaAppMode ( InPersona , FPersonaModes : : AnimationEditMode )
{
PersonaTabFactories . RegisterFactory ( MakeShareable ( new FSelectionDetailsSummoner ( InPersona ) ) ) ;
PersonaTabFactories . RegisterFactory ( MakeShareable ( new FAnimAssetPropertiesSummoner ( InPersona ) ) ) ;
2014-07-15 13:25:38 -04:00
TabLayout = FTabManager : : NewLayout ( " Persona_AnimEditMode_Layout_v7 " )
2014-03-14 14:13:41 -04:00
- > 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 and Anim properties
FTabManager : : NewSplitter ( )
- > SetOrientation ( Orient_Vertical )
2014-07-15 13:25:38 -04:00
- > SetSizeCoefficient ( 0.3f )
2014-03-14 14:13:41 -04:00
- > Split
(
FTabManager : : NewStack ( )
- > AddTab ( FPersonaTabs : : SkeletonTreeViewID , ETabState : : OpenedTab )
)
- > Split
(
FTabManager : : NewStack ( )
- > AddTab ( FPersonaTabs : : AnimAssetPropertiesID , ETabState : : OpenedTab )
)
)
- > Split
(
// Middle 1/3rd - Viewport and anim document area
FTabManager : : NewSplitter ( )
- > SetOrientation ( Orient_Vertical )
2014-07-15 13:25:38 -04:00
- > SetSizeCoefficient ( 0.4f )
2014-03-14 14:13:41 -04:00
- > Split
(
FTabManager : : NewStack ( )
- > SetHideTabWell ( true )
- > AddTab ( FPersonaTabs : : PreviewViewportID , ETabState : : OpenedTab )
)
- > Split
(
FTabManager : : NewStack ( )
- > AddTab ( " Document " , ETabState : : ClosedTab )
)
)
- > Split
(
// Right 1/3rd - Details panel and quick browser
FTabManager : : NewSplitter ( )
- > SetOrientation ( Orient_Vertical )
2014-07-15 13:25:38 -04:00
- > SetSizeCoefficient ( 0.3f )
2014-03-14 14:13:41 -04:00
- > Split
(
FTabManager : : NewStack ( )
- > AddTab ( FBlueprintEditorTabs : : DetailsID , ETabState : : OpenedTab )
)
- > Split
(
FTabManager : : NewStack ( )
- > AddTab ( FPersonaTabs : : AssetBrowserID , ETabState : : OpenedTab )
)
)
)
) ;
}
# undef LOCTEXT_NAMESPACE