Hi Njibhu,
i big thank you for this nice +C+ class
I put here just a simple class inherited from yours to have automatic completion
have a nice day everyone
import unreal
class LayeredMaterialLibrary:
@staticmethod
def get_layer_count(instance):
return unreal.LayeredMaterialLibrary.get_layer_count(instance)
@staticmethod
def add_material_layer(instance):
return unreal.LayeredMaterialLibrary.add_material_layer(instance)
@staticmethod
def is_layered_material(instance):
return unreal.LayeredMaterialLibrary.is_layered_material(instance)
@staticmethod
def assign_layer_material(instance, layer_index, new_layer_function):
return unreal.LayeredMaterialLibrary.assign_layer_material(instance, layer_index, new_layer_function)
@staticmethod
def assign_blend_layer(instance, layer_index, new_blend_layer_function):
return unreal.LayeredMaterialLibrary.assign_blend_layer(instance, layer_index, new_blend_layer_function)
@staticmethod
def get_layered_material_scalar_parameter_value(instance, parameter_name, layer_index):
return unreal.LayeredMaterialLibrary.get_layered_material_scalar_parameter_value(instance, parameter_name, layer_index)
@staticmethod
def set_layered_material_scalar_parameter_value(instance, parameter_name, layer_index, value):
return unreal.LayeredMaterialLibrary.set_layered_material_scalar_parameter_value(instance, parameter_name, layer_index, value)
@staticmethod
def get_layered_material_static_switch_parameter_value(instance, parameter_name, layer_index):
return unreal.LayeredMaterialLibrary.get_layered_material_static_switch_parameter_value(instance, parameter_name, layer_index)
@staticmethod
def set_layered_material_static_switch_parameter_value(instance, parameter_name, layer_index, value):
return unreal.LayeredMaterialLibrary.set_layered_material_static_switch_parameter_value(instance, parameter_name, layer_index, value)
@staticmethod
def get_layered_material_texture_parameter_value(instance, parameter_name, layer_index):
return unreal.LayeredMaterialLibrary.get_layered_material_texture_parameter_value(instance, parameter_name, layer_index)
@staticmethod
def set_layered_material_texture_parameter_value(instance, parameter_name, layer_index, value):
return unreal.LayeredMaterialLibrary.set_layered_material_texture_parameter_value(instance, parameter_name, layer_index, value)
# Example usage
if __name__ == "__main__":
instance = unreal.load_object(None, '/Game/AP_MaterialLibrary/CommonMaterial/CommonLayer/testPython')
new_layer_function = unreal.load_object(None, '/Game/AP_MaterialLibrary/LayerMaterial/ML_Master/ML_PLANAR_LAYER')
new_blend_layer_function = unreal.load_object(None, '/Game/AP_MaterialLibrary/LayerMaterial/ML_Blend/MLB_PlanarAngleHeightVertexRadialMaskAutoAxe')
parameter_name = 'Metallic'
layer_index = 0
value = .5
#LayeredMaterialLibrary.refresh_editor_material_instance(instance)
print(instance)
print(LayeredMaterialLibrary.get_layer_count(instance))
LayeredMaterialLibrary.add_material_layer(instance)
print(LayeredMaterialLibrary.is_layered_material(instance))
LayeredMaterialLibrary.assign_layer_material(instance, layer_index, new_layer_function)
layer_index = 1
LayeredMaterialLibrary.assign_layer_material(instance, layer_index, new_layer_function)
LayeredMaterialLibrary.assign_blend_layer(instance, layer_index, new_blend_layer_function)
print(LayeredMaterialLibrary.get_layered_material_scalar_parameter_value(instance, parameter_name, layer_index))
LayeredMaterialLibrary.set_layered_material_scalar_parameter_value(instance, parameter_name, layer_index, value)
parameter_name = 'Normal Map ?'
print(LayeredMaterialLibrary.get_layered_material_static_switch_parameter_value(instance, parameter_name, layer_index))
LayeredMaterialLibrary.set_layered_material_static_switch_parameter_value(instance, parameter_name, layer_index, True)
parameter_name = 'Normal_Map'
print(LayeredMaterialLibrary.get_layered_material_texture_parameter_value(instance, parameter_name, layer_index))
#LayeredMaterialLibrary.set_layered_material_texture_parameter_value(instance, parameter_name, layer_index, unreal.load_object(None, '/Game/Path/To/Your/Texture'))