A node represents an operation in InstantTerra, i.e. the generation of a terrain using a noise or even an erosion simulation.
These nodes and their parameters are accessible directly via the API.
# Create an instance
from wysilab import InstantTerra
it = InstantTerra()
# Get the current graph and the list of nodes
graph = it.project.graph
list_of_node = graph.get_all_nodes()
# Get the first node of the graph
my_node = list_of_node[0]
my_node.name = "New name"
print(my_node.name)
To change or retrieve a node name, use the attribute name
.
my_node.comment = "This is a commentary"
print(my_node.comment)
To change or retrieve a node comment, use the attribute
comment
.
# Returns the list of node parameters
list_of_parameters = my_node.get_parameter_list()
print(list_of_parameters)
The method get_parameter_list()
returns the list of
node parameters.
# Returns True if the parameter exist
print(my_node.has_parameter("ParameterName"))
See has_parameter(parameter_name)
in the
documentation.
# Get the value of the parameter
print(my_node.get_parameter("offset_x"))
# Set the value of the parameter
my_node.set_parameter("offset_x", "1.0")
See get_parameter(parameter_name)
and set_parameter(parameter_name)
in the
documentation.
Copyright © 2022 · All Rights Reserved · Wysilab