unreal.InterchangeShaderPortsAPI

class unreal.InterchangeShaderPortsAPI(outer: Object | None = None, name: Name | str = 'None')

Bases: Object

The Shader Ports API manages a set of inputs and outputs attributes. This API can be used over any InterchangeBaseNode that wants to support shader ports as attributes.

C++ Source:

  • Plugin: Interchange

  • Module: InterchangeNodes

  • File: InterchangeShaderGraphNode.h

classmethod connect_default_ouput_to_input(interchange_node, input_name, expression_uid) bool

Adds an input connection attribute.

Parameters:
  • interchange_node (InterchangeBaseNode) – The node to create the input on.

  • input_name (str) – The name to give to the input.

  • expression_uid (str) – The unique ID of the node to connect to the input.

Returns:

True if the input connection was successfully added to the node.

Return type:

bool

classmethod connect_ouput_to_input_by_index(interchange_node, input_name, expression_uid, output_index) bool

Adds an input connection attribute.

Parameters:
  • interchange_node (InterchangeBaseNode) – The node to create the input on.

  • input_name (str) – The name to give to the input.

  • expression_uid (str) – The unique ID of the node to connect to the input.

  • output_index (int32) – The index of the output from ExpressionUid to connect to the input.

Returns:

True if the input connection was successfully added to the node. OutputIndex is encoded in a string in the following pattern: ExpressionUid:OutputByIndex:FString::FromInt(OutputIndex) The index should be retrieved using UInterchangeShaderPortsAPI::GetOutputIndexFromName().

Return type:

bool

classmethod connect_ouput_to_input_by_name(interchange_node, input_name, expression_uid, output_name) bool

Adds an input connection attribute.

Parameters:
  • interchange_node (InterchangeBaseNode) – The node to create the input on.

  • input_name (str) – The name to give to the input.

  • expression_uid (str) – The unique ID of the node to connect to the input.

  • output_name (str) – The name of the output from ExpressionUid to connect to the input.

Returns:

True if the input connection was successfully added to the node.

Return type:

bool

classmethod gather_inputs(interchange_node) Array[str]

Retrieves the names of all the inputs for a given node.

Parameters:

interchange_node (InterchangeBaseNode) –

Returns:

out_input_names (Array[str]):

Return type:

Array[str]

classmethod get_input_connection(interchange_node, input_name) (out_expression_uid=str, output_name=str) or None

Retrieves the node unique id and the output name connected to a given input, if any.

Parameters:
Returns:

out_expression_uid (str):

output_name (str):

Return type:

tuple or None

classmethod has_input(interchange_node, input_name) bool

Checks whether a particular input exists on a given node.

Parameters:
Return type:

bool

classmethod has_parameter(interchange_node, input_name) bool

Checks whether a particular input exists as a parameter on a given node.

Parameters:
Return type:

bool

classmethod is_a_parameter(attribute_key) bool

Returns true if the attribute key is an input that represents parameters (ends with “:Parameter”).

Parameters:

attribute_key (str) –

Return type:

bool

classmethod is_an_input(attribute_key) bool

Returns true if the attribute key is associated with an input (starts with “Inputs:”).

Parameters:

attribute_key (str) –

Return type:

bool

classmethod make_input_connection_key(input_name) str

Makes an attribute key to represent a node being connected to an input (that is, Inputs:InputName:Connect).

Parameters:

input_name (str) –

Return type:

str

classmethod make_input_name(input_key) str

From an attribute key associated with an input (that is, Inputs:InputName:Value), retrieves the input name.

Parameters:

input_key (str) –

Return type:

str

classmethod make_input_parameter_key(input_name) str

Makes an attribute key to represent a parameter being given to an input (that is, Inputs:InputName:Parameter). This is more relevant to Materials, but could be used to differentiate between constant values and parameters.

Parameters:

input_name (str) –

Return type:

str

classmethod make_input_value_key(input_name) str

Makes an attribute key to represent a value being given to an input (that is, Inputs:InputName:Value).

Parameters:

input_name (str) –

Return type:

str