Download

Generating blueprints?

I watched this tutorial and I have a few questions.

In the tutorial Jeff creates a base class for his powerups and later a blueprint that inherits it. Where are the blueprints stored? I couldn’t find them in my solution, which leads me to the next question: if I created a bunch of powerups in C++, do I need to make blueprints for them in the editor? Is it possible to generate them in the code?

Blueprints only exist within the Editor and are saved as uassets along with every other type of asset.

Blueprints are the Editor’s way to “write” code without having to write code. You can expose C++ to Blueprints if you want to.

Blueprints are completely optional, but are a powerful tool to allow designers to modify the game code as they tweak the game play.

Thank you!

I don’t think your answer completely resolves Artless’ issue. So I’ll just add to it.

If you open your source files in your IDE, then look in the inspector under UE4/Source/Editor/UnrealEd/Private/Kismet2 you find BlueptintEditorUtills.cpp which I think contains all teh backbone for kismet node generation. So if you want to introduce drastically new features in your actions, such as new types, you’ll have to edit that file.

Now, the actual blueprint actions seem to be all over the place (I think we can’t expect some reasonable design such as in Unity’s Playmaker). I did a search for SetActorHiddenInGame (because it sounds rather unique) and I have 2 hits. One is in UE4/Source/Runtime/Engine/Classes/GameFrameWork/Actor.h and it seems to be the function declaration that makes the final Blueprint functions show up in the editor. THe other hit is in UE4/Source/Runtime/Engine/Private/Actor.cpp and it contains the real function body.

I need to do some real testing before I can say for sure if this is where the meat of the blueprints really lies (=> in some vaguely fitting type classes?), and I’m especially interested in how to separate them cleanly so people can just upload a new .h and .cpp for each blueprint plugin they want to release.

Having said this, last time I worked with c++ was over 10 years ago, so don’t expect any real results any time soon, but maybe someone else here can help?

Declaring function for Blueprints is very easy and be classified in two sections.

Object Specific function.
Generic Blueprint Library functions.

Object specific function have Target pin, when placed in blueprint viewport. Those function can be used outside of object specific blueprint, but you must provide valid object to Target pin.

Generic functions, can be used anywhere.

In both cases you need to add this decoration to make function usable inside blueprint:



UFUNCTION(BlueprintCallable, Category=SomeCategory) Type FunctionName(Parameters);


In case of object specific BP function, you just declare it in object you want to use function.

Blueprint Library Functions, must be declared in special class, and must be static!:


CLASS()
class URPGEffectBPLibrary : public UBlueprintFunctionLibrary
{
	GENERATED_UCLASS_BODY()

public:

	UFUNCTION(BlueprintCallable, Category=SomeCategory)
	static void ReduceMovmentSpeed(float damageAmount, float duration, AActor* damageTarget, AActor* causer);

You get results in to files because class is declared inside header filer (.h) and implemented inside cpp file (.cpp).

Use decorations only inside header files!

Yes spliting between source between two files sucks. But that how it is in C++.

You may now ask, when declare bp function where ?
The answer is it doesn’t really matter.
Declare it where it is easiest to use from. Sometimes declaring in specific object is easier, because function make use of other functions and properties inside that object.
Sometimes, function is pretty self-contained, generic and doesn’t depend on any object specific properties. As such it’s good fit for Blueprint Library as those function are easier to use inside Blueprint.

Thank you for the big help! This will make it a lot easier.
I have one more question though. How would I create an “inverse bool” blueprint? Bools are structs, so I can’t reference them without a container. Does Unreal provide such a thing (eg a container that contains a pointer to the actual bool in question, but which is still being shown as a bool output/input in the editor)?

What do you mean by inverse bool ? You want to inverse incoming bool in function, or you can to create new type ?

If you want to get access to specific property inside struct without breaking this property inside blueprint, you must decalere Getter or/and Setter.



type GetProperty()
{
  return struct.property;
}




voide GetProperty(type value)
{
  return struct.property = value;
}


Blueprint “actions” come from a variety of places and they are usually contextual unless you mean the really generic ones like mathematics functions. The easiest way to extend and add to those I’ve found is to make a blueprint macro library if the operation you need can be composed of simpler mathematics functions.

Otherwise Blueprint actions come from the actual C++ functions declared with UFUNCTION() and some actions are auto generated from variables that have the proper UPROPERTY() declaration.