The anatools Package

The anatools package provides the base set of capabilities to build a channel. It includes the software development kit (SDK), the ana interpreter, development utilities, and a set of libraries and nodes that can be included in a channel. It is required for all channels and is installed by including it in the requirements.txt file in the main channel directory.

Nodes in anatools

The nodes in the anatools package are general purpose capabilities that can be included in any channel. To include an anatools node, you add it to the “add_nodes” section of the channel file as follows:

channel:
  type: blender

add_setup:
  - testpkg.lib.setup

add_packages:
  - testpkg

add_nodes:
  - package: anatools
    name: RandomUniform
    category: Values
    subcategory: Random
    color: "#FF9933"

In the above example, the “RandomUniform” node is included in the channel. Note the category, subcategory, and color for the node are also specified. These override the default values.

Following are descriptions of each node in the anatools package

ConditionalSelector

The ConditionalSelector node combines two inputs with an operator and evaluates it as a logical expression. If the result is true then it outputs the value of its ‘True’ input. If the result is false then it outputs the value of its ‘False’ input.

Inputs

  • ConditionA - A numeric value that is the first operand of the expression.

  • Operator - A string representing the comparison operator. This can be one of three values - ‘Less Than’, ‘Equal To’, or ‘Greater Than’.

  • ConditionB - A numeric value that is the second operand of the expression

  • True - The value to be output if the expression evaluates as true.

  • False - The value to be output if the expression evaluates as false.

Outputs

  • Value - The output value

RandomChoice

Selects the specified number of choices from a list. The “List_of_Choices” is a list where each element is one of the choices. Note that if elements are strings then they must each be enclosed in double-quotes, e.g. [“choice1”, “choice2”, “choice3”].

Inputs

  • List_of_Choices - The list of choices to choose from

  • Number_of_Choices - The number of choices to make

  • Unique_Choices - Determines if every choice needs to be unique. This value is a string and can be either ‘True’ or ‘False’.

Outputs

  • Choices - The list of choices made

RandomNormal

Draw random samples from a normal (Gaussian) distribution with mean 'loc' and standard deviation 'scale'. This node calls the numpy function numpy.random.normal.

Inputs

  • loc - The mean of the distribution

  • scale - The standard deviation of the distribution

  • size - The output shape. If you are drawing a single sample then leave this empty. If you are drawing multiple samples then see the numpy documentation for details.

Outputs

  • out - The sample(s)

RandomRandint

Generate random integers from low (inclusive) to high (exclusive). This node calls the numpy function numpy.random.randint.

Note the upper bound is exclusive so if you want, for example, to generate random integers between 0 and 9 the low should be set to 0 and the high should be set to 10.

Inputs

  • low - Lower boundary of the interval (inclusive)

  • high - Upper boundary of the interval (exclusive)

  • size - The output shape. If you are drawing a single sample then leave this empty. If you are drawing multiple samples then see the numpy documentation for details.

Outputs

  • out - The sample(s)

RandomTriangular

Draw random samples from a triangular distribution over the closed interval [left, right]. This node calls the numpy function numpy.random.triangular.

Inputs

  • left - The lower limit

  • mode - The value where the peak of the distribution occurs

  • right - The upper limit

  • size - The output shape. If you are drawing a single sample then leave this empty. If you are drawing multiple samples then see the numpy documentation for details.

Outputs

  • out - The sample(s)

RandomUniform

Draw random samples from a uniform distribution over the half-open interval [low, high). This node calls the numpy function numpy.random.uniform.

Inputs

  • low - Lower boundary of the interval (inclusive)

  • high - Upper boundary of the interval (exclusive)

  • size - The output shape. If you are drawing a single sample then leave this empty. If you are drawing multiple samples then see the numpy documentation for details.

Outputs

  • out - The sample(s)

SelectGenerator

The SelectGenerator node allows the user to create a multi-branch junction in a generator tree. When evaluating the generator tree, one of the weighted input branches will be randomly selected.

Inputs

  • Generators - Links from one or more generator or modifier nodes. These are ‘downstream’ links in the generator tree.

Outputs

  • Generator - The ‘upstream’ link in the generator tree.

SetInstanceCount

Set the count property of an input generator to produce multiple instances. Note generator instance count must be implemented in the channel for this to work. Many common channels, such as the example channel, do not support generator instance count.

Inputs

  • Generator - Link from a generator node.

  • Count - The number of times to instance the input generator

Outputs

  • Generator - The generator with the instance count set

String

The String node allows the user to enter a single string and use it as input to multiple nodes

Inputs

  • String - The string to be passed to other nodes

Outputs

  • String - The string

SweepArange

Generates a value from a parameter sweep across evenly spaced values within the half-open interval [start,stop). The range of values in the interval is determined by the numpy function numpy.arange. The value drawn from this sequence is determined by taking the current run number modulo the number of values in the sequence and using that as an index into the sequence, e.g. seq[run_num % len(seq)].

For example if start is 0, stop is 10, and step is 1 then the sequence will be [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]. If the run number is 3 then the node will output a value of 3. If the run number is 11 then the output will be 1.

Inputs

  • start - Start of the interval (inclusive)

  • stop - End of the interval (exclusive)

  • step - Spacing between values

Outputs

  • value - Value drawn from the sequence.

SweepLinspace

Generates a value from a parameter sweep across evenly spaced values within the interval [start,stop]. The range of values in the interval is determined by the numpy function numpy.linspace. The value drawn from this sequence is determined by taking the current run number modulo the number of values in the sequence (num) and using that as an index into the sequence, e.g. seq[run_num % num].

For example if start is 0, stop is 9, and num is 10 then the sequence will be [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]. If the run number is 3 then the node will output a value of 3. If the run number is 11 then the output will be 1.

Inputs

  • start - Start of the interval (inclusive)

  • stop - End of the interval (inclusive)

  • num - Number of values in the sequence

Outputs

  • value - Value drawn from the sequence.

Value

The Value node allows the user to enter a single numeric value and use it as input to multiple nodes

Inputs

  • Value - The value to be passed to other nodes

Outputs

  • Value - The value

Vector2D

Creates a 2D vector with the magnitudes specified.

Inputs

  • x - The magnitude in the x direction

  • y - The magnitude in the y direction

Outputs

  • Vector - The vector represented as a 2 element list

Vector3D

Creates a 3D vector with the magnitudes specified.

Inputs

  • x - The magnitude in the x direction

  • y - The magnitude in the y direction

  • z - The magnitude in the z direction

Outputs

  • Vector - The vector represented as a 3 element list

VolumeFile

A node that represents a file on a workspace volume that was selected by the user.

Outputs

  • File - A pointer to the file on the workspace volume. This is an instance of the FileObject class.

Weight

The Weight node modifies the weight of a branch in the generator tree.

Inputs

  • Generator - Link from a generator node. This is a ‘downstream’ link in the generator tree.

  • Weight - A numeric weight to be applied to the input branch

Last updated