I made a Structure for a Data Table. one of the structures is a BP. so each item in the Data table has a corresponding BP assigned to it.
Now in my blueprint I can find the row and do a “break”. I can then see all of my structures for this line item, one of them being the assigned BP (it has an output color purple pin). My goal is to collect the meshes inside this BP and return them so i can build it again in a “ghost mode” using “Set Static Mesh”.
the ghost mode I have working. but it only shows one mesh, I need to be able to gather all meshes in the BP and then “Set Static Mesh” from those.
The easiest way to do this is probably to make your BP class have a ReturnAllMeshes() function that you call when you need it.
The class of the object reference in your data table should then be “subclass of ” such that all those objects will have that function.
In your blueprint class, click “Add Function” and implement a function called ReturnAllMeshes()
Make this function return an array of meshes.
Make that array be built by simply referencing all components you have that include meshes and getting their meshes into the array.
Now, in the data table, where you specify the field that’s supposed to take your blueprint instance, make sure it knows the class of your blueprint (e g, not a generic class like “Actor” but your specific blueprint class.)
Now, you should be able to simply take the blueprint you get from the data table, and call “Return All Meshes()” on it, and you should get all the meshes that it says it has.
you need to add a return node in ‘return all meshes function’ just drag the static meshes array into it, then in your for loop you need to get the mesh asset that is assigned to the component
In the BP I have a function that goes Self > Get Components by Class (I set this to Static Mesh Components) > Set Array (Static Mesh Component Array) > Return Node
So in my other BP that is actually calling these meshes…
Return Node is outputting a “Static Mesh Component” and it will not let me link that to a “Set Static Mesh” Node and it’s “New Mesh” Pin
It seems that either my array doesn’t have the right contents, or I need to covert it to a compatible output that can feed the “New Mesh” Pin on the “Set Static Mesh” Node
Error when trying to connect pin:
STATIC MESH COMPONENT OBJECT REFERENCE IS NOT COMPATIBLE WITH STATIC MESH OBJECT REFERENCE
so think about it, you have a static mesh component and in that component you set a mesh asset.
so if your array is of the type component you need to drag off that and get the mesh itself, sorry i forget the actual function off the top of my head but itll show up in the context
I got that part of it down. but since im dealing with static mesh components, I need to get just the static mesh objects from them… i dont know if i do in the function or after I call them from another bp and what nodes to use.
Edit: Your function is correct, but instead of setting the array, add each one to the array. Then return the array. Your current implementation will only have 1 static mesh in the array. Also, you need to return after the for loop completes, not during the loop body.
The player is looking to positing a set of a table and 4 chairs into a room.
The player selects the dining set.
The player is presented with a holographic 3d preview of the models that he can move around for placement preview, then clicks to spawn the objects in place.
The BP of the table set has 5 meshes inside of it, the table and 4 chairs.
Currently the BP in charge of the hologram preview is pulling the 5 meshes from the TABLE SET BP, but overriding each other instead of pulling them in and adding each one to the preview location. therefore only the last mesh is displayed for the player.
The PlayerBP reference. Then from the return value of that Add component function, you want to set the static mesh of it directly with the array element from the loop. (target = return value of add SM component, NewMesh = Array element)