x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How can I create Blueprints with multiple exec output pins in C++?

How can I create a blueprint node in C++ that has multiple exec output pins, like the Branch node or the Cast To ones.

Product Version: Not Selected
Tags:
more ▼

asked Apr 28 '14 at 05:30 AM in C++ Programming

avatar image

Mullvaden
68 3 3 7

avatar image yesNinja Sep 06 '14 at 06:43 AM

I am also interested in a real answer to this question, If it is possible or not via the UFUNCTION macro.

Looking into how the Branch and Sequences are created seem to use CreatePin() but finding out how to do this out side this namespace is driving me nuts :(

avatar image veggiesaurus Sep 06 '14 at 11:10 AM

Also bumping this, there must be a way! I'm specifically wanting to implement a "branch on clamp" node, with three outputs for a) the input value being between A & B; b) the input value is above B; c) the input value is below B. I know I could do it with a couple of branches and comparitors, but I plan to use it a lot, so a single node would be great.

avatar image TheFoyer Dec 31 '14 at 04:10 AM

I'd like to have Exec pins for OnSuccess and OnFailure for an HTTP call like when using the session nodes.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

5 answers: sort voted first

You can do this. First, declare a new UEnum type:

 UENUM(BlueprintType)
 enum class EMyEnum : uint8
 {
     BranchA,
     BranchB
 };

Then, declare some Blueprint-exposed UFunction like this in your .h (change the parameters for whatever you need):

 UFUNCTION(BlueprintCallable, Category = "Stuff", Meta = (ExpandEnumAsExecs = "Branches"))
 void DoSomeBranch(int32 SomeInput, TEnumAsByte<EMyEnum>& Branches)

And in your .cpp:

 void AMyClass::DoSomeBranch(int32 SomeInput, TEnumAsByte<EMyEnum>& Branches)
 {
     if (SomeInput == 1)
     {
         Branches = EMyEnum::BranchA;
     }
     else
     {
         Branches = EMyEnum::BranchB;
     }
 }

Then you should be able to use it like this in your Blueprint:

alt text

branches.png (39.5 kB)
more ▼

answered Feb 03 '15 at 11:29 AM

avatar image

cancel
2.1k 98 66 110

avatar image Michaël Dubé Feb 03 '15 at 02:19 PM

Thanks for that, really useful :)

avatar image Shadowriver ♦ Feb 03 '15 at 02:29 PM

Oh didnt know about this one

avatar image MarcAndreG Feb 04 '15 at 06:09 PM

Worked like a charm. Only had to change "enum class EMyEnum : uint8" to "enum EMyEnum" since it caused an error when casting from uint8 to TEnumAsByte

avatar image RVillani Nov 24 '15 at 01:10 AM

Actually, the form with : uint8 is the new and better one. This way you can convert any enum to an integral type using C-style cast like (int32)EMyEnum::BranchA.

You can remove the cast with TEnumAsByte and simply use the enum type name. Like so:

 // .h
 
 UENUM(BlueprintType)
 enum class EMyEnum : uint8
 {
     BranchA,
     BranchB
 };
 
 UFUNCTION(BlueprintCallable, Category = "Stuff", Meta = (ExpandEnumAsExecs = "Branches"))
 void DoSomeBranch(int32 SomeInput, EMyEnum& Branches)
 
 
 // .cpp
 
 void AMyClass::DoSomeBranch(int32 SomeInput, EMyEnum& Branches)
 {
     if (SomeInput == 1)
     {
         Branches = EMyEnum::BranchA;
     }
     else
     {
         Branches = EMyEnum::BranchB;
     }
 }
avatar image Eymrich May 02 '16 at 12:59 PM

I got errors with the early method. This solution instead worked fine! If can help, i just used it in a public class with static methods(a function library).

avatar image NeroViper Apr 02 '15 at 01:16 PM

I get generated error in the compiler about TEnumAsByte failing to with EMyEnum and MarcAndreG solution get another error about missing {

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

I used the Sequence node in Utilies->Flow Control and you can keep adding pins. It will execute the first, then the second, then the third. This is really useful for setting up complicated gameplay where you need to branch your blueprint to a bunch of different areas.

It's even easier if the order doesn't matter, it'll just do all of it (still technically in order but it won't matter).

more ▼

answered Apr 28 '14 at 05:42 AM

avatar image

MattCan36
23 1 4 11

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

You can also create custom node by exteding UK2Node class, it let you do anything with pins and apperence of node. Thing is theres no documentation on it and you need to figure this yourself, its complex but always a option. All nodes are made like that (in fact funtion bind node is K2Node_CallFuntion), you can find code of them here:

https://github.com/EpicGames/UnrealEngine/tree/890cefeee330dec714271af1cd07969f0a60848e/Engine/Source/Editor/BlueprintGraph/Private

more ▼

answered Feb 03 '15 at 02:38 PM

avatar image

Shadowriver ♦
24.5k 887 126 1026

avatar image Robert42 Oct 24 '15 at 05:14 PM

Hm, I was thinking about doing this for my project, but I think, that I should do this after the blueprints are compiled into C++ Code and after Blueprints are stored as textfiles

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

as far as I know it's impossible as you can only have one return node. However, what you can do it :

1) Output the return with an integer 2) At the output add a SwitchByInteger.

I do a lot of this in my BP it seems to work fairly well.

alt text

a.jpg (52.3 kB)
more ▼

answered Sep 06 '14 at 07:21 AM

avatar image

Frozenfire
492 41 60 90

avatar image yesNinja Sep 07 '14 at 07:21 AM

Thanks this seems to be the immediate solution of course but as stated above would be cool if this could be added as a potential feature. It seems the functionality is there in the engine, so technically it isn't impossible, just not through the use of the UFUNCTION macro. If i figure it out I will be sure to post it.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

I found https://docs.unrealengine.com/latest/INT/API/Editor/BlueprintGraph/UK2Node_ExecutionSequence/AddPinToExecutionNode/index.html but this requires your node to be its own class as far as i understand. So you could make your function a class that is a child of UK2Node_ExecutionSequence but i don't believe thats recommendable.

We have to hope that Epic makes this into a nice and easy to use macro. As far as i can tell Frozenfire has provided the best workaround.

more ▼

answered Feb 03 '15 at 10:22 AM

avatar image

Baribal
26 4 3 7

avatar image thejohncrafter May 16 '16 at 11:31 AM

Actually, AddPinToExecutionNode is called by SGraphNodeK2Sequence. There are two ways for you to get a similar behavior : extending SGraphNode_K2Sequence or implementing CreateVisualWidget. You have to create your own implementation of SGraphNode (there is no need to implement SGraphNodeK2Base) - copy code from SGraphNodeK2Sequence.

But I can't find a way to implement the "remove pin" button. This has something to do with FUICommandList and FGraphEditorCommands::Get().RemoveExecutionPin, but I don't now how to handle this stuff. If someone could help me ?

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question