[Suggestion] blueprint to c++ convertion documentation need

Hi2all , i have suggestion-- i use BP but always want to convert some BP to c++ but its hard for me reading c ++ documentation(totally don’t understand it), but recently i see cool guide in “Unity to Unreal document” and this guide have vary cool examples, where i see code on c++ and exactly the same code for BP and i even understand what c++ code does after comparing it to BP… so question – where i can find more documentation like in this pictures below(be nice to see all available c++ code compared to all BP nodes with this simple examples)

http://i.piccy.info/i9/e5ef936f061f349dc7a605db4491de19/1425750713/55191/858517/v1_800.jpghttp://i.piccy.info/a3/2015-03-07-17-51/i9-7846867/674x634-r/i.gif

http://i.piccy.info/i9/c230d42e5b3ecee3f4eee1a33426c01e/1425751314/59658/858517/v2_800.jpghttp://i.piccy.info/a3/2015-03-07-18-01/i9-7846914/672x635-r/i.gif

http://i.piccy.info/i9/28ccaea93adebd680efca037a317fe71/1425751530/62590/858517/v3_800.jpghttp://i.piccy.info/a3/2015-03-07-18-05/i9-7846940/765x558-r/i.gif

http://i.piccy.info/i9/1e3c9e7bc2572fc7507f74c9d5b11f9f/1425751573/54123/858517/v4_800.jpghttp://i.piccy.info/a3/2015-03-07-18-06/i9-7846943/777x549-r/i.gif

Theres really no need once you understand how Blueprint and C++ are linked you will swim between them, check my video it kind of shows you how it works somewhere in first half of it:

In fact C++ API reference already marks binded function and varables with blue file icon, Blueprint API reference miss that thru, this should be added . If you not useing API Refrence, you only be lost, so use it a lot, it like a map od UE4, you can search it using docs search on website and click “API” tab in results, there also offline version in “Documentation/CHM” directory in engine:

Most nodes in blueprint, which has “f” icon as well as events are bindings of C++ functions, functions are simply called, events are functions in class that are can be overrided and called on event in C++. Varables are also binded, to access then you need to drop link of object on empty space of bluepritn and check varables category, all those sets and gets are varables in C++ (or Blueprint). You can check which class specific blueprint nodes belong to, by checking class of object expected to be plugged in “Target” input, this input is not part of a function, it’s generated to let blueprint runtime on which object specific function need to be called. Function nodes without “Target” input are static functions which does not require class isntace and can be called direcly from the class namespace in C++, for example UGameplayStatics::ClearSoundMixModifiers();, those are kind of harder to find in API refrence.

Reflection system makes binding a lot easier, all you need is to add single UFUNCTION or UPROPERTY specifier, because blueprint is richer in function types there few different specifiers which bind function diffrently

UnrealHeaderTool which list functions, structs, varables which later is used by editor to create nodes, automatically takes names of those objects and convert them:

-It removes prefix from classes and structs (“U”, “A” or “F”), as well as booleans because UE4 convention in C++ is to place “b” before the name of boolean
-It places spaces before cased letters so it’s more readable, thats why UE4 C++ convention tells you to mark each word with cased letter, not only from names of fucntions or classes, but arguments of functions too which are turned (also automaticly) in to I/O pins of a node

By knowing that rules it child easy to find C++ equivalent of most blueprint nodes, so for example “Is Actor Tick Enable” node

https://docs.unrealengine.com/latest/INT/BlueprintAPI/Utilities/IsActorTickEnabled/index.html

You can see “Target” awaits Actor class, just by that you know that this function in C++ is part of AActor class. Now you remove spaces from name of node and search using documentation search:

Click on API tab (but its usally not needed) and… there you go:

Now there few exceptions to to the rule:

1.Custom named nodes

UE4 reflection system has option to use different name in blueprint system then used in C++, so called Friendly Name, so for example “Convert World Location to Screen Location”

https://docs.unrealengine.com/latest/INT/BlueprintAPI/Game/Player/ConvertWorldLocationtoScreenLoca-/index.html

Again “Target” awaits Player Controller, so we know this function in C++ is in APlayerController, but named diffrently ProjectWorldLocationToScreen

But because API reference contains also function deceleration with all specifiers, docs search will find it anyway in API reference,. If not add spaces back or you can also search in github UE4 source with spaces or not, it should direct you on first result.

2. Restructured functions for Blueprint use convince

Some functions in C++ are duplicated and restructured for Blueprint, or because reflection system does not support argument data type (for example function pointer in SetTimer and blueprint does not support function pointers) or function is not part of UObject based class (reflection system require that) or to make function easier to use and less clustered in Blueprint. Let take mentioned “Set Timer” as example, search will proably lead you to this:

https://docs.unrealengine.com/latest/INT/API/Runtime/Engine/FTimerManager/SetTimer/9/index.html

You will see there a difference in arguments, thats because this one is not binded to Blueprint… K2_SetTimer is:

And as you can see it’s not even in Timer because original SetTimer is not only has unsupported argument but also is outside of UObject tree. Note K2_ prefix, it means “Kismet 2” which is old name for blueprint, you will find those functions in API refrence sometimes and it means they are made for blueprint use.

Another example are events, because some blueprint convetions like running blueprint only during gameplay some events are also duplicated. Lets take Tick for example, Tick in C++ is just Tick():

https://docs.unrealengine.com/latest/INT/API/Runtime/Engine/GameFramework/AActor/Tick/1/index.html

But if you look on source code of AActor you will see something like this:



	// Blueprint code outside of the construction script should not run in the editor
	// Allow tick if we are not a dedicated server, or we allow this tick on dedicated servers
	if (GetWorldSettings() != NULL && (bAllowReceiveTickEventOnDedicatedServer || !IsRunningDedicatedServer()))
	{
		ReceiveTick(DeltaSeconds);
	}


…and when you look it up in API refrence you will notice that this function is true Tick in blueprint, you can see Blueprint implemantable event and friendly name set:

Some C++ operations are impossible in Blueprint so thay also are replaced by functions, for example to search for all actors in C++ you should use TActorIterator, you can’t use interators in blueprint so theres function for blueprint that fill a lack of that functionality, it uses iterator inside it for you and throws ready array of objects so this csn be used in blueprint:

Now you may find those duplicates in C++, but they usually usable in C++ too (except events, you should use originals), you can use them if you like, but some are not exportable from module dll so won’t work you may have linker error (like K2_SetTimer i think)

In general function made for C++ has similar name, so you will need to deeper search.

3. Specially programmed blueprint nodes

Not everything can be done by just binding C++ things, there nodes that are programmed using UK2Node class (again K2 means “Kismet 2” old name for blueprint, if you see K2 in code or API reference, it means that thing is made for blueprint), you can find full list of those here:

Main signature that you deal with custom node is when icon is not “f” or event icon or it not get/set node (that means you dealing with C++ or Blueprint varable). I think best and strangest in first look is… Spawn actor node, in C++ you use SpawnActor in UWorld:

But Blueprint insted of just binding that function has custom programed node

I suspect reason behind it is fact that with normally binded function you can’t dynamically change pin type that return value returns, that nodes does that, or else you would always need to cast the Spawn actor node output, thats why this special node was made so you don’t need to use cast node all the time

To tell the truth, all nodes are K2Node classes, you will find there nodes used to represent binded C++ (And Blueprint too) things

Those nodes are not usable in C++ at all, but there usally equivlent to C++ (for example ForEachLoop will be for(AActor i:Actors) {}:wink: those you need to search even deeper, search how to do equivlent

4.Class type

Represented in blueprint with purple color, used for example for declare which class you want to spawn. In C++ it is UClass (or TSubclassOf<ClassName> which is used to limit selection in blueprints) class which represents the class it self, each class in C++ (as well as blueprint!) has a instance of it, it very easy to get it in C++. Each class has StaticClass() function, it will return UClass of specific class, so if you want for example APlayerController UClass you do simply that APlayerController::StaticClass(); or UClass of already instantiated object using GetClass() function which also inside all UObjects. You can hold that as varable of type UClass* and reflection system will pick it up as class refrence, purple stuff you see in blueprints.

Did you check out the Blueprint API docs? Like this:

thx **** for big replay, i try to understand you’re method and hope can use it.

thx JamesG yes i see this(BP API documentation), but like i say in first post this don’t help find how i can create this in c++(Epic just need to add link to c++ example API – this is very help for bp users), also be a nice to see more official tutorials about converting BP project to c++ project…

OP, your post is brilliant. I wish there was a huge library of images like that. I just learned 10 different things from those images you provided. The Unity –> C++ –> BluePrint charts are gold.

Does anyone know if there are more charts like the OP provided in first post?

Those are all taken from here: