2022-04-01 14:21:11 -04:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2023-01-12 01:48:34 -05:00
|
|
|
#include "Containers/StringFwd.h"
|
2023-06-16 12:57:13 -04:00
|
|
|
#include "Types/MVVMFieldVariant.h"
|
2023-01-12 01:48:34 -05:00
|
|
|
|
|
|
|
|
class FName;
|
|
|
|
|
class FProperty;
|
|
|
|
|
class UObject;
|
|
|
|
|
enum EFunctionFlags : uint32;
|
|
|
|
|
template <typename T> class TSubclassOf;
|
2022-04-01 14:21:11 -04:00
|
|
|
|
|
|
|
|
class FKismetCompilerContext;
|
2022-06-08 13:19:20 -04:00
|
|
|
class UBlueprint;
|
2022-04-01 14:21:11 -04:00
|
|
|
class UEdGraph;
|
2023-06-16 12:57:13 -04:00
|
|
|
class UK2Node_Variable;
|
2022-04-01 14:21:11 -04:00
|
|
|
|
|
|
|
|
namespace UE::MVVM::FunctionGraphHelper
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
/** Generate a function graph that can be viewed in the BP editor. */
|
2023-06-16 12:57:13 -04:00
|
|
|
MODELVIEWVIEWMODELBLUEPRINT_API UEdGraph* CreateFunctionGraph(UBlueprint* Blueprint, const FStringView FunctionName, EFunctionFlags ExtraFunctionFlag, const FStringView Category, bool bIsEditable);
|
2022-04-01 14:21:11 -04:00
|
|
|
|
|
|
|
|
/** Generate a function graph that cannot be viewed in the BP editor. */
|
2022-06-08 13:19:20 -04:00
|
|
|
UEdGraph* CreateIntermediateFunctionGraph(FKismetCompilerContext& Context, const FStringView FunctionName, EFunctionFlags ExtraFunctionFlag, const FStringView Category, bool bIsEditable);
|
2022-04-01 14:21:11 -04:00
|
|
|
|
2023-06-16 12:57:13 -04:00
|
|
|
/** Set the UK2Node_Variable::VariableReference correctly base on the variable's owner. */
|
|
|
|
|
MODELVIEWVIEWMODELBLUEPRINT_API void SetVariableNodeMember(UK2Node_Variable* InVarNode, const FProperty* InProperty, UBlueprint* InTargetBlueprint);
|
|
|
|
|
|
2022-04-01 14:21:11 -04:00
|
|
|
/** Add an input argument to an existing function graph. */
|
2022-06-08 13:19:20 -04:00
|
|
|
bool AddFunctionArgument(UEdGraph* FunctionGraph, TSubclassOf<UObject> Argument, FName ArgumentName);
|
2022-04-01 14:21:11 -04:00
|
|
|
|
2022-04-13 16:06:35 -04:00
|
|
|
/** Add an input argument to an existing function graph. */
|
2023-06-16 12:57:13 -04:00
|
|
|
bool AddFunctionArgument(UEdGraph* FunctionGraph, const FProperty* Argument, FName ArgumentName);
|
2022-04-13 16:06:35 -04:00
|
|
|
|
2022-04-01 14:21:11 -04:00
|
|
|
/** Generate the nodes needed for to call the MVVMView::SetViewModel function. */
|
2022-06-08 13:19:20 -04:00
|
|
|
bool GenerateViewModelSetter(FKismetCompilerContext& Context, UEdGraph* FunctionGraph, FName ViewModelName);
|
2022-04-13 16:06:35 -04:00
|
|
|
|
|
|
|
|
/** Generate the nodes needed for to set the property and to call the broadcast field notify function. */
|
2022-06-08 13:19:20 -04:00
|
|
|
bool GenerateViewModelFieldNotifySetter(FKismetCompilerContext& Context, UEdGraph* FunctionGraph, FProperty* Property, FName InputPinName);
|
2022-04-13 16:06:35 -04:00
|
|
|
|
|
|
|
|
/** Generate the nodes needed to broadcast field notify function. */
|
2022-06-08 13:19:20 -04:00
|
|
|
bool GenerateViewModelFielNotifyBroadcast(FKismetCompilerContext& Context, UEdGraph* FunctionGraph, FProperty* Property);
|
2022-04-01 14:21:11 -04:00
|
|
|
|
2023-06-16 12:57:13 -04:00
|
|
|
/** Generate the nodes needed for to set a variable/function value. */
|
|
|
|
|
bool GenerateSetter(UBlueprint* Blueprint, UEdGraph* FunctionGraph, TArrayView<UE::MVVM::FMVVMConstFieldVariant> SetterPath);
|
2023-07-26 13:51:11 -04:00
|
|
|
|
2023-06-16 12:57:13 -04:00
|
|
|
/** Generate the nodes needed to set a variable/function value. To use while while compiling the Blueprint. */
|
|
|
|
|
bool GenerateIntermediateSetter(FKismetCompilerContext& Context, UEdGraph* FunctionGraph, TArrayView<UE::MVVM::FMVVMConstFieldVariant> SetterPath);
|
|
|
|
|
|
2023-01-12 01:48:34 -05:00
|
|
|
} //namespace
|