How to make a reverse "switch on enum" macro?

The dependencies go into your build file

Yes you need to convert it to a c++ project to use custom k2 nodes.
It should be accessible in the project once it compiles.

Ok It’s working now, thanks!

There’s just one weird thing, I’m getting a breakpoint in visual studio, as soon as I click play in the editor:

Captura de tela 2024-07-02 153043

any ideas what could it be? how to fix or at least how to disable it?

Enhanced input is a default module since a couple of versions of unreal. This is an example build file dependencies of a basic c++ project.

PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "EnhancedInput" });

Perhaps check if you have it enabled as a plugin. It shouldn’t be throwing any errors.

If it is unchecked in the plugins of your project it will throw and error but with a message mentioning to enable default input.

ensureMsgf(Class.IsValid(), TEXT("Invalid InputComponent class in Input Settings. Manual reset required."));

If the plugin is already enabled then, maybe try verifying your engine that all files are ok from the epic launcher.

Yeah I’ve been using enhanced input for a while in this project, but never had any issues before today, after adding code.

plugin is enabled, and I’ve verified the installer, all seems fine, but the breakpoint persists.

I ran a newly created template, added the same code, and it runs fine. must be something in my project? I created it before the enhanced input was a thing, and migrated the inputs to use it after it was released in stable.

So I ported the whole project into a new blank template, and it stopped that breakpoint.

There’s only one thing I suppose now, this custom node won’t package, works only in editor. How can I make it work for packaging?

Reading up on k2 node extraction. Seems it needs to pushed into it’s own module and setup to only work in the editor phase.

@3dRaven

can I create a new project, add this conde to it, and then just export the node to use in my other project? (kinda want to keep it blueprint only

So can he/we make a temp C++ project > make the whatever code/node (for C++), then import that [asset] into a Blueprint only project?

  1. To get C++ nodes/code into BP projects, it is turned into a plugin correct?
  2. So then How do we make [whatever C++ node/code] into a plugin - that we can add to a BP project (because BP only projects are easier for me to share)? If you know or can direct me to a guide, so I can learn the steps. Ty.
  3. And is there a community depository of free C++ compiled nodes as plugins - for BP projects - so that any of us can use [common public code] in assets that we may want to share?
    • (I.e. what he seeks is also what I want. Thus if one of us learns how to compile it/form into a plugin, where can we go to obtain/contribute to the [community plugin basket] so that we dont have to constantly recreate the wheel for something that already exists? Ty.)
    • (Because this node might be something I already paid for at the Market. But as soon as it is sold, then I can’t offer it for free in an asset that I make using it. Thus my question above.)
1 Like

I’ll see what I can do. I haven’t had much experience with k2 nodes. I can push it out to a plugin but even if I exclude the specific dependencies from the plugin via a target condition in the build file it will cause problems during packing. I need to look into the engine source to check how to get it to pack correctly (Most likely there needs to be an Editor and Runtime version)

Edit: Ok was able to extract it to a plugin and pack to a project. Will post an updated project soon

Packed plugin version for 5.4 (copy into your engine directory/Engine/Plugins )
Packed_plugin_ExtraCustomNodes.zip (12.4 MB)

Version as plugin with source surrounding source
CustomNodeProject.zip (15.5 MB)

2 Likes

Thank you. We appreciate your community service. :slight_smile: This was exactly the type of [plugin package, ease] that I asked about.

Let me know if all works well. Haven’t had a chance to check it on another pc.

Im checking now. What is the name of the node?
And is my understanding correct on how to use it:

  1. Copy [your plugin folder asset] into [the 5.4] engine directory/Engine/Plugins.
  2. Start a BluePrint (only?) project, or do we still need to be using a C++ project?
  3. Plugins setting in UE > search for custom > enable your plugin > restart.
  4. UE5.4 > Content drawer > Settings > I enabled show plugin content.
  5. I go to the folder and see K2Node_CastToEnum. But I dont know how to use K2Nodes - I tried dragging it in a BP. What is the proper way?
  6. I also opened a BP > searched for “switch” and “enum” and “casttoenum” but dont see your node? So what is the way to use your custom node (in a BP project)? Ty.

Edit: I see a “cases” node. Is that yours? It has an Enum output, and multi EXE inputs.

Is this “Cases” node yours? If yes, I can add it now. (BRB making enum code to test it lol.)

.
Edit: ok this code works for me. Im guessing it’s your Cases node.

(And Idk whos Enum that is, just a random one I found in this project.)
Thanks for your contribution :slight_smile:

Edit 2:
@3dRaven it worked in 5.4.1.

  1. Are you able to please compile this plugin for 4.27?
  • 5x is too laggy for me.
  • I tried to use the plugin in a 4.27 project, it asked to attempt build, yet failed.
  • Im not sure if your dependencies are usable in 4x? But if yes, please make a 4.27 version. Ty

I just made the outer encasimg the the k2 node in the form of a plugin and searched for the meeded config modules for it to run. (Original post just had .h and cpp)

Original author if the node is stated in the posted code snippet above my posts. (Still unchanged & intact in the cpp file.

I’ll try to make a 4.27 version later today

Edit: update

Packed Unreal 4 version for bp
ExtraCustomNodes.zip (8.0 MB)
Full source
CustomNodeProject427.zip (24.9 MB)

Had to change some of the node internals as 4 had some functions missing.

1 Like

Thanks!

The plugin worked well in 5.4.2 on a blueprint only project.

the “customnodeproject” failed to open and asked to compile from source for some reason.

the plugin is a nice solution, but i’ll be developing this project for a while, and I tend to migrate to new releases for the new features, so asking you to recompile it every now and then wouldn’t be ideal. would you mind sharing how to do so?

Also, I had to format my computer and still didn’t have time to install VS and SDK. will this plugin package for release?

I’d still love to know how to make the original C++ code work for packaging. thanks again

You can compile to the version you need though the source code project. You need to regenerate the project through the uproject file (right click and generate project). You can than compile it in other versions of the engine. Then run it in your IDE (I use VS)

There is a big leap between 4 and 5 but I’m guessing most subsequent versions of 5 should compile with no problems.

I would suggest downloading source for both versions as the rewrite without diving into k2 nodes is tough (I’ve just started learning them myself)

Oh and to use the bp version only make sure that once you compile, go into the plugins, find the extra custom node plugin and choose “pack” to be able to export it out of the source version.

2 Likes

Thanks for your community service for 4x.
Suggestion to make your own thread and post your plugins, if a community plugin thread does not already exist.

  • In the ancient times of UE1, we freely shared code additions. But that was at an old wiki, and the UE forums v1 were redeemered.

The links will be kept up as it’s directly on epic’s servers.
The internal code is not originally my own, so I don’t really want to take credit for someone else’s work.
I just encapsulated it and made it backward compatible.

1 Like

What I mean is please make a thread with the subject of community plugins/assets, so that others can find this easier.

  • I randomly found his thread. Thus it would be helpful if everyone’s free contributions were added to the same thread.
  • You don’t need to take ownership credit. But you’re the contributor who [did what you said above] to make Epic’s engine more usable. Thus it is a contribution :slight_smile: .
  • I can’t start a thread like this to maintain it. You would be better.
  • What is the best forum to put such community assets?

Can you explain how exactly to compile it?

I got to the part where I right click and generate project lol, but I don’t really know how to compile a plugin, or what do you mean by “run” in in visual studio

I also got to package the plugin like you mentioned, after I opened the source project in the editor, but I’m not sure what to do with the files it generated.

You can copy the compiled version into:

Your Unreal engine install directory\Engine\Plugins\ExtraCustomNodes\

It should look something like this:

It should then show up in the plugins in editor and can be packed.

1 Like