Just thought I’d bring this to attention again. It would be a really handy feature to have the ability to assign materials in the property matrix. In my case the models aren’t assigned the same material in 3ds Max so it’s just as quick to manually assign the same material to all of them in UE4. Sadly still incredibly slow.
The issue I had with SkyHigh’s solution was that it worked for replacing references between materials but not between material and instance.
The way i have found that works (and its by no means perfect (EPIC get onto this and solve it) but you select all your meshes with the material you want to change within the content browser (hopefully you’re organised there…) > right click > Asset Actions > Select actors using this asset. That will then select all the meshes within the design space, and you should then be able to change the material in the details window to the right.
If the materials do not show up, you might have selected a mesh(s) that are contained within a group and for some reason you cannot change that… Dont ask me why…
Im just a noob at this but thought i would explain a way i found that it works.
Please return the favour if you find a better / faster way.
To complete Spoondog answer, you could also automate the process using python.
The script presents two ways of applying material: on all static mesh in a directory of the content browser, on static mesh of selected actors in level.
import unreal
new_material_path = '\Game\M_NewMat'
asset_folder = '\Game\Geometries'
load_material = unreal.EditorAssetLibrary.load_asset(new_material_path)
version = 1
#version 1: setting material based on asset in a content browser directory
if version == 1:
list_assets = unreal.EditorAssetLibrary.list_assets(asset_folder,True,False)
for asset in list_assets:
load_asset = unreal.EditorAssetLibrary.load_asset(asset)
if load_asset.get_class() == unreal.StaticMesh.static_class():
load_asset.set_material(0,load_material)
unreal.EditorAssetLibrary.save_asset(asset)
#version 2: setting material on meshes contained in selected static mesh actors in the level
elif version == 2:
list_selected_static_mesh_actors = unreal.EditorFilterLibrary.by_class(unreal.EditorLevelLibrary.get_selected_level_actors(),unreal.StaticMeshActor)
for static_mesh_actor in list_selected_static_mesh_actors:
static_mesh_component = static_mesh_actor.static_mesh_component
if static_mesh_component is None:
continue
static_mesh = static_mesh_component.static_mesh
if static_mesh is None:
continue
static_mesh.set_material(0,load_material)
unreal.EditorAssetLibrary.save_asset(static_mesh.get_path_name())
What would be nice is selecting a material in the content browser right clicking and clicking and option that selects meshes with material so you could do a large material replace with some other material. Is this possible with Blutility?
Yea it should be possible in blutility by iterating assets via the asset registry. Or you could maybe do it now by using the reference viewer to find the meshes using the material (I think you can select multiple things in the content browser via the reference viewer), and then apply the new material via the method I posted above.
Both Spoondogs and Flaviens answers give you quick and quite easy to set up ways to batch-apply materials to meshes, especially now with more advanced blutility potions.