Is it possible to create custom Blueprint nodes like we used to create custom Kismet nodes with UnrealScript?
I am eagerly awaiting the answer to this, I could make a lot of nodes for the community this way, and I had a lot of fun making custom kismet nodes in UE3
Blueprint Nodes are just functions or variables in a class. While it is not required to head a function with the UFUNCTION macro, you have to do it in order for the functions to appear as Blueprint Nodes.
If you download my SSD project from the FTP workspace, you will find examples of some in the code base. Take a look at SSDWeapon.h.
/** * Event which handles firing the weapon. */ UFUNCTION(BlueprintImplementableEvent) virtual void ReceiveFire(uint8 FireModeNum, const FVector& FireLocation, const FRotator& FireRotation);
This one creates an implementable event for Blueprints which allow C++ to fire the event but for the actual implementation to be done within Blueprint.
There are other parameters which you can use within UFUNCTION macro to make it appear as a different Blueprint Node. Check the headers for the other ones.
You can expose C++ class variables using the UPROPERTY macro.
Thanks for the awesome answer James Tan!
I guess a furtherance of my own inquiry is:
In UE3 you could make kismet nodes that could easily be accessed any time anywhere.
To maximize my ability to provide blueprints nodes to the community where the code is created in the c++, I would obviously be making blueprintcallable functions with Editanywhere blueprintreadwrite properties.
The person who doesnt know c++ that well who wants to use my blueprint node code cannot just copy/paste as could be done with kismet nodes, and then use my nodes in any class anywhere they want.
Currently the person wanting to use my code would have to add my code to their custom class where they want to call the code from, or set up a bunch of blueprint interfaces to access my code from multiple different blueprint classes.
Is there anyway way or any place that we Rocket Beta users can put c++ blueprintcallable functions so that they can easily be accessed from many different classes?
I’m looking for a practically plug-and-play method for people to utilize new c+±written blueprintcallable functions without having to set up a lot of complicated super-structures.
New Kismet nodes were basically plug-and-play, people could copy the code with 0 unrealscript knowledge and just compile and be good to go
Thank you Epic Devs for UE4!
If you want to make something that’s redistributable to others, your best bet is to make your collection of BlueprintCallable functions into a UBlueprintFunctionLibrary. This is a static class that’s contained in a simple header and implementation, that is accessible to all blueprints. To make one, simply make a class derived from UBlueprintFunctionLibrary. Then, make your member functions static, like so:
UFUNCTION(BlueprintCallable, Category="MyCategory") static bool MyFancyFunction();
That way, you can give people that header and that C++ file, and that’s all that they have to do to use your library of functions.
Hope that helps!
Thanks for the awesome answer Nick!
"To make one, simply make a class derived from UBlueprintFunctionLibrary. "
this was the piece of info that I was most looking for!
I am loving UE4!
Thanks, glad you’re loving it!
I’ve posted a tutorial with complete code samples for ppl based on your explanation to me
Make custom BP nodes in an easily share-able extendable format is super easy!
I can’t access the given forum link. Could you post on the new UE4 forums, please?
It’s from the UE4 beta, there no access to those threads
Don’t know if this is his guide, but I’ve found it here:
I’m going to close this thread, because as Shadow River pointed out, it’s from our UE4 Beta. If you need you can always post a new question via the AnswerHub.