Download

How to extract static mesh from BP, populate another BPs static mesh var.

I have an app that is more of a tool than anything. It works on static meshes. I’m pretty new to the Unreal world and blueprints and I’m not finding exactly what I’m looking for in my online searching… I was hoping I might get some assistance from the community…

Without going into a lot of history here, I need to change the way this works (I’m not the original developer and as mentioned, pretty new to all this). Currently I have a “Control_BP” that exposes a static mesh variable to the World Outliner. This all works and the entire app works. But, I need to change it to the following type of structure which I explain below.

I have a hierarchy of blueprints based on a static mesh. I right clicked on the static mesh, chose “Asset Actions -> Create Blueprint using this” which created a blueprint based on “Actor” and I have named it “RootStaticMesh_BP”
From there I have created children blueprints “Right Click -> Create Child Blueprint Class”. These child blueprints will hold one static mesh with materials on them… Examples would include things like; Basketball_BP, Car_BP, House_BP, Dog_BP, etc…

So, now I have to change “Control_BP” to expose the “RootStaticMesh_BP” which I have done with a variable named “Model_BP”. And because of Inheritance, from the content browser I can drag one child blueprint, say “Car_BP”. This all works, or so it would seem as the World Outliner let me drag a child onto this parent exposed field.

Control_BP already has a publicly exposed Static Mesh variable called “Model” that we HAD been using which is where we would drag a static mesh onto from the content browser. However, this really does not need to be exposed in the World Outliner anymore now that I’ve exposed the “RootStaticMesh_BP” and this is what will contain the static mesh we want to operate on.

There is where my lack of fully understanding blueprints is haunting me and I just KNOW it’s most likely a very simple solution, but I have not been able to find it by searching the internet and or reading up in the Unreal Docs…

All that just to ask this one question that I’m sure is painfully simple, that for some reason is eluding me.

Again, My Control_BP has two public variables.

  • “Model” of type Static Mesh
  • “Model_BP” of type RootModel_BP.

So, In my construction script of Control_BP… How do I extract “Model_BP”s static mesh and populate “Model”

For now I want to reuse the variable “Model” because it’s being used in other places and I really don’t feel like opening up that can of worms just yet.

Any help will be greatly appreciated!!!

Thanks
Rick

If all of your Model_BPs have only one static mesh component, you can use the Get Component by Class node & specify the component class as StaticMeshComponent to retrieve your static mesh component. You can then use the Get Static Mesh node on it to get the mesh & store it in your Model variable.

On the other hand, if your Model_BP can have multiple static mesh components in it, then the above method can fail since we don’t know which one of them is going to be retrieved by the function.

So in that scenario, I’d suggest heading over to the RootModel_BP & adding a tag to the required static mesh component using the Component Tags section in the details panel. This will help us identify the component which is essential for the next step.

With the components now having a tag to identify them, you can use the Get Components by Tag node & proceed to store the static mesh as mentioned in the first case.

Thanks for your reply. I’m chugging along but I have another question. My bluepring is based on the static mesh. So, I end up with a “Static Mesh Component”. But… The other blueprint that needs to use this, is expecting a “Static Mesh Object Reference”. So, how do I get the static mesh object reference OUT OF the Static Mesh Component?

Alright, so once you have the static mesh component, you can use the Get Static Mesh node on it to get the actual mesh.

I am having the exact same issue. Could you figure it out? Possible to share a full screenshot from the nodes connecting?

I followed your description as closely as I could, I think the construction script should be:

Screenshot_1.jpg