Download

Using override_materials with skeletal mesh component?

Hi,
I’m trying to replace some materials in a skeletal mesh component using the new UE4 python plugin.
I can get the component and even display the name of the skeletal mesh all right, so i’m sure i work with the right skeletal mesh component.
But when trying to list the materials, using the override_materials array:
docs.unrealengine.com/en-US/PythonAPI/class/SkeletalMeshComponent.html

I only get an empty array.

this works

SKMesh = SMTarget.get_editor_property(“SkeletalMesh”)
print(SKMesh.get_name())

this gives an empty array

MatArray = SMTarget.get_editor_property(“override_materials”)
print ("{}".format(MatArray))

Any idea ?
Thanks
Cedric

Got it.
The override_materials array is empty until you manually override one of the materials.
So to get the original list of materials, we have to load the skeletalmesh and get its materials array.
Then create a new array containing modifications, and finally set this new array as the override_materials array with set_editor_property(“override_materials”, MyNewMatArray)
Cheers