Class Node

class node.Node

This class represents an InstantTerra node.

>>> from wysilab import InstantTerra
>>> it = InstantTerra()
>>> my_node = it.project.graph.get_all_nodes()[0]  # Get the first node
Node.has_parameter(parameter_name)
Parameters

parameter_name (str) – Name of the parameter.

Returns

True if the parameter exists, otherwise False.

Return type

bool

>>> my_node.has_parameter("offset_x")
True
>>> my_node.has_parameter("unknown")
False
Node.get_parameter_list()
Returns

List of parameters name.

Return type

list (of str)

Returns the list of node parameters name.

>>> my_node.get_parameter_list()
['file_name', 'user_defined_range', 'min_height', 'max_height']
Node.get_parameter(parameter_name)
Parameters

parameter_name (str) – Name of the parameter.

Returns

Value of the parameter.

Return type

str

Raises

IndexError – Raise an exception if the parameter name was not found.

Returns the value of the parameter.

>>> my_node.get_parameter("max_height")
'200.0'
Node.set_parameter(parameter_name, value)
Parameters
  • parameter_name (str) – Name of the parameter.

  • value (str) – Value to set.

Raises
  • IndexError – The parameter name was not found.

  • ValueError – The value can not be set (i.e. Wrong type).

Sets the value of the parameter.

>>> my_node.set_parameter("max_height", "100.0")
>>> my_node.get_parameter("max_height")
'100.0'
Node.get_connectors()

Returns a dictionnary of connectors of the Node.

>>> my_node.get_connectors()
{<ConnectorMode.MandatoryInput: 0>: [Connector<...>], <ConnectorMode.OptionalInput: 1>: [], <ConnectorMode.Output: 2>: [Connector<...>, Connector<...>]}
Node.name
Type

str

Name of the node.

>>> my_node.name = "MyNodeName"
>>> print(my_node.name)
MyNodeName
Node.comment
Type

str

Comment of the node.

>>> my_node.comment = "A simple commentary"
>>> print(my_node.comment)
A simple commentary
Node.type
Type

str

Raises

ValueError – Impossible to override this attribute.

Type of the node.

>>> print(my_node.type)
Perlin noise