I need to be able to have the **same ** workflow in code as I do in the gui for creating components for blueprints. I want to be able to take a blueprint that was created from AActor template, and have arbitrary components added to it (again, just like in gui). I need a completely hardcode-free method (no stuff init in constructors, no creation to hardcoded pointers in custom classes). I do not need a custom derived class from AActor for my needs - AActor works just fine for what I’m doing. I just need to be able to say some_blueprint->AddComponent(<somecomponent>);
Is this possible at all? The more I look into how code is laid out in the SSCSEditor, the more if feels like the developers have only intended this work flow for the gui. Please, tell me that I’m wrong, because otherwise it would be ridiculous
I haven’t attempted to do this, but have you tried FKismetEditorUtilities::AddComponentsToBlueprint?
Like you say, this is possible from C++, since the editor is doing it in C++. If the above doesn’t work, you’d just need to put a breakpoint in the editor code (you’d want a source build and DebugEditor config) to catch it at the point you add a component to a blueprint in-editor, and then trace through to see exactly what it does.
I’m using a compiled build, but it has debug symbols, so I am able to debug the code to some extent (it does not show all code flow correctly, ie, sometimes will show a pointer as non-null when it is null). I have tracked all the calls in the selection widget, and I think I know what’s up.
If your suggested function call will not work, I will try and rip out all component adding functionality from the widget and rewrite it such manner that a user would be able to easily add components to the blueprint from anywhere in code. If I succeed I will make a post about it.
Hi! I know this is pretty old, but I hope someone will help me.
Im trying to add an InstancedStaticMesh component to blueprint. And it works, the issue is that I cant set up static mesh for it.