getnamo / NodeJs-Unreal

Embed node.js as an Unreal Engine plugin.
MIT License
241 stars 36 forks source link

Call unreal function by name #4

Open getnamo opened 5 years ago

getnamo commented 5 years ago

Instead of emitting an event, we could also allow an optional mode where you can call bp/c++ functions directly in javascript without binding.

This would use similar arch to https://github.com/getnamo/nodejs-ue4/blob/master/Source/NodeJs/Public/NodeComponent.h#L119 but use a special event to encode both function and var passing.

potential api on js side

ipc.call('myfunction', object);

Would require a wrapper around ipc-event-emitter to add this support.

May extend this with RPC callbacks e.g.

ipc.call('myfunction', object, (data)=>{
    //on bp function used callback
});

Targeting would be owner of node component by default, but may add optional parameter to retarget. This should in theory support everything marked as UFUNCTION, which is exposed to the unreal reflection system.