Announcement

Collapse
No announcement yet.

Custom Bluprint nodes with C++ function code in-editor :-o

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Custom Bluprint nodes with C++ function code in-editor :-o

    After venturing into write my very first C++ code test in UE4 and realizing that the big monster is really not so scary I wake up today with this dream:

    Click image for larger version

Name:	Cpp Nodes in editor.jpg
Views:	1
Size:	268.1 KB
ID:	1154574

    Imagine that people like me, working solo, from designer side with a little programming skills could create custom Blueprint nodes and write directly in-editor simple function C++ code; without leading with Visual Studio (just one time installation) and complex C++ header declarations and function declaration, all managed by the blueprint editor.
    Wait, I made my research first, I know we currently can create custom nodes and classes and is actually very handy (for C++ programmers). Also I know there is an experimental Code Editor plugin. This facts just prove me that what I'm suggesting is theoretically possible. Just need to know if more people and Epic staff thinks this will be useful for all.

    Currently the easiest way I found to create a simple math function or loop in C++ and expose the node for blueprint was making an awesome Blueprint Function Library (was super-cool).
    But I spent big time figuring out how to correctly declare the functions and parameters in the header file.

    Imaging all this declaration part and source files generation could occur under the hood.
    - You declare a Blueprint function using the editor as commonly you do; creating inputs and outputs parameters.
    - You set that this function will be implemented with C++ code instead of nodes. Automatically UEditor will create all necessary declaration for you as a Blueprint Function Library or similar source files but you don't have to deal with it. You stay in the editor all time.
    - Now you have a node with a Text field that you can edit the body of the C++ function.
    - When you click compile this node, UE send the updates to C++ compiler in some obscure place you don't care about.
    - And ready, your node is working with all the advantages of speed and optimization of native code.

    What do you think?

    Well, sorry if you think this is non-sense, I'm not C++ programmer, just a designer with some Object Pascal background and loving UE4 too much

    Regards.

  • replied
    Woah, I just saw your signature in another thread and realized you have already released this.
    In case I haven't been the only one following this thread waiting for its release, here is a little notification for likes of me
    Forum: https://forums.unrealengine.com/community/community-content-tools-and-tutorials/1573386-mgc-magic-nodes/
    Marketplace: https://www.unrealengine.com/marketplace/magic-node

    Leave a comment:


  • replied
    Last night while creating an array sorting example, I've added an option for anyone to change a node's class title color.
    If you change the color of a class X, all the nodes on graphs will auto update the color they display:




    Leave a comment:


  • replied
    I wrote a movement input node just to see if I could...
    turns out we can lol

    Leave a comment:


  • replied
    Before the year ends I wanted to finish this as well...
    Node's source can be also edited from its asset package (they won't exist in built game, they only exist in Editor!)

    So we will be able to share nodes as assets between projects and machines (instead of sending whole copies of Blueprints), then attach that source into a node and hit compile, the base C++ class is generated (as if the user went through the whole process of creating and setting up a plugin to host his custom Kismet node, but skipping the headaches):







    Now it's party time!
    Happy new year guys, till later :]

    Leave a comment:


  • replied
    Originally posted by vlad.serbanescu11 View Post
    Can't you use UHT's source?
    Hmm..
    I don't know if that would help btw, because if it isn't exposed as UProperty or UFunction I don't know if UHT can even see those declarations.
    But I will lurk into UHT's source and try to find clues, thanks!

    _____

    Oh from there I've found something really helpful:
    Code:
    Engine/Source/Runtime/Core/Public/Misc/Parse.h
    There's helper functions to parse source code "tokens" in there, this is going to be useful!
    Last edited by BrUnO XaVIeR; 12-28-2018, 02:08 PM.

    Leave a comment:


  • replied
    Originally posted by BrUnO XaVIeR View Post
    I have a [I]tiny little problem...
    Can't you use UHT's source?

    I've been following this thread and I'm eager to see this on the Marketplace.​​

    Leave a comment:


  • replied
    I have a tiny little problem

    Does anybody out there have experience in writing a parser for C header files? without using LibClang??
    The only way for the little node editor to detect (and show tips like IntelliSense does) from variables and functions that aren't exposed as UFUNCTION() and UPROPERTY() is me writing a header parser to collect those declarations... And oh boy this stuff is hard :[

    My autocomplete system is based on Reflection so anything not UProperty it can't see (unless I parse declarations from a script's header and manually inject the declaration into the sematics database), I've injected "Context" as a variable declaration of type UMagicNode class into the semantics database just to see if that would work and seems like the "Class Pointer Parser" is working fine, it now understands that "Context" is a variable of type UMagicNode* class declared in body of Execute function, but oh boy...

    Parsing header files without any reflection data is going to be far from easy:






    _____


    Yep, working just fine; testing again I've injected "_X" as if it was a variable declaration of AActor* and the thingy found it.
    Now I just need a header parsing algorithm >.<

    Leave a comment:


  • replied
    Alright I got all permission I needed

    Now I have to start writing basic documentation and include a few dozen coded nodes as examples, explaining the basics of Unreal's C++ for the people struggling with the language (my little brother included);

    In a month or two I shall upload the tool to both Marketplace and GitHub (for those who might want to contribute improvements)

    Leave a comment:


  • replied
    Even if Bruno releases it for FREE we which know a bit or two of C++ and engine source could keep it alive as a community thing than an one dev only thing. Just a thought.

    Leave a comment:


  • replied
    Originally posted by BrUnO XaVIeR View Post
    No, just need to have it installed so Unreal can use HotReload with C++ Compiler... The project must be a C++ project, but I don't keep Visual Studio open at all.
    That's just great!


    I don't think this is a replacement to Visual Studio.
    However some times I just want to make some foreach loops or write my functions instead of dragging wires around, but I don't want to wait for VS to launch either. I just want to write the function and see it there in the graph on the exact place where it's called without wasting time on extra steps such as creating function library classes.
    Blueprints are great, but sometimes just typing on a keyboard to create a function is simply faster than connecting wires to nodes...
    "Less time waiting for things to happen!", this is why I'm making this, I need to reduce time spent on the overall "coding" workflow, "less rocks on the way"
    I don't have much experience with VS (I hated it since the first time I tried to use it) but from your gifs, we could do most of the stuff without opening VS at all using this. Imo this is more useful than just clearing some rocks. Because it allows to use all the functions unavailable to BP in BP.


    * I would need written permission. Some pieces of this plugin I wrote on my workplace which makes the company legally owner of this tool; they would have to allow me to make it public.
    Wow, that is some hardcore law abiding

    ...* And I believe EpicGames has in the EULA something saying we can't sell scripting/coding systems for Unreal, it must be shared for free
    Huh, didn't know about that.

    ...* I don't have a lot of time to create documentation, tutorials, etc, besides a few example nodes. This could become a problem if I make it public...

    ...* And finally, there's the fact this isn't complete yet, right now it's more like something in "alpha" state.
    Well, no pressure... we can wait hehe

    Leave a comment:


  • replied
    Originally posted by Nicat View Post
    1) Do you need to open VisualStudio in the background for this?
    No, just need to have it installed so Unreal can use HotReload with C++ Compiler... The project must be a C++ project, but I don't keep Visual Studio open at all.

    2) Can you do everything you could do in VisualStudio, I mean do we need to use VS after having this?
    I don't think this is a replacement to Visual Studio.
    However some times I just want to make some foreach loops or write my functions instead of dragging wires around, but I don't want to wait for VS to launch either. I just want to write the function and see it there in the graph on the exact place where it's called without wasting time on extra steps such as creating function library classes.
    Blueprints are great, but sometimes just typing on a keyboard to create a function is simply faster than connecting wires to nodes...
    "Less time waiting for things to happen!", this is why I'm making this, I need to reduce time spent on the overall "coding" workflow, "less rocks on the way"

    3) Is it possible to make this into a plugin and share/sell it, and are you thinking of doing that?
    In fact this is a plugin that I built and I could share it.
    However there are a few problems I see about sharing this:

    * I would need written permission. Some pieces of this plugin I wrote on my workplace which makes the company legally owner of this tool; they would have to allow me to make it public.

    * I don't have a lot of time to create documentation, tutorials, etc, besides a few example nodes. This could become a problem if I make it public...

    * And I believe EpicGames has in the EULA something saying we can't sell scripting/coding systems for Unreal, it must be shared for free

    * And finally, there's the fact this isn't complete yet, right now it's more like something in "alpha" state.

    Leave a comment:


  • replied
    That is it! This has gone too far to stop, don't you think? I'm really excited about this and have two questions:
    1) Do you need to open VisualStudio in the background for this?
    2) Can you do everything you could do in VisualStudio, I mean do we need to use VS after having this?
    ..ok make it three :P
    3) Is it possible to make this into a plugin and share/sell it, and are you thinking of doing that?

    Also, I'm not op but I wouldn't mind this kind of "flood"

    Leave a comment:


  • replied
    Okay, last post then I stop flooding this topic
    I got reflection-based auto complete working... Now I can use this thing more seriously lol


    Leave a comment:


  • replied
    The cost is exactly the same cost of calling a Blueprint function node.

    The difference is within a Blueprint function graph you can have another tons of nodes in there and each of those nodes add up another "Kismet call" cost.

    I can have over a thousand functions inside this node... The cost for a "Kismet call" is still going to be just 1. Everything within after that is C++ land.

    Only the "Execute" function is the Kismet cost (Blueprint overhead)
    It's the only thing that the Kismet Compiler, well, executes.

    Leave a comment:

Working...
X