Download

Set Material Instance Parent via Blueprints?

I’m trying to set the parent for an existing Material Instance in my Event Graph but haven’t found a way to do so yet. I see this “Set Material Instance Parent” node listed in the online docs but I’ve been unable to locate it in the Actions menu even with “Context Sensitive” disabled. Is this node no longer available or am I misunderstanding how/where it is allowed to be used?

Any help is appreciated.
Thanks.

It’s an editor widget utility node:

mip.JPG

Which means a few things:

  1. You need ‘blu-tilities’ enabled:

  1. Your blueprint needs to be a editor utility widget, in other words, have that as a parent class

  2. I don’t know if it’s supported at runtime or in a packaged release…

There it is! Thank you! Yes, I assumed I was trying to use it in the wrong type of Blueprint but it was not wholly apparent to me when reading the documentation (but then I’m still learning a lot about them). It is unfortunate (for me) that it can only be used in an editor utility widget as I was hoping I could use it to swap material instance parents at runtime but its good to know its there for use in editor utilities.

Thank you again for your help.

Just out of interest, what are you trying to achieve by changing parent at runtime?

Changing a character’s material instance to use a variant of its current parent material which includes additional instructions (for extra features or material effects) while maintaining all of it’s original parameter values (texture assignments, scalar, vector, etc).

My hope was that if it behaved similarly to manually assigning a new parent in the Instance properties window that I could just swap the parents and keep everything intact as opposed to having to create a new Instance using the new parent on the fly and propagate all the parameter values from the old Instance to the new one. Ultimately, we would almost certainly end up doing this in code but I was hoping to prototype the basic material behavior via Blueprints.

Fwiw, if there are other ways to go about this that I’m not aware of I’m open to any other suggestions.

It seems pretty complicated, I think I’d just change from one instance to another. The second could have a different parent anyway.

The Material I’m using as the new parent just uses a set of generic parameter values (texture, scalar, vector…). There is no version of it which uses the specific values set on the existing Material Instance currently assigned to my character asset so there is no other Instance to change to.

After your initial reply I did end up getting something working where I first use Get Materials to return an array of the Material Instances assigned to my mesh, then I iterate over that list creating (for each Instance) a new Dynamic Material Instance which uses the new parent and use CopyMaterialInstanceParameters to propagate the parameter values from the original Instance to the new one which I then assign to the appropriate index in the mesh’s material list. I can then restore the original Instances when desired by iterating over my array again and re-assigning them back to their original indices.

cant believe unreal does not allow to use existing material instances in blueprints…this is retarded beyond imagination

This works fine…

What am I missing? @**phil123456: **what is the actual use scenario?

How do you change the parent with the editor widget anyway? I can’t find a way to reference material instance to editor widget.