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)
parameter_name (str) : Name of the parameter.
True if the parameter exists, otherwise False.
bool
>>> my_node.has_parameter("offset_x")
True
>>> my_node.has_parameter("unknown")
False
Node.
get_parameter_list
()
List of parameters name.
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)
parameter_name (str) : Name of the parameter.
Value of the parameter.
str
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)parameter_name (str) : Name of the parameter.
value (str) : Value to set.
IndexError − The parameter name was not found.
ValueError − The value cannot 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
str
Name of the node.
>>> my_node.name = "MyNodeName"
>>> print(my_node.name)
MyNodeName
Node.
comment
str
Comment of the node.
>>> my_node.comment = "A simple commentary"
>>> print(my_node.comment)
A simple commentary
Node.
type
str
ValueError − Impossible to override this attribute.
Type of node.
>>> print(my_node.type)
Perlin noise
Node.
is_enabled
bool
node_is_enabled = my_node.is_enabled
my_node.is_enabled = False
Node.
get_maximum_value
float
ValueError − The node does not have an output terrain or mask.
Maximum elevation of the terrain in meters/ maximum value of the mask between 0 and 1
Calling this method triggers the calculation of the node if not
already done. When the project contains a lot of nodes, this
calculation may last several seconds to several minutes.
If the node contains several output terrains or masks (such as
erosion nodes), the first terrain or first mask is used.
As export nodes do not have any output terrain or mask, the method has to be called from the previous node.
>>> my_node.get_maximum_value()
120.5
Node.
get_minimum_value
float
ValueError − The node does not have an output terrain or mask.
Minimum elevation of the terrain in meters/ minimum value of the mask between 0 and 1
Calling this method triggers the calculation of the node if not
already done. When the project contains a lot of nodes, this
calculation may last several seconds to several minutes.
If the node contains several output terrains or masks (such as
erosion nodes), the first terrain or first mask is used.
As export nodes do not have any output terrain or mask, the method has to be called from the previous node.
>>> my_node.get_minimum_value()
-12.3
Copyright © 2022 · All Rights Reserved · Wysilab