Bootstrap Chameleon Logo

PythonMaterialLib

Function Name Description
get_static_switch_parameter_values Get the Static Switch Infos of material instance
set_static_switch_parameter_value Set the Static Switch Infos of material instance
set_static_switch_parameters_values Batch set the Static Switch's status of material instance.
get_mf_static_switch_parameter Get the Static Switch Infos of material function.
get_static_parameters_summary Get the numbers of each StaticSwitchParameter of material instance.
log_mat Log out all the connections in the material
get_material_expressions Log out all the Material Expressions in the material
get_all_referenced_expressions Get Material Expressions in the material with specified feature level
get_material_connections Get all the connections in the material
get_material_function_connections Get all the connections in the material function
get_material_expression_input_names Get the input pin's names of the material expression
get_material_expression_output_names Get the output pin's names of the material expression
get_material_expression_captions The captions of the material expression
set_shading_model Set the shading model of the material, for the hidden shading model
get_material_expression_id Get the ParameterExpressionId of the material expression.
log_mf Log out all the connections in the material function
get_material_function_expressions Get all the expressions in the Material Function
get_material_function_output_expressions Get all the output expressions in the Material Function
get_selected_material_nodes Get the selected nodes in material editor.
log_material_expression Log Detail information of the MaterialExpression, include inputs, outputs etc.
log_editing_nodes Log Detail information of the Material or Material Function
get_selected_nodes_in_material_editor Get the selected nodes in material editor.
get_hlsl_code Get the HLSL code of the Material
get_shader_map_info Get the ShaderMaps infos in string format.
get_material_content Get the material's content in JSON Format
get_material_function_content Get the material function's content in JSON Format
connect_material_expressions Create connection between two material expressions
disconnect_expression Disconnection the material expression's input
connect_material_property Connect a material expression output to one of the material property inputs (e.g. diffuse color, world position offset etc)
disconnect_material_property Disconnect the material property input
get_material_proper_str_from_guid Get EMaterialProperty in string format from a guid
gen_guid_from_material_property_str Generate a Guid from EMaterialProperty
add_input_at_expression_set_material_attributes Add an Attribute Get Type pin for material expression "GetMaterialAttributes"
add_output_at_expression_get_material_attributes Add an Attribute Get Type pin for material expression "GetMaterialAttributes"

get_static_switch_parameter_values

Get the Static Switch Infos of material instance

unreal.PythonMaterialLib.get_static_switch_parameter_values(material_interface) -> Array[StaticSwitchInfo]
    Get the Static Switch Infos of material instance

    Args:
        material_interface (MaterialInterface): The material instance you want to query.

    Returns:
        Array[StaticSwitchInfo]:

        out_static_parameters (Array[StaticSwitchInfo]): The result of static switch infos, (StaticSwitchInfo: name, value, override).

set_static_switch_parameter_value

Set the Static Switch Infos of material instance

unreal.PythonMaterialLib.set_static_switch_parameter_value(material_instance, switch_name, enabled, update_static_permutation=True) -> None
    Set the Static Switch Infos of material instance

    Args:
        material_instance (MaterialInstanceConstant):
        switch_name (str): The name of static switch.
        enabled (bool): Enabled the switch or not.
        update_static_permutation (bool): Update static permutation or not.

set_static_switch_parameters_values

Batch set the Static Switch's status of material instance.

unreal.PythonMaterialLib.set_static_switch_parameters_values(material_instance, switch_names, values, overrides) -> None
    Batch set the Static Switch's status of material instance.

    Args:
        material_instance (MaterialInstanceConstant):
        switch_names (Array[str]): The names of each static switches you want to set.
        values (Array[bool]): The bool values of each static switches.
        overrides (Array[bool]): The overrides bool values of each static switches.

get_mf_static_switch_parameter

Get the Static Switch Infos of material function.

unreal.PythonMaterialLib.get_mf_static_switch_parameter(material_function) -> Array[StaticSwitchInfo]
    Get the Static Switch Infos of material function.

    Args:
        material_function (MaterialFunction): The material function you want to query.

    Returns:
        Array[StaticSwitchInfo]:

        out_static_parameters (Array[StaticSwitchInfo]): The result of static switch infos, (StaticSwitchInfo: name, value, override).

get_static_parameters_summary

Get the numbers of each StaticSwitchParameter of material instance.

unreal.PythonMaterialLib.get_static_parameters_summary(material_instance) -> (out_parameters_count=Array[int32], out_info=Array[str])
    Get the numbers of each StaticSwitchParameter of material instance.

    Args:
        material_instance (MaterialInstance):

    Returns:
        tuple:

        out_parameters_count (Array[int32]): The Count of each parameters: [StaticSwitchParameters, StaticComponentMaskParameters, TerrainLayerWeightParameters, MaterialLayersParameters]

        out_info (Array[str]): The name of each parameters.

log_mat

Log out all the connections in the material

unreal.PythonMaterialLib.log_mat(material_interface) -> None
    Log out all the connections in the material
    note: added in v1.0.8

    Args:
        material_interface (MaterialInterface): The source material

get_material_expressions

Log out all the Material Expressions in the material

unreal.PythonMaterialLib.get_material_expressions(material_interface) -> Array[MaterialExpression]
    Log out all the Material Expressions in the material
    note: added in v1.0.8

    Args:
        material_interface (MaterialInterface): The source material

    Returns:
        Array[MaterialExpression]:

        out_expressions (Array[MaterialExpression]):

get_all_referenced_expressions

Get Material Expressions in the material with specified feature level

unreal.PythonMaterialLib.get_all_referenced_expressions(material_interface, feature_level=3) -> Array[MaterialExpression]
    Get Material Expressions in the material with specified feature level
    note: added in v1.0.8

    Args:
        material_interface (MaterialInterface): The source material
        feature_level (int32): ERHIFeatureLevel value in integer. 0: ES2_REMOVED, 1: ES3_1, 2: SM4_REMOVED, 3: SM_5, 4: SM6. Default == 3(SM_5)

    Returns:
        Array[MaterialExpression]:

        out_expressions (Array[MaterialExpression]):

get_material_connections

Get all the connections in the material

unreal.PythonMaterialLib.get_material_connections(material_interface) -> Array[TAPythonMaterialConnection]
    Get all the connections in the material
    note: added in v1.0.8

    Args:
        material_interface (MaterialInterface): The source material

    Returns:
        Array[TAPythonMaterialConnection]: The connections

get_material_function_connections

Get all the connections in the material function

unreal.PythonMaterialLib.get_material_function_connections(material_function) -> Array[TAPythonMaterialConnection]
    Get all the connections in the material function
    note: added in v1.0.8

    Args:
        material_function (MaterialFunction): The source material function

    Returns:
        Array[TAPythonMaterialConnection]: The connections

get_material_expression_input_names

Get the input pin's names of the material expression

unreal.PythonMaterialLib.get_material_expression_input_names(expression, raw_name=False) -> Array[str]
    Get the input pin's names of the material expression
    note: added in v1.0.8

    Args:
        expression (MaterialExpression): The source material expression
        raw_name (bool): Set True will return the raw name that will not remove input type nor shorten the pin name. For instance the 'Input' will be none.

    Returns:
        Array[str]: The input pin's names in array

get_material_expression_output_names

Get the output pin's names of the material expression

unreal.PythonMaterialLib.get_material_expression_output_names(expression) -> Array[str]
    Get the output pin's names of the material expression
    note: added in v1.0.8

    Args:
        expression (MaterialExpression): The source material expression

    Returns:
        Array[str]: The output pin's names in array

get_material_expression_captions

The captions of the material expression

unreal.PythonMaterialLib.get_material_expression_captions(expression) -> Array[str]
    The captions of the material expression
    note: added in v1.0.8

    Args:
        expression (MaterialExpression): The source material expression

    Returns:
        Array[str]: The captions in array

set_shading_model

Set the shading model of the material, for the hidden shading model

unreal.PythonMaterialLib.set_shading_model(material, shading_model_value) -> None
    Set the shading model of the material, for the hidden shading model
    note: added in v1.0.8

    Args:
        material (Material): The source material
        shading_model_value (int32): The int value of the EMaterialShadingModel

get_material_expression_id

Get the ParameterExpressionId of the material expression.

unreal.PythonMaterialLib.get_material_expression_id(expression) -> Guid
    Get the ParameterExpressionId of the material expression.
    note: added in v1.0.8

    Args:
        expression (MaterialExpression): The source expression material

    Returns:
        Guid: The ParameterExpressionId

log_mf

Log out all the connections in the material function

unreal.PythonMaterialLib.log_mf(material_function) -> None
    Log out all the connections in the material function
    note: added in v1.0.8

    Args:
        material_function (MaterialFunction): The source material expression

get_material_function_expressions

Get all the expressions in the Material Function

unreal.PythonMaterialLib.get_material_function_expressions(material_function, recursive=False) -> Array[MaterialExpression]
    Get all the expressions in the Material Function
    note: added in v1.0.8

    Args:
        material_function (MaterialFunction): The source material expression
        recursive (bool): Recursive or not

    Returns:
        Array[MaterialExpression]:

        out_expressions (Array[MaterialExpression]):

get_material_function_output_expressions

Get all the output expressions in the Material Function

unreal.PythonMaterialLib.get_material_function_output_expressions(material_function) -> Array[MaterialExpressionFunctionOutput]
    Get all the output expressions in the Material Function
    note: added in v1.0.8

    Args:
        material_function (MaterialFunction): The source material expression

    Returns:
        Array[MaterialExpressionFunctionOutput]:

        output_expressions (Array[MaterialExpressionFunctionOutput]):

get_selected_material_nodes

Get the selected nodes in material editor.

unreal.PythonMaterialLib.get_selected_material_nodes(material) -> Array[MaterialExpression]
    Get the selected nodes in material editor.
    note: Use this function in OnMaterialEditorMenu in MenuConfig.ini, the asset path of the material will be passed automatic.
    note: For example: unreal.PythonMaterialLib.get_selected_nodes_in_material_editor(unreal.load_asset(%asset_paths[0]))
    note: added in v1.0.8

    Args:
        material (Material): The editing material

    Returns:
        Array[MaterialExpression]:

        out_expressions (Array[MaterialExpression]):

log_material_expression

Log Detail information of the MaterialExpression, include inputs, outputs etc.

unreal.PythonMaterialLib.log_material_expression(material_expression) -> None
    Log Detail information of the MaterialExpression, include inputs, outputs etc.
    note: added in v1.0.8

    Args:
        material_expression (MaterialExpression): The material expression you want to query.

log_editing_nodes

Log Detail information of the Material or Material Function

unreal.PythonMaterialLib.log_editing_nodes(material_or_mf) -> None
    Log Detail information of the Material or Material Function
    note: added in v1.0.8

    Args:
        material_or_mf (Object): The material or material function you want to query.

get_selected_nodes_in_material_editor

Get the selected nodes in material editor.

unreal.PythonMaterialLib.get_selected_nodes_in_material_editor(material_or_mf) -> Array[MaterialExpression]
    Get the selected nodes in material editor.
    note: The Material Root Node is not included.
    note: added in v1.0.8

    Args:
        material_or_mf (Object): The material or the material function you want to query.

    Returns:
        Array[MaterialExpression]: The selected MaterialExpression nodes.

get_hlsl_code

Get the HLSL code of the Material

unreal.PythonMaterialLib.get_hlsl_code(material_interface) -> str or None
    Get the HLSL code of the Material
    note: The FeatureLevel if SM5
    note: added in v1.0.8

    Args:
        material_interface (MaterialInterface): The material you want to query.

    Returns:
        str or None: None or the HLSL source code

        out_source (str):

get_shader_map_info

Get the ShaderMaps infos in string format.

unreal.PythonMaterialLib.get_shader_map_info(material, platform_str, detail=False) -> str
    Get the ShaderMaps infos in string format.
    note: added in v1.0.8

    Args:
        material (Material): The material you want to query.
        platform_str (str): EShaderPlatform String: PCD3D_SM5, METAL, METAL_MRT, PCD3D_ES3_1, OPENGL_PCES3_1, METAL_SM5, VULKAN_PCES3_1, VULKAN_SM5, VULKAN_ES3_1_ANDROID, METAL_MACES3_1, OPENGL_ES3_1_ANDROID, METAL_MRT_MAC, METAL_TVOS, METAL_MRT_TVOS
        detail (bool): Log Detail ShaderMap or not

    Returns:
        str: The ShaderMap info content as JSON

get_material_content

Get the material's content in JSON Format

unreal.PythonMaterialLib.get_material_content(material, only_editable=True, include_comments=False) -> str
    Get the material's content in JSON Format
    note: added in v1.0.8

    Args:
        material (Material): The material you want to query.
        only_editable (bool): Get the Editable properties only or not.
        include_comments (bool): Include the Comments in Material Editor's graph or not.

    Returns:
        str: The material's content in JSON Format

get_material_function_content

Get the material function's content in JSON Format

unreal.PythonMaterialLib.get_material_function_content(material_function, only_editable=True, include_comments=False) -> str
    Get the material function's content in JSON Format
    note: added in v1.0.8

    Args:
        material_function (MaterialFunction): The material function you want to query.
        only_editable (bool): Get the Editable properties only or not.
        include_comments (bool): Include the Comments in Material Editor's graph or not.

    Returns:
        str: The material's content in JSON Format

connect_material_expressions

Create connection between two material expressions

unreal.PythonMaterialLib.connect_material_expressions(from_expression, from_output_name, to_expression, to_input_name) -> bool
    Create connection between two material expressions
    note: Same as the function in UMaterialEditingLibrary, add extra log when failed.
    note: added in v1.0.8

    Args:
        from_expression (MaterialExpression): Expression to make connection from
        from_output_name (str): Name of output of FromExpression to make connection from. Leave empty to use first output.
        to_expression (MaterialExpression): Expression to make connection to
        to_input_name (str): Name of input of ToExpression to make connection to. Leave empty to use first input.

    Returns:
        bool: True if connected

disconnect_expression

Disconnection the material expression's input

unreal.PythonMaterialLib.disconnect_expression(expression, input_name) -> bool
    Disconnection the material expression's input
    note: added in v1.0.8

    Args:
        expression (MaterialExpression): Expression
        input_name (str):

    Returns:
        bool: True if disconnected

connect_material_property

Connect a material expression output to one of the material property inputs (e.g. diffuse color, world position offset etc)

unreal.PythonMaterialLib.connect_material_property(from_expression, from_output_name, material_property_str) -> bool
    Connect a material expression output to one of the material property inputs (e.g. diffuse color,  world position offset etc)
    note: added in v1.0.8

    Args:
        from_expression (MaterialExpression): Expression to make connection from
        from_output_name (str): Name of output of FromExpression to make connection from
        material_property_str (str): EMaterialProperty value in string from. So we can connect to the "Hidden" Property, for instance: MP_WorldPositionOffset, MP_CustomData0,  MP_CustomizedUVs0 and so on

    Returns:
        bool: True if connected

disconnect_material_property

Disconnect the material property input

unreal.PythonMaterialLib.disconnect_material_property(material, material_property_str) -> bool
    Disconnect the material property input
    note: added in v1.0.8

    Args:
        material (Material): The target material
        material_property_str (str): EMaterialProperty value in string from. So we can connect to the "Hidden" Property, for instance: MP_WorldPositionOffset, MP_CustomData0,  MP_CustomizedUVs0 and so on

    Returns:
        bool: True if connected

get_material_proper_str_from_guid

Get EMaterialProperty in string format from a guid

unreal.PythonMaterialLib.get_material_proper_str_from_guid(guid) -> str
    Get EMaterialProperty in string format from a guid
    note: It's a python version of FMaterialAttributeDefinitionMap::GetProperty(guid)
    note: added in v1.0.8

    Args:
        guid (Guid): The Guid which used in AttributeGetTypes/AttributeSetTypes

    Returns:
        str: EMaterialProperty value in string

gen_guid_from_material_property_str

Generate a Guid from EMaterialProperty

unreal.PythonMaterialLib.gen_guid_from_material_property_str(property_str) -> Guid
    Generate a Guid from EMaterialProperty
    note: It's a python version of FMaterialAttributeDefinitionMap::GetID(Property)
    note: added in v1.0.8

    Args:
        property_str (str): EMaterialProperty String: MP_BaseColor, MP_Metallic, MP_Specular, MP_Normal, MP_WorldPositionOffset, MP_CustomData0, MP_CustomizedUVs0 and so on

    Returns:
        Guid: The new Guid

add_input_at_expression_set_material_attributes

Add an Attribute Get Type pin for material expression "GetMaterialAttributes"

unreal.PythonMaterialLib.add_input_at_expression_set_material_attributes(expression_set_material_attributes, property_str) -> None
    Add an Attribute Get Type pin for material expression "GetMaterialAttributes"
    note: added in v1.0.8

    Args:
        expression_set_material_attributes (MaterialExpressionSetMaterialAttributes): The target expression.
        property_str (str): EMaterialProperty String: MP_BaseColor, MP_Metallic, MP_Specular, MP_Normal, MP_WorldPositionOffset, MP_CustomData0, MP_CustomizedUVs0 and so on

add_output_at_expression_get_material_attributes

Add an Attribute Get Type pin for material expression "GetMaterialAttributes"

unreal.PythonMaterialLib.add_output_at_expression_get_material_attributes(expression_get_material_attributes, property_str) -> None
    Add an Attribute Get Type pin for material expression "GetMaterialAttributes"
    note: added in v1.0.8

    Args:
        expression_get_material_attributes (MaterialExpressionGetMaterialAttributes): The target expression.
        property_str (str): EMaterialProperty String: MP_BaseColor, MP_Metallic, MP_Specular, MP_Normal, MP_WorldPositionOffset, MP_CustomData0, MP_CustomizedUVs0 and so on

Other Editor Python Libs: