I came up with some code to make a material with a few extra connected TextureSample node.
# Works with Unreal 4.25.3
# (c) 2020 Atom.
asset_path = "/Game"
mat_name = "honeycomb"
#Import known images as a list of Texture2D objects.
lst_image_files =
r'F:\Keep\Maps\3D Textures\Honeycomb_002_SD\Honeycomb_002_basecolor.jpg',
r'F:\Keep\Maps\3D Textures\Honeycomb_002_SD\Honeycomb_002_normal.jpg',
r'F:\Keep\Maps\3D Textures\Honeycomb_002_SD\Honeycomb_002_ambientOcclusion.jpg'
]
data = unreal.AutomatedAssetImportData()
data.set_editor_property('destination_path', "%s/Mats" % asset_path)
data.set_editor_property('filenames', lst_image_files)
lst_texture2D = unreal.AssetToolsHelpers.get_asset_tools().import_assets_automated(data)
# Node input conenction types.
# MP_BASE_COLOR, MP_NORMAL, MP_ROUGHNESS, MP_SPECULAR, MP_EMISSIVE_COLOR, MP_OPACITY, MP_AMBIENT_OCCLUSION
# Create a material.
assetTools = unreal.AssetToolsHelpers.get_asset_tools()
mf = unreal.MaterialFactoryNew()
mat_closure = assetTools.create_asset("M_%s" % mat_name, "%s/Mats" % asset_path, unreal.Material, mf)
# Make a texture diffuse node.
ts_node_diffuse = unreal.MaterialEditingLibrary.create_material_expression(mat_closure,unreal.MaterialExpressionTextureSample,-384,-200)
unreal.MaterialEditingLibrary.connect_material_property(ts_node_diffuse, "RGBA", unreal.MaterialProperty.MP_BASE_COLOR)
if lst_texture2D[0]!=None:
ts_node_diffuse.texture = lst_texture2D[0]
# Make a texture normal node.
ts_node_normal = unreal.MaterialEditingLibrary.create_material_expression(mat_closure,unreal.MaterialExpressionTextureSample,-384,200)
unreal.MaterialEditingLibrary.connect_material_property(ts_node_normal, "RGB", unreal.MaterialProperty.MP_NORMAL)
if lst_texture2D[1]!=None:
# Change this sampler color sample type to work with normal types.
ts_node_normal.sampler_type = unreal.MaterialSamplerType.SAMPLERTYPE_NORMAL
ts_node_normal.texture = lst_texture2D[1]
# Make a texture AO node.
ts_node_AO = unreal.MaterialEditingLibrary.create_material_expression(mat_closure,unreal.MaterialExpressionTextureSample,-384,500)
unreal.MaterialEditingLibrary.connect_material_property(ts_node_AO, "RGB", unreal.MaterialProperty.MP_AMBIENT_OCCLUSION)
if lst_texture2D[2]!=None:
ts_node_AO.texture = lst_texture2D[2]
# Make a constant float node.
ts_node_roughness = unreal.MaterialEditingLibrary.create_material_expression(mat_closure,unreal.MaterialExpressionConstant,-125,150)
ts_node_roughness.set_editor_property('R', 0.5)
unreal.MaterialEditingLibrary.connect_material_property(ts_node_roughness, "", unreal.MaterialProperty.MP_ROUGHNESS)
# Make a constant float node.
ts_node_specular = unreal.MaterialEditingLibrary.create_material_expression(mat_closure,unreal.MaterialExpressionConstant,-125,50)
ts_node_specular.set_editor_property('R', 0.13)
unreal.MaterialEditingLibrary.connect_material_property(ts_node_specular, "", unreal.MaterialProperty.MP_SPECULAR)
#unreal.MaterialEditingLibrary.recompile_material(mat_closure)