Hi, I’m working on a python script to help automate the process of importing our assets and setting up their materials.
For my test case, in Maya I have a mesh with a single material assigned to it named “mat_01”. After importing the mesh into UE I see that the “imported_material_slot_name” and “material_slot_name” properties for it’s one material slot are both “mat_01” which seems like what I would expect.
In my script I then try to assign a MaterialInstance (mat_inst_01) to the mesh by doing the following (basically)…
# specify the name of the material slot I'm setting on the mesh slot_name = unreal.Name("mat_01") # create a new SkeletalMaterial using mat_inst_01 and slot_name skeletal_material = unreal.SkeletalMaterial(mat_inst_01, slot_name) # create an array and add skeletal_material to it material_array = unreal.Array(unreal.SkeletalMaterial) material_array.append(skeletal_material) # set material on the mesh using material_array mesh.set_editor_property('materials', material_array)
Doing this appears to set the material correctly on the mesh, however I notice that while the property for “material_slot_name” is still “mat_01”, the property for “imported_material_slot_name” now has a value of “None”.
Is this expected behavior?
If I then reimport the mesh I am prompted with a “Reimport Material Conflicts Resolution” dialog with an option to “Reset To Fbx” which will restore the original “imported_material_slot_name” value of “mat_01”.
Is there some other way that I should be doing this that will leave the value for “imported_material_slot_name” in tact? I’d rather not have our users confronted with the Conflicts Resolution dialog and be confused if they ever have to reimport the mesh.
The main documentation I’ve been referring to are the following pages, I *believe *I’m doing this correctly but I’m not ruling out the possibility that I’m misunderstanding how this is supposed to be done.
Any and all help is greatly appreciated.