2022-09-23 20:46:19 -04:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "Engine/DeveloperSettings.h"
|
2023-01-31 10:21:03 -05:00
|
|
|
|
2022-09-23 20:46:19 -04:00
|
|
|
#include "MVVMDeveloperProjectSettings.generated.h"
|
|
|
|
|
|
2024-01-12 10:07:58 -05:00
|
|
|
class UK2Node;
|
2023-02-09 16:22:43 -05:00
|
|
|
enum class EMVVMBlueprintViewModelContextCreationType : uint8;
|
|
|
|
|
enum class EMVVMExecutionMode : uint8;
|
|
|
|
|
|
2022-09-23 20:46:19 -04:00
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
USTRUCT()
|
|
|
|
|
struct FMVVMDeveloperProjectWidgetSettings
|
|
|
|
|
{
|
|
|
|
|
GENERATED_BODY()
|
|
|
|
|
|
|
|
|
|
/** Properties or functions name that should not be use for binding (read or write). */
|
2023-01-17 18:39:09 -05:00
|
|
|
UPROPERTY(EditAnywhere, config, Category = "Viewmodel")
|
2022-09-23 20:46:19 -04:00
|
|
|
TSet<FName> DisallowedFieldNames;
|
|
|
|
|
|
|
|
|
|
/** Properties or functions name that are displayed in the advanced category. */
|
2023-01-17 18:39:09 -05:00
|
|
|
UPROPERTY(EditAnywhere, config, Category = "Viewmodel")
|
2022-09-23 20:46:19 -04:00
|
|
|
TSet<FName> AdvancedFieldNames;
|
|
|
|
|
};
|
|
|
|
|
|
2023-03-23 15:27:54 -04:00
|
|
|
UENUM()
|
|
|
|
|
enum class EFilterFlag : uint8
|
|
|
|
|
{
|
|
|
|
|
None = 0,
|
|
|
|
|
All = 1 << 0
|
|
|
|
|
};
|
|
|
|
|
ENUM_CLASS_FLAGS(EFilterFlag)
|
|
|
|
|
|
|
|
|
|
USTRUCT()
|
|
|
|
|
struct FMVVMViewBindingFilterSettings
|
|
|
|
|
{
|
|
|
|
|
GENERATED_BODY()
|
|
|
|
|
|
|
|
|
|
/** Filter out the properties and functions that are not valid in the context of the binding. */
|
|
|
|
|
UPROPERTY(EditAnywhere, config, Category = "Viewmodel")
|
|
|
|
|
EFilterFlag FilterFlags = EFilterFlag::None;
|
|
|
|
|
};
|
|
|
|
|
|
2023-02-08 12:16:32 -05:00
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
UENUM()
|
|
|
|
|
enum class EMVVMDeveloperConversionFunctionFilterType : uint8
|
|
|
|
|
{
|
|
|
|
|
BlueprintActionRegistry,
|
|
|
|
|
AllowedList,
|
|
|
|
|
};
|
|
|
|
|
|
2022-09-23 20:46:19 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Implements the settings for the MVVM Editor
|
|
|
|
|
*/
|
|
|
|
|
UCLASS(config=ModelViewViewModel, defaultconfig)
|
|
|
|
|
class MODELVIEWVIEWMODELBLUEPRINT_API UMVVMDeveloperProjectSettings : public UDeveloperSettings
|
|
|
|
|
{
|
|
|
|
|
GENERATED_BODY()
|
|
|
|
|
|
|
|
|
|
public:
|
2023-01-31 10:21:03 -05:00
|
|
|
UMVVMDeveloperProjectSettings();
|
|
|
|
|
|
2022-09-23 20:46:19 -04:00
|
|
|
virtual FName GetCategoryName() const override;
|
|
|
|
|
virtual FText GetSectionText() const override;
|
|
|
|
|
|
2023-10-05 18:27:37 -04:00
|
|
|
|
2023-11-15 13:51:32 -05:00
|
|
|
bool PropertyHasFiltering(const UStruct* ObjectStruct, const FProperty* Property) const;
|
|
|
|
|
bool IsPropertyAllowed(const UBlueprint* Context, const UStruct* ObjectStruct, const FProperty* Property) const;
|
|
|
|
|
bool IsFunctionAllowed(const UBlueprint* Context, const UClass* ObjectClass, const UFunction* Function) const;
|
2023-10-20 09:15:33 -04:00
|
|
|
bool IsConversionFunctionAllowed(const UBlueprint* Context, const UFunction* Function) const;
|
2024-01-12 10:07:58 -05:00
|
|
|
bool IsConversionFunctionAllowed(const UBlueprint* Context, const TSubclassOf<UK2Node> Function) const;
|
2022-09-23 20:46:19 -04:00
|
|
|
|
2023-01-31 10:21:03 -05:00
|
|
|
bool IsExecutionModeAllowed(EMVVMExecutionMode ExecutionMode) const
|
|
|
|
|
{
|
|
|
|
|
return AllowedExecutionMode.Contains(ExecutionMode);
|
|
|
|
|
}
|
|
|
|
|
|
2023-02-09 16:22:43 -05:00
|
|
|
bool IsContextCreationTypeAllowed(EMVVMBlueprintViewModelContextCreationType ContextCreationType) const
|
|
|
|
|
{
|
|
|
|
|
return AllowedContextCreationType.Contains(ContextCreationType);
|
|
|
|
|
}
|
|
|
|
|
|
2023-02-08 12:16:32 -05:00
|
|
|
EMVVMDeveloperConversionFunctionFilterType GetConversionFunctionFilter() const
|
|
|
|
|
{
|
|
|
|
|
return ConversionFunctionFilter;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TArray<const UClass*> GetAllowedConversionFunctionClasses() const;
|
|
|
|
|
|
2022-09-23 20:46:19 -04:00
|
|
|
private:
|
|
|
|
|
/** Permission list for filtering which properties are visible in UI. */
|
2023-01-17 18:39:09 -05:00
|
|
|
UPROPERTY(EditAnywhere, config, Category = "Viewmodel")
|
2022-09-23 20:46:19 -04:00
|
|
|
TMap<FSoftClassPath, FMVVMDeveloperProjectWidgetSettings> FieldSelectorPermissions;
|
2023-01-31 10:21:03 -05:00
|
|
|
|
|
|
|
|
/** Permission list for filtering which execution mode is allowed. */
|
|
|
|
|
UPROPERTY(EditAnywhere, config, Category = "Viewmodel")
|
|
|
|
|
TSet<EMVVMExecutionMode> AllowedExecutionMode;
|
2023-02-09 16:22:43 -05:00
|
|
|
|
|
|
|
|
/** Permission list for filtering which context creation type is allowed. */
|
|
|
|
|
UPROPERTY(EditAnywhere, config, Category = "Viewmodel")
|
|
|
|
|
TSet<EMVVMBlueprintViewModelContextCreationType> AllowedContextCreationType;
|
2023-02-08 12:16:32 -05:00
|
|
|
|
|
|
|
|
public:
|
2023-02-09 16:22:43 -05:00
|
|
|
/** Binding can be made from the DetailView Bind option. */
|
|
|
|
|
UPROPERTY(EditAnywhere, config, Category = "Viewmodel")
|
|
|
|
|
bool bAllowBindingFromDetailView = true;
|
|
|
|
|
|
2023-03-22 13:07:37 -04:00
|
|
|
/** When generating a source in the viewmodel editor, allow the compiler to generate a setter function. */
|
2023-03-10 23:20:09 -05:00
|
|
|
UPROPERTY(EditAnywhere, config, Category = "Viewmodel")
|
|
|
|
|
bool bAllowGeneratedViewModelSetter = true;
|
2023-03-22 13:07:37 -04:00
|
|
|
|
|
|
|
|
/** When generating a binding with a long source path, allow the compiler to generate a new viewmodel source. */
|
|
|
|
|
UPROPERTY(EditAnywhere, config, Category = "Viewmodel")
|
|
|
|
|
bool bAllowLongSourcePath = true;
|
2023-03-10 23:20:09 -05:00
|
|
|
|
|
|
|
|
/** For the binding list widget, allow the user to edit the binding in the detail view. */
|
|
|
|
|
UPROPERTY(EditAnywhere, config, Category = "Viewmodel")
|
|
|
|
|
bool bShowDetailViewOptionInBindingPanel = true;
|
2023-08-05 11:47:54 -04:00
|
|
|
|
|
|
|
|
/** For the binding list widget and the viewmodel panel, allow the user to edit the view settings in the detail view. */
|
|
|
|
|
UPROPERTY(EditAnywhere, config, Category = "Viewmodel")
|
|
|
|
|
bool bShowViewSettings = true;
|
2023-03-10 23:20:09 -05:00
|
|
|
|
2023-12-07 10:20:55 -05:00
|
|
|
/** For the binding list widget, allow the user to generate a copy of the binding/event graph. */
|
|
|
|
|
UPROPERTY(EditAnywhere, config, Category = "Viewmodel")
|
|
|
|
|
bool bShowDeveloperGenerateGraphSettings = true;
|
|
|
|
|
|
2023-07-26 14:04:59 -04:00
|
|
|
/** When a conversion function requires a wrapper graph, add and save the generated graph to the blueprint. */
|
|
|
|
|
UPROPERTY(EditAnywhere, config, Category = "Viewmodel")
|
2023-11-17 14:09:15 -05:00
|
|
|
bool bAllowConversionFunctionGeneratedGraphInEditor = false;
|
2023-07-26 14:04:59 -04:00
|
|
|
|
2023-08-23 08:39:32 -04:00
|
|
|
/** When binding to a multicast delegate property, allow to create an event. */
|
|
|
|
|
UPROPERTY(EditAnywhere, config, Category = "Viewmodel")
|
|
|
|
|
bool bAllowBindingEvent = true;
|
2023-08-28 08:59:49 -04:00
|
|
|
|
|
|
|
|
/** Allow to create an instanced viewmodel directly in the view editor. */
|
|
|
|
|
UPROPERTY(EditAnywhere, config, Category = "Viewmodel")
|
|
|
|
|
bool bCanCreateViewModelInView = false;
|
2023-08-23 08:39:32 -04:00
|
|
|
|
2024-01-19 11:53:42 -05:00
|
|
|
/**
|
|
|
|
|
* When a viewmodel is set to Create Instance, allow modifying the viewmodel instance in the editor on all instances of the owning widget.
|
|
|
|
|
* The per-viewmodel setting "Expose Instance In Editor" overrides this.
|
|
|
|
|
*/
|
|
|
|
|
UPROPERTY(EditAnywhere, config, Category = "Viewmodel")
|
|
|
|
|
bool bExposeViewModelInstanceInEditor = false;
|
|
|
|
|
|
2023-02-08 12:16:32 -05:00
|
|
|
/** Permission list for filtering which execution mode is allowed. */
|
|
|
|
|
UPROPERTY(EditAnywhere, config, Category = "Viewmodel")
|
|
|
|
|
EMVVMDeveloperConversionFunctionFilterType ConversionFunctionFilter = EMVVMDeveloperConversionFunctionFilterType::BlueprintActionRegistry;
|
|
|
|
|
|
|
|
|
|
/** Individual class that are allowed to be uses as conversion functions. */
|
|
|
|
|
UPROPERTY(EditAnywhere, config, Category = "Viewmodel", meta = (EditCondition = "ConversionFunctionFilter == EMVVMDeveloperConversionFunctionFilterType::AllowedList"))
|
|
|
|
|
TSet<FSoftClassPath> AllowedClassForConversionFunctions;
|
2023-03-23 15:27:54 -04:00
|
|
|
|
|
|
|
|
/** Settings for filtering the list of available properties and functions on binding creation. */
|
|
|
|
|
UPROPERTY(EditAnywhere, config, Category = "Viewmodel")
|
|
|
|
|
FMVVMViewBindingFilterSettings FilterSettings;
|
2022-09-23 20:46:19 -04:00
|
|
|
};
|
2023-01-13 01:54:01 -05:00
|
|
|
|
|
|
|
|
#if UE_ENABLE_INCLUDE_ORDER_DEPRECATED_IN_5_2
|
|
|
|
|
#include "Components/Widget.h"
|
|
|
|
|
#include "CoreMinimal.h"
|
|
|
|
|
#endif
|