Hi, Im new to python scripting. That said, i was attending an unreal learning course “Revit to Unreal Engine Fundamentals”, in which they use a python script to replace one material, imported by datasmith, with another created in the project (instance material created from revit - Master material from starter content)
import unreal
red_material = unreal.EditorAssetLibrary.load_asset("MaterialInstanceConstant'/Game/Udatasmith/GAR-MO-IA41_55b-EST-IND-01-P-R10_05_11_21-Vista3D-Unreal_1_Vivienda_terminada/Materials/Contrachapado__entablados.Contrachapado__entablados'")
if red_material is None:
print "The red material can't be loaded"
quit()
white_material = unreal.EditorAssetLibrary.load_asset("MaterialInstanceConstant'/Game/Materials/MI_Instances/MI_RobleViejo.MI_RobleViejo'")
if white_material is None:
print "The white material can't be loaded"
quit()
actor_list = unreal.EditorLevelLibrary.get_all_level_actors()
actor_list = unreal.EditorFilterLibrary.by_class(actor_list, unreal.StaticMeshActor.static_class())
unreal.EditorLevelLibrary.replace_mesh_components_materials_on_actors(actor_list, red_material, white_material)
Original code is in here at 3:03
I’m trying to replace the instance material created in revit that is being used in a bunch of static meshes with my instance material creted in UE
Any help would be great, thank u