unreal.MaterialEditingLibrary - How to get the Parameter Name of an MaterialExpressionParameter?

Hello,

I am in the process of making an kind of material converter tool as editor utility/python where it goes through the material of selected static meshes, checks which textures are connected to which material properties. It then presents a UI, where you pick a new master material and then plug the textures where you need them.

When dealing with materials, I have a solution that works well. Using the unreal.MaterialEditingLibrary, a python script goes recursively through all MaterialExpressions and tells me which MaterialExpressionTextureSample is plugged in which MaterialProperty and then shows me the textures.

The Problem:
Once I try to support MaterialInstances aswell, I hit a wall. There is no possibility to go through MaterialExpressions in MaterialInstances, so the only possibility is use “get_texture_parameter_names” which spits a list of parameter names. But I still don’t know which texture is connected to which MaterialProperty at this point.

My idea was to map the TextureParameter names to the names of the actual MaterialExpressions in the base material. Here is where I hit the wall: I can’t find any possibility to get the ParameterName from an MaterialExpression. Be it A MaterialExpressionTextureParameter2D or other types of parameter MaterialExpressions.

Anyone got an Idea how I can find out which texture is plugged in which MaterialProperty for an MaterialInstance?

This is basically what I need to know inside a utility blueprint or python script, mapped the the actual MaterialExpressionObject
2024-06-03 10_05_04-Window

Thanks in advance!