Copying //UE4/Dev-Enterprise @ cl 6890376 to Dev-Main (//UE4/Dev-Main)

#lockdown nick.penwarden
#rb none

[CL 6890764 by JeanMichel Dignard in Main branch]
This commit is contained in:
JeanMichel Dignard
2019-06-07 11:22:52 -04:00
parent 24c5f55936
commit 0f9ad96858
1390 changed files with 104382 additions and 32760 deletions
@@ -0,0 +1,73 @@
// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
class FStructViewerInitializationOptions;
/** Interface class for creating filters for the Struct Viewer. */
class IStructViewerFilter
{
public:
virtual ~IStructViewerFilter() = default;
/**
* Checks if a struct is allowed by this filter.
*
* @param InInitOptions The Struct Viewer/Picker options.
* @param InStruct The struct to be tested.
* @param InFilterFuncs Useful functions for filtering.
*/
virtual bool IsStructAllowed(const FStructViewerInitializationOptions& InInitOptions, const UScriptStruct* InStruct, TSharedRef<class FStructViewerFilterFuncs> InFilterFuncs) = 0;
/**
* Checks if a struct is allowed by this filter.
*
* @param InInitOptions The Struct Viewer/Picker options.
* @param InStructPath The path of the unloaded struct to be tested.
* @param InFilterFuncs Useful functions for filtering.
*/
virtual bool IsUnloadedStructAllowed(const FStructViewerInitializationOptions& InInitOptions, const FName InStructPath, TSharedRef<class FStructViewerFilterFuncs> InFilterFuncs) = 0;
};
enum class EStructFilterReturn : uint8
{
Failed = 0,
Passed,
NoItems,
};
class STRUCTVIEWER_API FStructViewerFilterFuncs
{
public:
virtual ~FStructViewerFilterFuncs() = default;
/**
* Checks if the given struct is a child-of any of the structs in a set.
*
* @param InSet The set to test against.
* @param InStruct The struct to test against.
*
* @return EFilterReturn::Passed if it is a child-of a struct in the set, EFilterReturn::Failed if it is not, EFilterReturn::NoItems if the set is empty.
*/
virtual EStructFilterReturn IfInChildOfStructsSet(TSet<const UScriptStruct*>& InSet, const UScriptStruct* InStruct);
/**
* Checks if the given struct is a child-of ALL of the classes in a set.
*
* @param InSet The set to test against.
* @param InStruct The struct to test against.
*
* @return EFilterReturn::Passed if it is a child-of ALL the structs in the set, EFilterReturn::Failed if it is not, EFilterReturn::NoItems if the set is empty.
*/
virtual EStructFilterReturn IfMatchesAllInChildOfStructsSet(TSet<const UScriptStruct*>& InSet, const UScriptStruct* InStruct);
/**
* Checks if the struct is in the structs set.
*
* @param InSet The set to test against.
* @param InStruct The struct to test against.
*
* @return EFilterReturn::Passed if the struct is in the structs set, EFilterReturn::Failed if it is not, EFilterReturn::NoItems if the set is empty.
*/
virtual EStructFilterReturn IfInStructsSet(TSet<const UScriptStruct*>& InSet, const UScriptStruct* InStruct);
};
@@ -0,0 +1,134 @@
// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "Modules/ModuleInterface.h"
class IStructViewerFilter;
class IPropertyHandle;
/** Delegate used with the Struct Viewer in 'struct picking' mode. You'll bind a delegate when the struct viewer widget is created, which will be fired off when a struct is selected in the list */
DECLARE_DELEGATE_OneParam(FOnStructPicked, const UScriptStruct*);
enum class EStructViewerMode : uint8
{
/** Allows all structs to be browsed and selected; syncs selection with the editor; drag and drop attachment, etc. */
StructBrowsing,
/** Sets the struct viewer to operate as a struct 'picker'. */
StructPicker,
};
enum class EStructViewerDisplayMode : uint8
{
/** Default will choose what view mode based on if in Viewer or Picker mode. */
DefaultView,
/** Displays all classes as a tree. */
TreeView,
/** Displays all classes as a list. */
ListView,
};
enum class EStructViewerNameTypeToDisplay : uint8
{
/** Display both the display name and struct name if they're available and different. */
Dynamic,
/** Always use the display name */
DisplayName,
/** Always use the struct name */
StructName,
};
/**
* Settings for the Struct Viewer set by the programmer before spawning an instance of the widget. This
* is used to modify the struct viewer's behavior in various ways, such as filtering in or out specific structs.
*/
class FStructViewerInitializationOptions
{
public:
/** The filter to use on structs in this instance. */
TSharedPtr<class IStructViewerFilter> StructFilter;
/** Mode to operate in */
EStructViewerMode Mode;
/** Mode to display the structs using. */
EStructViewerDisplayMode DisplayMode;
/** Shows unloaded structs. Will not be filtered out based on non-bool filter options. */
bool bShowUnloadedStructs;
/** Shows a "None" option, only available in Picker mode. */
bool bShowNoneOption;
/** If true, root nodes will be expanded by default. */
bool bExpandRootNodes;
/** true allows struct dynamic loading on selection */
bool bEnableStructDynamicLoading;
/** Controls what name is shown for structs */
EStructViewerNameTypeToDisplay NameTypeToDisplay;
/** the title string of the struct viewer if required. */
FText ViewerTitleString;
/** The property this struct viewer be working on. */
TSharedPtr<class IPropertyHandle> PropertyHandle;
/** true (the default) shows the view options at the bottom of the struct picker. */
bool bAllowViewOptions;
/** true (the default) shows a background border behind the struct viewer widget. */
bool bShowBackgroundBorder;
/** Defines additional structs you want listed in the "Common Structs" section for the picker. */
TArray<const UScriptStruct*> ExtraPickerCommonStructs;
public:
/** Constructor */
FStructViewerInitializationOptions()
: Mode(EStructViewerMode::StructPicker)
, DisplayMode(EStructViewerDisplayMode::DefaultView)
, bShowUnloadedStructs(true)
, bShowNoneOption(false)
, bExpandRootNodes(true)
, bEnableStructDynamicLoading(true)
, NameTypeToDisplay(EStructViewerNameTypeToDisplay::StructName)
, bAllowViewOptions(true)
, bShowBackgroundBorder(true)
{
}
};
/**
* Struct Viewer module
*/
class FStructViewerModule : public IModuleInterface
{
public:
/**
* Called right after the module DLL has been loaded and the module object has been created
*/
virtual void StartupModule();
/**
* Called before the module is unloaded, right before the module object is destroyed.
*/
virtual void ShutdownModule();
/**
* Creates a struct viewer widget
*
* @param InitOptions Programmer-driven configuration for this widget instance
* @param OnStructPickedDelegate Optional callback when a struct is selected in 'struct picking' mode
*
* @return New struct viewer widget
*/
virtual TSharedRef<class SWidget> CreateStructViewer(const FStructViewerInitializationOptions& InitOptions, const FOnStructPicked& OnStructPickedDelegate);
};
@@ -0,0 +1,28 @@
// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "UObject/Object.h"
#include "UObject/SoftObjectPtr.h"
#include "Engine/EngineTypes.h"
#include "StructViewerProjectSettings.generated.h"
/**
* Implements the settings for the Struct Viewer Project Settings
*/
UCLASS(config=Engine, defaultconfig)
class STRUCTVIEWER_API UStructViewerProjectSettings : public UObject
{
GENERATED_UCLASS_BODY()
#if WITH_EDITORONLY_DATA
/** The base directories to be considered Internal Only for the struct picker.*/
UPROPERTY(EditAnywhere, config, Category = StructVisibilityManagement, meta = (DisplayName = "List of directories to consider Internal Only.", ContentDir, LongPackageName))
TArray<FDirectoryPath> InternalOnlyPaths;
/** The base classes to be considered Internal Only for the struct picker.*/
UPROPERTY(EditAnywhere, config, Category = StructVisibilityManagement, meta = (DisplayName = "List of base structs to consider Internal Only.", ShowTreeView, HideViewOptions))
TArray<TSoftObjectPtr<const UScriptStruct>> InternalOnlyStructs;
#endif
};