Hi,
How would one go about changing the base color for a material by scripting (I’ve got >5k that needs altering and I really want to avoid manual work)?
Here’s what I’ve tried
m = unreal.EditorAssetLibrary.load_asset('/Game/Materials/some_material_1')
mi = unreal.MaterialInstanceConstant(m)
print(unreal.MaterialEditingLibrary.get_material_instance_vector_parameter_value(mi, 'Param'))
# <Struct 'LinearColor' (0x7fd05b30b5b0) {r: 0.000000, g: 0.000000, b: 0.000000, a: 1.000000}>
unreal.MaterialEditingLibrary.set_material_instance_vector_parameter_value(mi, 'Param', unreal.LinearColor(r=0.23, g=0.12, b=0.18, a=0.33))
print(unreal.MaterialEditingLibrary.get_material_instance_vector_parameter_value(mi, 'Param'))
#<Struct 'LinearColor' (0x7fd05691e150) {r: 0.230000, g: 0.120000, b: 0.180000, a: 0.330000}>
unreal.MaterialEditingLibrary.update_material_instance(mi)
All seems good, but - nothing changes?
In the editor there’s an option to Apply changes? Is that the missing part here? How can I reach that by script?
Appreciate your help on this!
Thanks,
Sture