Should I split the cases between MultipleSelf supports arrays and those that do not?

Based on engine version 5.4

  • MultipleSelfs is decided by virtual bool AllowMultipleSelfs(bool bInputAsArray) in the UK2Node.
    • The only place where it is actually used is UK2Node_CallFunction::AllowMultipleSelfs.
    • The parameter bInputAsArray is passing whether or not an array is input, but this parameter is not currently used inside the function.

The below is the body of UK2Node_CallFunction::AllowMultipleSelfs.

1
2
3
4
5
6
7
8
9
bool UK2Node_CallFunction::AllowMultipleSelfs(bool bInputAsArray) const
{
  if (UFunction* Function = GetTargetFunction())
  {
    return CanFunctionSupportMultipleTargets(Function);
  }

  return Super::AllowMultipleSelfs(bInputAsArray);
}

Therefore, currently, MultipleSelfs pins support both arrays and two or more single pins. There is no case in which only one side is supported. In other words, the following cases do not currently exist.

  • MultipleSelf pins, which “support arrays, but not more than two single pins”
  • MultipleSelf pin, which “supports two or more single pins, but not arrays”

I thought that if there was a possibility that a case like this existed, I wanted to be ready for that. It will probably be something like the following.

  1. Add MultipleSelfSupportArrayOnly and MultipleSelfSupportManySinglePinsOnly to the Enum that handles the case of MultipleSelf.
  2. Accordingly, add a case statement that deals with cases of the possible types of pins that can exist on the opposite side.
  3. Display these at UI.

1 and 2 is okay to me. But doing 3 is too painful to me. There is already a lot of information to display, so there is not enough space. I also want to reduce the confusion felt by users as much as possible.

But currently no such code exists.

For reference, CanFunctionSupportMultipleTargets is a static function, and its contents are as follows.

1
2
3
4
5
6
7
8
bool UK2Node_CallFunction::CanFunctionSupportMultipleTargets(UFunction const* Function)
{
  bool const bIsImpure = !Function->HasAnyFunctionFlags(FUNC_BlueprintPure);
  bool const bIsLatent = Function->HasMetaData(FBlueprintMetadata::MD_Latent);
  bool const bHasReturnParam = (Function->GetReturnProperty() != nullptr);

  return !bHasReturnParam && bIsImpure && !bIsLatent;
}

There is nothing visible that goes beyond what can be expected. Considering this, it seems unlikely that cases such as MultipleSelfSupportArrayOnly or ````MultipleSelfSupportManySinglePinsOnly``` exist.

I’m worried that there may be a use case that I’m not aware of that might exist somewhere, but I decided to think about this again when I come across such a case.

This still makes me anxious though.

tags