Blueprint plugin: Custom event and custom struct possible?

Hey, before I go into my problem, I want to explain my current situation:

I am working on a Data Glove for VR/AR environments as a hobby project. So far I have written a dll, which is capable of connecting to the glove, retrieving and processing data and outputting that processed data back to the main program via callbacks. The dll works fine so far and I can output the data from the glove in the console. So far so good. Now I looked for a way to visualize the data and ended up with UE4.

I decided to write a plugin for UE4, which loads my dll in runtime and makes its functions accessible in a blueprint editor. So far, I was able to do exactly that. My blueprint functions are able to call the dll functions.

But now to my problem(s):

Currently my dll uses callbacks, to notify the main program, when the glove is connected/disconnected (since the connection is processed in a seperate thread) and when new data is available (also providing it with the data). I am able the retrieve those callbacks in my plugin and print them in the console. Everything works fine.

1st.: How can I create a custom Event?

I am not able to output the callbacks data to the blueprint with the event system. I know, that I can use delegates, to execute an custom event. But I couldn’t find a proper tutorial on how to get them to work. Is there a way to directly link my delegate to a custom event in c++, which I can use in my blueprint just by dropping it into the editor without any need of setting it up?

2nd: How can I include a custom struct in my project?

Since the glove provides me with many rotations of hand and fingers, I thought about a custom struct, to hold all my data (actually only a bunch of Rotators) Is there a way to inlcude a custom struct in my plugin, so that I can use it in the blueprint editor? And use it, to return new data?

Also 3rd: What is the proper way, to manipulate the player skeleton?

So far, i have added many many Bone transforms for each bone in the animgraph of the skeleton. 3 bones per finger times 5 fingers times 2 hands + two transforms for the base hand makes 32 bone transforms… Is there maybe a better way, or can i even somehow transform the bones inside my plugin?

  1. You need some holder UObject for your event. You may use GameMode, PlayerController or just empty actor placed in the world. On this object you need to declare a dynamic delegate.
    Then you may bind to this delegate from blueprint.

  2. To create a struct that is visible in blueprints just use the USTRUCT macro:

USTRUCT(BlueprintType) // to make it visible by blueprints
struct MyCustomStruct

    // add your UPROPERTY() here

This code must be inside your plugin module. Then you can use this struct in functions and delegates.