I made one of these things recently and with editor support, check the code bellow for more information:
}
void FRemReflectedFunctionCallDataDetails::OnFunctionNameChanged(const FPropertyChangedEvent& PropertyChangedEvent) const
{
RemCheckVariable(FunctionCallDataPropertyHandle, return;);
auto* FunctionCallData{Rem::Editor::GetStructPtr<FRemReflectedFunctionCallData>(FunctionCallDataPropertyHandle.ToSharedRef())};
RemCheckVariable(FunctionCallData, return;);
const auto SavedFunctionName{FunctionCallData->FunctionData.FunctionName};
FunctionCallData->TryFillParameters();
if (bool bFunctionNameGotRest = !SavedFunctionName.IsNone() && FunctionCallData->FunctionData.FunctionName.IsNone())
{
FNotificationInfo Info(NSLOCTEXT("RemReflectedFunctionCallData", "FunctionIsNotSupported", "Parameter of selected function is not supported"));
Info.bUseThrobber = true;
Info.Image = FAppStyle::GetBrush(FName{TEXTVIEW("MessageLog.Warning")});
Info.FadeOutDuration = 4.0f;
Info.ExpireDuration = Info.FadeOutDuration;
FSlateNotificationManager::Get().AddNotification(Info);
}
{
RemCheckCondition(LocalFunction->HasAllFunctionFlags(EFunctionFlags::FUNC_Static), return;, LogRemCommon, Error,
TEXT("ContextObject is required for member function"));
LocalObject = GetMutableDefault<UObject>(FunctionData.FunctionOwnerClass);
}
LocalObject->ProcessEvent(LocalFunction, Parameters.GetMutableValue().GetMemory());
}
bool FRemReflectedFunctionCallData::TryFillParameters()
{
Parameters.Reset();
if (!FunctionData.FunctionOwnerClass || FunctionData.FunctionName.IsNone())
{
return false;
}
auto* Function = FunctionData.FunctionOwnerClass->FindFunctionByName(FunctionData.FunctionName);
RemCheckVariable(Function, return false;);
RemReflectedFunctionCallData
which support calling a static or memberUFUNCTION
, with almost any parameters
(except parameter of delegate type (or more) for now because of limitation of FInstancedPropertyBag
), and has return value
.
I’m searching for populating default value
for these parameters ATM.