slarti
February 5, 2016, 3:21pm
2
While this is no technical answer, I think having that many parameters gets unwieldy in any situation. An alternative is to use a wrapper struct to pass any amount of parameters using the OneParam variant.
See for example the ComponentHit or Overlap signatures that use a FHitResult as a parameter to pass multiple variables.
In my case I’m actually going from an FStruct to individual parameters to simplify how many steps are in the blueprints.
The existing code requires a ton of BreakToParameters nodes which over complicates the blueprints.
I created a C# console program to generate up to a configurable number of parameters:
http://tagenigma.com/unreal/DelegateGeneration/Program.cs
Here is the generated DelegateCombinations_Variadics.h generated up to 50 parameters:
http://tagenigma.com/unreal/DelegateGeneration/DelegateCombinations_Variadics.h
Here’s a unit test.
DECLARE_DYNAMIC_DELEGATE_TenParams(FDelegateOnSuccessTest, int32, a1, int32, a2, int32, a3, int32, a4, int32, a5, int32, a6, int32, a7, int32, a8, int32, a9, int32, a10);
I’m getting an error:
Unable to parse delegate declaration; expected 'DECLARE_DYNAMIC_DELEGATE' but found 'DECLARE_DYNAMIC_DELEGATE_TenParams'.
2>Error : Failed to generate code for ExampleProjectEditor - error code: OtherCompilationError (5)
Looks like I also need to generate DelegateCombinations.h … okay.
Time to start using version control.
I created a C# console program to generate up to a configurable number of parameters:
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
namespace UnrealDelegateMacros
{
class Program
{
const int MAX_NUMBER_OF_PARAMETERS = 50;
static string GetStringNumber(int i)
{
return HumanFriendlyInteger.IntegerToWritten(i).Replace(" ", "");
}
static void Main(string[] args)
{
#region DelegateCombinations
This file has been truncated. show original
Here is the generated DelegateCombinations_Variadics.h generated up to 50 parameters:
http://tagenigma.com/unreal/DelegateGeneration/DelegateCombinations_Variadics.h
You can right click any struct pin and split it, reducing number of steps back to original
Why don’t you submit that to Epic? But you need to prepare your code to cooperate with rest of UE4 tools, so it would feel seemless
In my case I’m trying to mirror a Java API and I will smite this parameter limitation.
Here is the generated DelegateCombinations_Variadics.h generated up to 50 parameters: http://tagenigma.com/unreal/DelegateGeneration/DelegateCombinations_Variadics.h
Here is the generated DelegateCombinations.h generated up to 50 parameters: http://tagenigma.com/unreal/DelegateGeneration/DelegateCombinations.h
I created a C# console program to generate up to a configurable number of parameters: UnrealTools/Program.cs at master · tgraupmann/UnrealTools · GitHub
Sweet now it works! The unreal header tool needed to register the newer parameters.
http://tagenigma.com/unreal/DelegateGeneration/HeaderParser.cpp
The technical limitation is 128 parameters. And so 62 is the max number of delegate parameters that can be supported.
Unfortunately, coding standards block this change from happening. The staff were worried 20k of macros might negatively impact compile times.