I am attempting to get the material slot names of a static mesh asset in the editor using python. However I cant seem to find a way to retrieve this information.
I am able to do this easily for a skeletal mesh using material = skeletal_mesh_asset.get_editor_property('materials')
this return’s a SkeletalMaterial which contains it’s slot name as an editor property eg. material.get_editor_property('material_slot_name')
However, I am unable to read the Materials property of a static mesh as it is marked as protected:
Running material = static_mesh_asset.get_editor_property('materials')
throws the following exception:
LogPython: Error: Exception: StaticMesh: Property 'Materials' for attribute 'materials' on 'StaticMesh' is protected and cannot be read
There does not appear to be any other way to get a StaticMaterial object in the python api. I am able to get the number of slots a static mesh has using the EditorStaticMeshLibrary, but this returns a MaterialInstance object which does not contain any information about the slot it is assigned to.
Is there a reason that the Materials property is protected on static meshes while being accessible for skeletal meshes? I am thinking that this may be an oversight and should be made accessible in the future.