builder.socket

socket

Classes

Name Description
AxisAngle Axis-angle components returned by RotationSocket.to_axis_angle().
BaseSocket
BooleanSocket Runtime boolean socket wrapper.
BundleSocket Runtime bundle socket wrapper.
ClosureSocket Runtime closure socket wrapper.
CollectionSocket Runtime collection socket wrapper.
ColorSocket Runtime color socket wrapper.
FindResult Result of StringSocket.find().
FloatSocket Runtime float socket wrapper.
FontSocket Runtime font socket wrapper.
GeometrySocket Runtime geometry socket wrapper.
ImageSocket Runtime image socket wrapper.
IntegerSocket Runtime integer socket wrapper.
MaterialSocket Runtime material socket wrapper.
MatrixSocket Runtime matrix socket wrapper.
MenuSocket Runtime menu socket wrapper.
ObjectSocket Runtime object socket wrapper.
QuaternionComponents Quaternion components returned by RotationSocket.to_quaternion().
RotationSocket Runtime rotation socket wrapper.
SVDResult SVD components returned by MatrixSocket.svd().
ShaderSocket Runtime shader socket wrapper.
Socket Wraps a single Blender NodeSocket, providing operator overloads and linking.
StringSocket Runtime string socket wrapper.
VectorSocket Runtime vector socket wrapper.

AxisAngle

AxisAngle()

Axis-angle components returned by RotationSocket.to_axis_angle().

Attributes

Name Description
angle
axis

BaseSocket

BaseSocket(socket)

Attributes

Name Description
links
name
node
socket
tree
type

BooleanSocket

BooleanSocket(socket)

Runtime boolean socket wrapper.

Attributes

Name Description
builder_node The builder node that owns this socket, if accessed via .o/.i.
corner
default_value
edge
face
i
instance
layer
links
name
node
o
point
socket
spline
switch Creat a Switch node with this boolean as the switch input.
tree
type

BundleSocket

BundleSocket(socket)

Runtime bundle socket wrapper.

Attributes

Name Description
builder_node The builder node that owns this socket, if accessed via .o/.i.
i
links
name
node
o
socket
tree
type

ClosureSocket

ClosureSocket(socket)

Runtime closure socket wrapper.

Attributes

Name Description
builder_node The builder node that owns this socket, if accessed via .o/.i.
i
links
name
node
o
socket
tree
type

CollectionSocket

CollectionSocket(socket)

Runtime collection socket wrapper.

Attributes

Name Description
builder_node The builder node that owns this socket, if accessed via .o/.i.
default_value
i
links
name
node
o
socket
tree
type

Methods

Name Description
instances Import objects from the collection as instances.
instances
instances(
    transform_space='ORIGINAL',
    separate_children=False,
    reset_children=False,
)

Import objects from the collection as instances.

Parameters
Name Type Description Default
transform_space Literal['ORIGINAL', 'RELATIVE'] The transform space to use for the instances. 'ORIGINAL'
separate_children bool Whether to separate objects as their own instances. False
reset_children bool Whether to reset children of the collection to world origin. False
Returns
Name Type Description
GeometrySocket The output ‘Instances’ GeometrySocket. Will be a single instance or multiple instances if separate_children is True.

ColorSocket

ColorSocket(socket)

Runtime color socket wrapper.

Attributes

Name Description
a
b
builder_node The builder node that owns this socket, if accessed via .o/.i.
default_value
g
i
links
name
node
o
r
socket
tree
type

FindResult

FindResult()

Result of StringSocket.find().

Attributes

Name Description
count
first_found

FloatSocket

FloatSocket(socket)

Runtime float socket wrapper.

Attributes

Name Description
builder_node The builder node that owns this socket, if accessed via .o/.i.
corner
default_value
edge
face
i
instance
layer
links
mix Create a Mix node using this socket as the factor.
name
node
o
point
socket
spline
tree
type

Methods

Name Description
ceil Round up to the nearest integer.
clamp Clamp the value to [min, max]. Defaults to the unit interval [0, 1].
floor Round down to the nearest integer.
map_range Remap the values on the float socket using the MapRange node.
modulo Floored modulo — remainder after dividing by divisor, always non-negative.
negate Negate the FloatSocket by multiplying the value by -1.
power Raise this value to exponent.
round Round to the nearest integer.
sign Return the sign of the FloatSocket, eithe -1, 0 or 1.
sqrt Return the square root of this value.
to_degrees Convert radians to degrees.
to_integer Convert the FloatSocket to an IntegerSocket by truncating the decimal part.
to_radians Convert degrees to radians.
to_string Convert the FloatSocket to a StringSocket wtih the given number of decimal places
wrap Wrap the value into the [min, max] range, repeating cyclically.
ceil
ceil()

Round up to the nearest integer.

clamp
clamp(min=0.0, max=1.0)

Clamp the value to [min, max]. Defaults to the unit interval [0, 1].

floor
floor()

Round down to the nearest integer.

map_range
map_range(
    from_min=0.0,
    from_max=1.0,
    to_min=0.0,
    to_max=1.0,
    *,
    clamp=True,
    interpolation_type='LINEAR',
    steps=4.0,
)

Remap the values on the float socket using the MapRange node.

modulo
modulo(divisor)

Floored modulo — remainder after dividing by divisor, always non-negative.

negate
negate()

Negate the FloatSocket by multiplying the value by -1.

power
power(exponent)

Raise this value to exponent.

round
round()

Round to the nearest integer.

sign
sign()

Return the sign of the FloatSocket, eithe -1, 0 or 1.

sqrt
sqrt()

Return the square root of this value.

to_degrees
to_degrees()

Convert radians to degrees.

to_integer
to_integer(rounding_mode='ROUND')

Convert the FloatSocket to an IntegerSocket by truncating the decimal part.

to_radians
to_radians()

Convert degrees to radians.

to_string
to_string(decimals=0)

Convert the FloatSocket to a StringSocket wtih the given number of decimal places

wrap
wrap(min, max)

Wrap the value into the [min, max] range, repeating cyclically.

FontSocket

FontSocket(socket)

Runtime font socket wrapper.

Attributes

Name Description
builder_node The builder node that owns this socket, if accessed via .o/.i.
i
links
name
node
o
socket
tree
type

GeometrySocket

GeometrySocket(socket)

Runtime geometry socket wrapper.

Attributes

Name Description
builder_node The builder node that owns this socket, if accessed via .o/.i.
i
links
name
node
o
socket
tree
type

Methods

Name Description
realize_instances
realize_instances
realize_instances(selection=True, realize_all=False, depth=0)

ImageSocket

ImageSocket(socket)

Runtime image socket wrapper.

Attributes

Name Description
builder_node The builder node that owns this socket, if accessed via .o/.i.
default_value
i
links
name
node
o
socket
tree
type

IntegerSocket

IntegerSocket(socket)

Runtime integer socket wrapper.

Attributes

Name Description
builder_node The builder node that owns this socket, if accessed via .o/.i.
corner
default_value
edge
face
i
instance
layer
links
name
node
o
point
socket
spline
tree
type

Methods

Name Description
clamp Clamp the value to [min, max].
modulo Remainder after dividing by divisor (always non-negative).
negate
sign Return the sign of the IntegerSocket, either -1, 0, or 1.
to_string Convert the IntegerSocket to a StringSocket.
clamp
clamp(min=0, max=1)

Clamp the value to [min, max].

modulo
modulo(divisor)

Remainder after dividing by divisor (always non-negative).

negate
negate()
sign
sign()

Return the sign of the IntegerSocket, either -1, 0, or 1.

to_string
to_string()

Convert the IntegerSocket to a StringSocket.

MaterialSocket

MaterialSocket(socket)

Runtime material socket wrapper.

Attributes

Name Description
builder_node The builder node that owns this socket, if accessed via .o/.i.
default_value
i
links
name
node
o
socket
tree
type

MatrixSocket

MatrixSocket(socket)

Runtime matrix socket wrapper.

Attributes

Name Description
builder_node The builder node that owns this socket, if accessed via .o/.i.
corner
edge
face
i
instance
layer
links
name
node
o
point
rotation
scale
socket
spline
translation
tree
type

Methods

Name Description
determinant Compute the determinant of a matrix input and return as a FloatSocket
invert Invert the MatrixSocet and return a MatrixSocket
svd Decompose the matrix via SVD. Returns (u, s, v).
transform_direction Apply this matrix to direction, ignoring translation.
transpose Transpose the MatrixSocket and return a MatrixSocket
determinant
determinant()

Compute the determinant of a matrix input and return as a FloatSocket

invert
invert()

Invert the MatrixSocet and return a MatrixSocket

svd
svd()

Decompose the matrix via SVD. Returns (u, s, v).

transform_direction
transform_direction(direction)

Apply this matrix to direction, ignoring translation.

Use this instead of transform() when transforming a direction vector (e.g. a normal) where translation must not affect the result.

transpose
transpose()

Transpose the MatrixSocket and return a MatrixSocket

MenuSocket

MenuSocket(socket)

Runtime menu socket wrapper.

Attributes

Name Description
builder_node The builder node that owns this socket, if accessed via .o/.i.
default_value
i
links
name
node
o
socket
tree
type

ObjectSocket

ObjectSocket(socket)

Runtime object socket wrapper.

Attributes

Name Description
builder_node The builder node that owns this socket, if accessed via .o/.i.
default_value
i
links
name
node
o
socket
tree
type

Methods

Name Description
geometry The object’s geometry, optionally in relative space, via ObjectInfo.
location The object’s location, optionally in relative space, via ObjectInfo.
rotation The object’s rotation, optionally in relative space, via ObjectInfo.
scale The object’s scale, optionally in relative space, via ObjectInfo.
transform The Object’s transform matrix, optionally in relative space.
geometry
geometry(transform_space='ORIGINAL', as_instance=False)

The object’s geometry, optionally in relative space, via ObjectInfo.

Parameters
Name Type Description Default
transform_space Literal['ORIGINAL', 'RELATIVE'] The space in which to return the geometry. 'ORIGINAL'
as_instance InputBoolean Whether to return the geometry as an instance. False
Returns
Name Type Description
GeometrySocket The output ‘Geometry’ GeometrySocket.
location
location(transform_space='ORIGINAL')

The object’s location, optionally in relative space, via ObjectInfo.

Parameters
Name Type Description Default
transform_space Literal['ORIGINAL', 'RELATIVE'] The space in which to return the location. 'ORIGINAL'
Returns
Name Type Description
VectorSocket The output ‘Location’ VectorSocket.
rotation
rotation(transform_space='ORIGINAL')

The object’s rotation, optionally in relative space, via ObjectInfo.

Parameters
Name Type Description Default
transform_space Literal['ORIGINAL', 'RELATIVE'] The space in which to return the rotation. 'ORIGINAL'
Returns
Name Type Description
RotationSocket The output ‘Rotation’ RotationSocket.
scale
scale(transform_space='ORIGINAL')

The object’s scale, optionally in relative space, via ObjectInfo.

Parameters
Name Type Description Default
transform_space Literal['ORIGINAL', 'RELATIVE'] The space in which to return the scale. 'ORIGINAL'
Returns
Name Type Description
VectorSocket The output ‘Scale’ VectorSocket.
transform
transform(transform_space='ORIGINAL')

The Object’s transform matrix, optionally in relative space.

Adds ObjectInfo to the node tree and returns.

Parameters
Name Type Description Default
transform_space Literal['ORIGINAL', 'RELATIVE'] The space in which to return the transform matrix. 'ORIGINAL'
Returns
Name Type Description
MatrixSocket The output ‘Transform’ MatrixSocket.

QuaternionComponents

QuaternionComponents()

Quaternion components returned by RotationSocket.to_quaternion().

Attributes

Name Description
w
x
y
z

RotationSocket

RotationSocket(socket)

Runtime rotation socket wrapper.

Attributes

Name Description
builder_node The builder node that owns this socket, if accessed via .o/.i.
corner
default_value
edge
face
i
instance
layer
links
name
node
o
point
socket
spline
tree
type

Methods

Name Description
invert Invert the rotation of the socket.
rotate Rotate this rotation by the given rotation in the specified rotation space.
to_axis_angle Decompose the rotation into axis-angle components (axis, angle).
to_euler Convert the rotation to an XYZ euler rotation and return VectorSocket.
to_quaternion Decompose the rotation into quaternion components (w, x, y, z).
invert
invert()

Invert the rotation of the socket.

rotate
rotate(rotation, rotation_space='GLOBAL')

Rotate this rotation by the given rotation in the specified rotation space.

to_axis_angle
to_axis_angle()

Decompose the rotation into axis-angle components (axis, angle).

to_euler
to_euler()

Convert the rotation to an XYZ euler rotation and return VectorSocket.

to_quaternion
to_quaternion()

Decompose the rotation into quaternion components (w, x, y, z).

SVDResult

SVDResult()

SVD components returned by MatrixSocket.svd().

Attributes

Name Description
s
u
v

ShaderSocket

ShaderSocket(socket)

Runtime shader socket wrapper.

Attributes

Name Description
builder_node The builder node that owns this socket, if accessed via .o/.i.
i
links
name
node
o
socket
tree
type

Socket

Socket(socket)

Wraps a single Blender NodeSocket, providing operator overloads and linking.

Returned by SocketAccessor.get() / node.inputs[...] / node.outputs[...]. Type-specific subclasses (VectorSocket, ColorSocket, IntegerSocket) are selected automatically via the registry.

Properties:

tree : TreeBuilder The tree this socket belongs to. socket : NodeSocket The underlying Blender NodeSocket.

Attributes

Name Description
builder_node The builder node that owns this socket, if accessed via .o/.i.
i
links
name
node
o
socket
tree
type

StringSocket

StringSocket(socket)

Runtime string socket wrapper.

Attributes

Name Description
builder_node The builder node that owns this socket, if accessed via .o/.i.
default_value
i
links
name
node
o
socket
tree
type

Methods

Name Description
contains Create a MatchStringContains, return the result as a BooleanSocket.
ends_with Create a MatchString[Ends With], return the result as a BooleanSocket.
find Find where in a string a pattern occurs. Returns (first_found, count).
format Format a given string with the key-value items.
join Join the input strings with this as the separator.
length Compute the length of a string and return as IntegerSocket.
replace Replace every match of the string with teh replacement string
slice Slice a given string from a starting position for a given length.
starts_with Create a MatchString[Starts With], return the result as a BooleanSocket.
contains
contains(search)

Create a MatchStringContains, return the result as a BooleanSocket.

ends_with
ends_with(search)

Create a MatchString[Ends With], return the result as a BooleanSocket.

find
find(search)

Find where in a string a pattern occurs. Returns (first_found, count).

format
format(items)

Format a given string with the key-value items.

join
join(strings)

Join the input strings with this as the separator.

length
length()

Compute the length of a string and return as IntegerSocket.

replace
replace(find, replace)

Replace every match of the string with teh replacement string

slice
slice(position=0, length=0)

Slice a given string from a starting position for a given length.

starts_with
starts_with(search)

Create a MatchString[Starts With], return the result as a BooleanSocket.

VectorSocket

VectorSocket(socket)

Runtime vector socket wrapper.

Attributes

Name Description
builder_node The builder node that owns this socket, if accessed via .o/.i.
corner
default_value
edge
face
i
instance
layer
links
name
node
o
point
socket
spline
tree
type
x
y
z

Methods

Name Description
cross Cross product of this vector with other. Returns a vector perpendicular to both.
distance Euclidean distance between this vector and other.
dot Dot product with another vector. The other vector can be a Socket, a NodeSocket, or a 3-tuple of floats.
length
map_range Convenience method to remap a vector socket using the MapRange.vector() node with this socket as input
normalize Normalize this vector. Only valid for output sockets, as it creates a Normalize node linked from this socket.
project Project this vector onto other.
reflect Reflect this vector around normal. normal does not need to be normalised.
rotate Rotate this vector by the given rotation.
scale Scale this vector by a scalar value and return VectorSocket
transform Transform this vector by the given matrix.
cross
cross(other)

Cross product of this vector with other. Returns a vector perpendicular to both.

distance
distance(other)

Euclidean distance between this vector and other.

dot
dot(vector)

Dot product with another vector. The other vector can be a Socket, a NodeSocket, or a 3-tuple of floats.

A different VectorMath node is created each time.

length
length()
map_range
map_range(
    from_min=(0.0, 0.0, 0.0),
    from_max=(1.0, 1.0, 1.0),
    to_min=(0.0, 0.0, 0.0),
    to_max=(1.0, 1.0, 1.0),
    *,
    clamp=True,
    interpolation_type='LINEAR',
    steps=(4.0, 4.0, 4.0),
)

Convenience method to remap a vector socket using the MapRange.vector() node with this socket as input

normalize
normalize()

Normalize this vector. Only valid for output sockets, as it creates a Normalize node linked from this socket.

The same normalize node is re-used each time unless new_node=True where a new VectorMath node is created each time.

project
project(other)

Project this vector onto other.

reflect
reflect(normal)

Reflect this vector around normal. normal does not need to be normalised.

rotate
rotate(rotation)

Rotate this vector by the given rotation.

scale
scale(scale)

Scale this vector by a scalar value and return VectorSocket

transform
transform(matrix)

Transform this vector by the given matrix.