Let’s say I have some C++ code…maybe a hideous math equation that has to be converted into a BluePrint.
Yes…it can done manually…but that is tedious and time consuming…especially if you have a lot of C++ code to “port”.
Is there any tool that would be able to parse out a small section of C++ code and convert it into its equivalent BluePrint form?
As far as I’m aware, there doesn’t seem to be any specific tool or plugin available for this task. However, this topic has been discussed previously, and a possible solution was mentioned in this post using BP function library:
if you require specific sections of a C++ Class, leveraging GPT could be a viable approach to identify the relevant nodes. You might consider utilizing Bing’s bot, which has access to more up-to-date knowledge and resources
Is there a way to use scripting to create blueprint code?
It would be a way to help speed up things…
Making a custom blueprint node that calls my c++ function. I didn’t know you could do that…that would help alleviate a lot work.
What I mean by scripting…(VS has this ability)…
Is to use some scripting tool (that uses C#) to have the engine create a node and connect to other nodes that are created as well…
Like:
Create math node.
Add two numbers…
Send to another node…
While this might sound like lowering the river VS raising the bridge…if you have a lot of C++ code this would end up being faster.
This would sort of be a middle ground method to help speed up this process when there is a lot of C++ code.
As you say, creating a custom node would alleviate a lot of work and might be the best approach.
So if I have something like this…(just an example)
As you can imagine…even this “simple” C++ code fragment would be tedious to port.
Instead of porting all the C++ code to its BluePrint equivalent form…I can simply pass in the one or two necessary parameters to my own custom BP node.
This seems a reasonable approach to do it.
float k = 1.0 + 0.4*g*g;
vec2 q;
q.x = sin(iTime*0.015+0.67*g*(1.0+amp) + off + float(i)*121.45) * 0.5 + 0.5;
q.y = cos(iTime*0.016+0.63*g*(1.0+amp) + off + float(i)*134.76) * 0.5 + 0.5;
vec2 d = p - q;
float at = 1.0/(0.01+dot(d,d));
f += k*0.1*at;
a += 0.5 + 0.5*sin(2.0*atan2(d.y,d.x));//*at;
While the scripting option might seem theoretically efficient, it’s less practical in the long run due to several challenges. Firstly, Unreal Engine doesn’t support this natively, meaning you would have to create the scripting solution from scratch. Additionally, as far as I’m aware there are no widely known third-party solutions to automate this process seamlessly.
In contrast, a more reliable and efficient approach is to either manually create custom Blueprint nodes, as I initially suggested, or expose your C++ functions to Blueprints using the UFUNCTION macro. These methods are well-integrated into Unreal Engine’s ecosystem, providing better control over your project logic and ensuring long-term stability and maintainability of your project.
Certainly, this is the approach I would choose.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.