How do I create a function with dynamic inputs and output?

29 Views Asked by At

I'm trying to create a generic "switch" node for blueprints that accepts any 2 inputs and outputs one or the other based on a bool input.

In .h:

UFUNCTION(BlueprintPure, CustomThunk, meta = (DisplayName = "BSwitch2", Keywords = "Blender Switch2"), Category = "NodesToScript", CustomStructureParam = "True|False", DeterminesOutputType = "True")
        static void BSwitch2(bool Switch, UProperty* True, UProperty* False);
    static void Generated_BSwitch2(bool Switch, UProperty* True, UProperty* False);

    DECLARE_FUNCTION(execBSwitch2)
    {
        
    }

This is supposed to make the two inputs "wildcards".

This breaks "intelliSense" on Microsoft Visual Studio Community 2019, so I have no idea if it's going right or not.

I'm trying to do it like:enter image description here

But, everything after line 42 makes no sense to me. Also, it's a void, and as far as I can tell doesn't even use the wildcard variables.

In .cpp:

void UMakeBlueprintNodeBPLibrary::BSwitch2(bool Switch, UProperty* True, UProperty* False)
{
    if (Switch)
    {
        return True;
    }
    return False;       
}

I haven't got the foggiest of what to put in the Declare_function part, nor if I'm even doing any of it correct.

0

There are 0 best solutions below