Files
UnrealEngineUWP/Engine/Source/Editor/DetailCustomizations/Private/DirectoryPathStructCustomization.cpp
Max Chen 4cde9c20a0 Copying //UE4/Dev-Sequencer to //UE4/Main
==========================
MAJOR FEATURES + CHANGES
==========================

Change 2875025 on 2016/02/20 by Andrew.Rodham

	Sequencer: Cinematic viewport improvements
	  - Added optional letterbox overlay (defaults to 2.35:1)
	  - Added ability to change safe frame colors
	  - Added selected tracks' keys to the transport range
	  - Added buttons for jumping between selected tracks' keyframes on the transport controls
	  - Removed black padding around the viewport where possible
	  - Added ability to specify whether a combo button/menu anchor should close when its parent receives focus
	  - Separated logic of FGroupedKeyArea into FSequencerKeyCollection, so it can be used independently
	  - Added playback range to the viewport frame numbers
	  - All frame numbers are now spin boxes

	#jira UE-26429

Change 2875026 on 2016/02/20 by Thomas.Sarkanen

	Added console commands for recording sequences

	Changed plugin to a developer plugin so we can load it when the editor is in -game mode.
	Added Exec commands.
	Added some more logging to help diagnose problems when using commands.
	Added loading/saving of config for recorder settings (stored in Editor.ini).
	Also disabled controls in recorder window when recording.
	Added auto-saving of assets when in non-editor modes.
	Moved animation settings from UnrealEd to Engine module.

Change 2875036 on 2016/02/20 by Max.Chen

	Sequencer: Call RedrawAllViewports instead of RedrawLevelEditingViewports. In particular, this fixes some update issues when editing values in the key editors.

	#jira UE-26960

Change 2875046 on 2016/02/20 by Max.Preussner

	Sequencer: Fix so that clicking on UMG Animations doesn't dirty the scene.

	#jira UE-26249

Change 2875047 on 2016/02/20 by Max.Chen

	Sequencer: Add option to toggle display of channel colors/lines. View->Channel Colors

Change 2877138 on 2016/02/23 by Max.Chen

	Sequencer: Select corresponding track node when selecting key or section. Removed active/inactive selection since it was only being used in deletion and the rules for deletion are now dependent upon what is selected - delete keys and sections before deleting outliner nodes.

Change 2877143 on 2016/02/23 by Thomas.Sarkanen

	Added new math function: WindRelativeAnglesDegrees

	Given two angles in degrees, 'wind' the angle in Angle1 so that it avoids >180 degree flips.
	Good for winding rotations previously expressed as quaternions into a euler-angle representation.

Change 2877147 on 2016/02/23 by Thomas.Sarkanen

	Added the ability to import sequencer transforms from the root node of an animation sequence

	Intended for use after re-importing animations from DCC tools.
	Available in the right-click menu for transform tracks.
	Also added FindTrackBinding to UMovieScene so track bindings can be recovered from tracks.

Change 2877163 on 2016/02/23 by Max.Chen

	Sequencer: Add option to create keyframe sections as infinite. Sequencer defaults to true, UMG defaults to false.

Change 2877165 on 2016/02/23 by Max.Preussner

	Sequencer: Drawing vertical position lines when dragging keys

Change 2878748 on 2016/02/23 by Max.Chen

	Curve Editor: Switch curve type to user when flatting or straightening tangents.

	#jira UE-27277

Change 2878799 on 2016/02/23 by Frank.Fella

	Sequencer - Add folders support to the outliner.

Change 2880769 on 2016/02/24 by Andrew.Rodham

	Sequencer: Added ability to override runtime spawnable ownership in sequencer
	  - This is exposed as an option on spawnables "Keep Alive Outside Playback Range (In Sequencer)"
	  - Enabling this will stop spawnables from being destroyed when scrubbing outside of the playback range

	#jira UE-27205

Change 2880770 on 2016/02/24 by Thomas.Sarkanen

	Sequencer: Added countdown and recording indicator display when recording

	Also fixed extra popups added post-PIE when animation recordings auto shutdown.

Change 2880782 on 2016/02/24 by Max.Chen

	Sequencer: Snapping now also uses the current time as a possible snap time.

	#jira UE-26306

Change 2880793 on 2016/02/24 by Max.Chen

	Sequencer: Add +Animation to Animation track so that it's consistent with all other tracks that have a + button.

Change 2880812 on 2016/02/24 by Max.Chen

	Sequencer: Fix adjusting the leading edge of a shot section so that it cuts into the shot rather than adjusts the start time.

	#jira UE-26306

Change 2881624 on 2016/02/25 by Andrew.Rodham

	Changing shader version GUID to fix corrupt shaders in ddc

Change 2882408 on 2016/02/25 by Thomas.Sarkanen

	Asset/actors stored in TLazyObjectPtrs can now reference game content from engine

	This is a legitimate use case as lazy object ptrs are designed to reference assets/actors cross-domain.

Change 2882409 on 2016/02/25 by Thomas.Sarkanen

[CL 2899785 by Max Chen in Main branch]
2016-03-08 16:55:04 -05:00

175 lines
5.8 KiB
C++

// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
#include "DetailCustomizationsPrivatePCH.h"
#include "DirectoryPathStructCustomization.h"
#include "DesktopPlatformModule.h"
#include "ContentBrowserDelegates.h"
#include "ContentBrowserModule.h"
#define LOCTEXT_NAMESPACE "DirectoryPathStructCustomization"
TSharedRef<IPropertyTypeCustomization> FDirectoryPathStructCustomization::MakeInstance()
{
return MakeShareable(new FDirectoryPathStructCustomization());
}
void FDirectoryPathStructCustomization::CustomizeHeader( TSharedRef<IPropertyHandle> StructPropertyHandle, class FDetailWidgetRow& HeaderRow, IPropertyTypeCustomizationUtils& StructCustomizationUtils )
{
TSharedPtr<IPropertyHandle> PathProperty = StructPropertyHandle->GetChildHandle("Path");
const bool bRelativeToGameContentDir = StructPropertyHandle->HasMetaData( TEXT("RelativeToGameContentDir") );
const bool bUseRelativePath = StructPropertyHandle->HasMetaData( TEXT("RelativePath") );
const bool bContentDir = StructPropertyHandle->HasMetaData( TEXT("ContentDir") );
AbsoluteGameContentDir = FPaths::ConvertRelativePathToFull(FPaths::GameContentDir());
if(PathProperty.IsValid())
{
TSharedPtr<SWidget> PickerWidget = nullptr;
if(bContentDir)
{
FPathPickerConfig PathPickerConfig;
PathPickerConfig.bAllowContextMenu = false;
PathPickerConfig.OnPathSelected = FOnPathSelected::CreateSP(this, &FDirectoryPathStructCustomization::OnPathPicked, PathProperty.ToSharedRef());
FContentBrowserModule& ContentBrowserModule = FModuleManager::LoadModuleChecked<FContentBrowserModule>("ContentBrowser");
PickerWidget = SAssignNew(PickerButton, SComboButton)
.ButtonStyle( FEditorStyle::Get(), "HoverHintOnly" )
.ToolTipText( LOCTEXT( "FolderComboToolTipText", "Choose a content directory") )
.ContentPadding( 2.0f )
.ForegroundColor( FSlateColor::UseForeground() )
.IsFocusable( false )
.MenuContent()
[
SNew(SBox)
.WidthOverride(300.0f)
.HeightOverride(300.0f)
[
ContentBrowserModule.Get().CreatePathPicker(PathPickerConfig)
]
];
}
else
{
PickerWidget = SAssignNew(BrowseButton, SButton)
.ButtonStyle( FEditorStyle::Get(), "HoverHintOnly" )
.ToolTipText( LOCTEXT( "FolderButtonToolTipText", "Choose a directory from this computer") )
.OnClicked( FOnClicked::CreateSP(this, &FDirectoryPathStructCustomization::OnPickDirectory, PathProperty.ToSharedRef(), bRelativeToGameContentDir, bUseRelativePath) )
.ContentPadding( 2.0f )
.ForegroundColor( FSlateColor::UseForeground() )
.IsFocusable( false )
[
SNew( SImage )
.Image( FEditorStyle::GetBrush("PropertyWindow.Button_Ellipsis") )
.ColorAndOpacity( FSlateColor::UseForeground() )
];
}
HeaderRow.ValueContent()
.MinDesiredWidth(125.0f)
.MaxDesiredWidth(600.0f)
[
SNew(SHorizontalBox)
+SHorizontalBox::Slot()
.FillWidth(1.0f)
.VAlign(VAlign_Center)
[
PathProperty->CreatePropertyValueWidget()
]
+SHorizontalBox::Slot()
.AutoWidth()
.Padding(FMargin(4.0f, 0.0f, 0.0f, 0.0f))
.VAlign(VAlign_Center)
[
PickerWidget.ToSharedRef()
]
]
.NameContent()
[
StructPropertyHandle->CreatePropertyNameWidget()
];
}
}
void FDirectoryPathStructCustomization::CustomizeChildren( TSharedRef<IPropertyHandle> StructPropertyHandle, class IDetailChildrenBuilder& StructBuilder, IPropertyTypeCustomizationUtils& StructCustomizationUtils )
{
}
FReply FDirectoryPathStructCustomization::OnPickDirectory(TSharedRef<IPropertyHandle> PropertyHandle, const bool bRelativeToGameContentDir, const bool bUseRelativePath) const
{
FString Directory;
IDesktopPlatform* DesktopPlatform = FDesktopPlatformModule::Get();
if ( DesktopPlatform )
{
TSharedPtr<SWindow> ParentWindow = FSlateApplication::Get().FindWidgetWindow(BrowseButton.ToSharedRef());
void* ParentWindowHandle = (ParentWindow.IsValid() && ParentWindow->GetNativeWindow().IsValid()) ? ParentWindow->GetNativeWindow()->GetOSWindowHandle() : nullptr;
FString StartDirectory = FEditorDirectories::Get().GetLastDirectory(ELastDirectory::GENERIC_IMPORT);
if(bRelativeToGameContentDir && !IsValidPath(StartDirectory, bRelativeToGameContentDir))
{
StartDirectory = AbsoluteGameContentDir;
}
// Loop until; a) the user cancels (OpenDirectoryDialog returns false), or, b) the chosen path is valid (IsValidPath returns true)
for(;;)
{
if( DesktopPlatform->OpenDirectoryDialog(ParentWindowHandle, LOCTEXT("FolderDialogTitle", "Choose a directory").ToString(), StartDirectory, Directory) )
{
FText FailureReason;
if( IsValidPath(Directory, bRelativeToGameContentDir, &FailureReason) )
{
FEditorDirectories::Get().SetLastDirectory(ELastDirectory::GENERIC_IMPORT, Directory);
if( bRelativeToGameContentDir )
{
Directory = Directory.RightChop(AbsoluteGameContentDir.Len());
}
if( bUseRelativePath )
{
Directory = IFileManager::Get().ConvertToRelativePath(*Directory);
}
PropertyHandle->SetValue(Directory);
}
else
{
StartDirectory = Directory;
FMessageDialog::Open(EAppMsgType::Ok, FailureReason);
continue;
}
}
break;
}
}
return FReply::Handled();
}
bool FDirectoryPathStructCustomization::IsValidPath(const FString& AbsolutePath, const bool bRelativeToGameContentDir, FText* const OutReason) const
{
if(bRelativeToGameContentDir)
{
if(!AbsolutePath.StartsWith(AbsoluteGameContentDir))
{
if(OutReason)
{
*OutReason = FText::Format(LOCTEXT("Error_InvalidRootPath", "The chosen directory must be within {0}"), FText::FromString(AbsoluteGameContentDir));
}
return false;
}
}
return true;
}
void FDirectoryPathStructCustomization::OnPathPicked(const FString& Path, TSharedRef<IPropertyHandle> PropertyHandle)
{
PickerButton->SetIsOpen(false);
PropertyHandle->SetValue(Path);
}
#undef LOCTEXT_NAMESPACE