Setting Properties on Material Instances

I am trying to set some parameters on my material instance to automate the process and i made a simple instance to test it on.

instance is already set to the reference.
if i did scalar_value= instance.get_scalar_parameter_value(“TestVal”)
print scalar_value i would get 1.0

i want to be able to set the value of that scalar parameter

i have tried
instance.set_editor_property(“scalar_parameter_values”,(parameter_info=‘TestVal’, MaterialParameterAssociation.GLOBAL_PARAMETER, -1], parameter_value=0.0))

I have tried various version of this line of code but get the error: LogPython: Error: SyntaxError: invalid syntax (<string>, line 1)

I played around with this and got the following to work, not sure if this will work for you. I tried to use the set_editor_property and could not get anything to work either.

paramInfo = instance.scalar_parameter_values
print paramInfo
#LogPython: {parameter_info: {name: "testVal", association: GlobalParameter, index: -1}, parameter_value: 1.000000}, {parameter_info: {name: "RefractionDepthBias", association: GlobalParameter, index: -1}, parameter_value: 0.000000}]

#because i got an array, i need to check and make sure i am adjusting the right one.
for i in range(len(paramInfo)):
   if paramInfo* == "testVal":
      print "Found Parameter"
      newParams = paramInfo*  #i made a copy
      newParams.parameter_value = 1.2 # adjusted the value
      paramInfo* = newParams #copied all the values back to the array

print instance.get_scalar_parameter_value("testVal")
#LogPython: 1.20000004768

After running the above code i reloaded the material instance in the material editor and the values changed. Note: For some reason if the material instance was already loaded and you run the code, the changes do happen behind the scenes, but don’t show up in the editor until you reload it. Meaning you need to close and double click on the material instance again to see the changes

Or grab my EditorPlus plugin, switch to the 4.22 branch and use this:


Tried to use it but it refused to build. will try again later also the link you gave is broken

Hi westcut!

How do you turn on the checkbox parameter in python?

unfortunately havent figured that part out as we move on from that section it is on hold for now

Thanks for the reply westcut,

I’m completly stuck in this part right now, I gonna try to understand how to do it in C++ and then replicate it in Pyhton, maybe someone can bring us some light into this… I’m lost xD

Ye i made a UDIM texturing system that handles that but setting the bool was annoying

A friend just told me how he do this in C++:

SetTextureParameterValueEditorOnly(FMaterialParameterInfo(“Diffuse”), GetTextureByName(Textures[animaMat->mDiffuseIndex].mName, ConnectionSlot::DiffuseSlot));

I have checked it and we don’t have this method in python, I can assume that we shoud replicate it with “set_editor_property” but does not work for me in any case. :frowning:


Ok! I found a way to do it, I modfied the previus code to show you.

At the same way that you can set a parameter into a dict, you can make a copy and set the name of the parameter, if it exists,automatically the checkbox is turned on.

for i in range(len(paramInfo)):
    if paramInfo* == "testVal":
        print "Found Parameter"
        newParams = paramInfo* #i made a copy
        newParams.parameter_value = 1 # adjusted the value
        paramInfo* = newParams #copied all the values back to the array
        new_param = paramInfo* = "testVale"
        new_param.parameter_value = 1
        paramInfo* = new_param

I made a couple of functions in order to create or modify material instance parameters:

SetTextureParameterValueEditorOnly(FMaterialParameterInfo(“Diffuse”), GetTextureByName(Textures[animaMat->mDiffuseIndex].mName, ConnectionSlot::DiffuseSlot));

I did it this way, using your idea :slight_smile:

#select your mats in Content Browser you want to enable all paramters on
import unreal as ue

# create unreal class instances

edutil = ue.EditorUtilityLibrary()


# get the selected assets

selected_assets = edutil.get_selected_assets()

for inst in selected_assets:

    for sc_name in mated.get_scalar_parameter_names(inst):



    for c_name in mated.get_vector_parameter_names(inst):



    for t_name in mated.get_texture_parameter_names(inst):