Download

How does Create Widget/Create DragDropOperation node in blueprint determine inputs ?

When you create custom Widget with custom properties, which are editable, node Create Widget, determine, which properties are editable, and expose then directly in node.

It’s extremely handy. and I tried to figure out how this has been achieved, so I can implement something like this in my blueprint nodes, but I’m stuck at WidgetBlueprintLibrary:Create() and template function it calls. It’s obviously not enough, so there must be more magic going around.

Have you looked at these tutorials, maybe they can be helpfull.
UMG, How to extend a UUserWidget:: for UMG in C++.
[Tutorial/ Snippet] Creating a UMG Widget in C++, and delegate example.](https://forums.unrealengine.com/showthread.php?52773-Tutorial-Snippet-Creating-a-UMG-Widget-in-C-and-delegate-example)

I don’t want to extend UWidget. I want to create similar node for my own classes (;.

You mean you want to make a new “BP Node” in your widget class with Pins and sutch?
Not sure what you actualy are asking, but is this what you are looking for?
Custom Blueprint Node Creation


UFUNCTION(BlueprintPure, meta = (HidePin = "WorldContextObject", DefaultToSelf = "WorldContextObject", FriendlyName = "Create Object From Class",
 CompactNodeTitle = "New", Keywords = "new create blueprint"), Category = Game)

Nah. I want to create node which does this:

https://dl.dropboxusercontent.com/u/70400220/Unreal/custom-node.jpg

Marked as red are my custom defined properties. This node intelligently knows, which properties are exposed as editable, and automatically add them, so they can be set before node return object.
I want to create similar node for other NON UI related classes.

There is indeed MUCH more magic at play. The WidgetBlueprintLibrary::Create() call is what we eventually compile it down to, along with the individual setters for each exposed property. The feature works through an entirely custom blueprint node. UK2Node_CreateWidget is what does it, additionally its base-class UK2Node_ConstructObjectFromClass does a lot of the metadata scanning and generating of the custom pins. Be forewarned there’s little to no documentation on writing your own truly custom blueprint nodes, but you can do some amazing things with them :slight_smile:

That wiki article is badly named, creating a new function and exposing it to blueprints is not creating a new node type, the nodes are all using the same CallFunction K2 Node. Nodes, like SpawnActor, and CreateWidget are examples of true custom nodes. But they’re difficult to create, and most of the time all you really want to do is just expose another function.

Thank you very much. It is exactly what I had needed a while ago, but didn’t event realized it’s possible to create such nodes. And eventually ended up, creating subpar solution, (means, convoluted and hard to use).

I have another question about this. These classes are part of Editor. Will they be compiled down for game runtime ? As this is where I really want to use this functionality in the end.

Edit:
I implemented my custom node basing on UMG code, to see what exactly I need to override and code, and it wasn’t as though as I thought. Now only thing to do is to learn exactly what this code does (;.

You should consider writing a wiki when you’re all done with this learning process, I am sure others would love to know what you’ve learned!

:heart:

Rama

PS: Great to hear from you Nick Darnell!