Class Frame#

Node Frame

Args:#

  • label: The frame label

  • label_size: The font size for the label

  • color: A valid color spec

  • shrink: Shrink the Frame

Note that Frame is the internal name for Layouts

Blender reference : NodeFrame

Constructor#

Frame(self, label

Content#

Properties

bl_idname | chain_label | fed_nodes | input_geometry_bsocket | label | node_color

Class and static methods

Boolean | Collection | Color | Curve | Curves | DataClass | Float | Geometry | Image | Instances | Integer | Material | Mesh | Object | Points | String | Texture | Vector | Volume | unitize

Methods

as_attribute | attribute_is_solved | connected_geometries | get_datasocket | get_label | get_output_socket | plug | plug_node | plugged | switch_input_sockets

Properties#

bl_idname#

Shortcut for self.bnode.bl_idname

Go to top - main - nodes - nodes menus

chain_label#

Label to use when building chain labels

Go to top - main - nodes - nodes menus

fed_nodes#

List of the node with input sockets connected with this socket

Go to top - main - nodes - nodes menus

input_geometry_bsocket#

The input geometry blender socket

Go to top - main - nodes - nodes menus

label#

Node label

Go to top - main - nodes - nodes menus

node_color#

Noe color

Go to top - main - nodes - nodes menus

Class and static methods#

Boolean#

@staticmethod
def Boolean(socket)

Initialize a Boolean with a DataSocket

Go to top - main - nodes - nodes menus

Collection#

@staticmethod
def Collection(socket)

Initialize a Collection with a DataSocket

Go to top - main - nodes - nodes menus

Color#

@staticmethod
def Color(socket)

Initialize a Color with a DataSocket

Go to top - main - nodes - nodes menus

Curve#

@staticmethod
def Curve(socket)

Initialize a Curve with a DataSocket

Go to top - main - nodes - nodes menus

Curves#

@staticmethod
def Curves(socket)

Initialize a Curves with a DataSocket

Go to top - main - nodes - nodes menus

DataClass#

@staticmethod
def DataClass(socket)

Initialize a DataClass of the property class from from the bl_idname of the socket

Go to top - main - nodes - nodes menus

Float#

@staticmethod
def Float(socket)

Initialize a Float with a DataSocket

Go to top - main - nodes - nodes menus

Geometry#

@staticmethod
def Geometry(socket)

Initialize a Geometry with a DataSocket

Go to top - main - nodes - nodes menus

Image#

@staticmethod
def Image(socket)

Initialize a Image with a DataSocket

Go to top - main - nodes - nodes menus

Instances#

@staticmethod
def Instances(socket)

Initialize a Instances with a DataSocket

Go to top - main - nodes - nodes menus

Integer#

@staticmethod
def Integer(socket)

Initialize a Integer with a DataSocket

Go to top - main - nodes - nodes menus

Material#

@staticmethod
def Material(socket)

Initialize a Material with a DataSocket

Go to top - main - nodes - nodes menus

Mesh#

@staticmethod
def Mesh(socket)

Initialize a Mesh with a DataSocket

Go to top - main - nodes - nodes menus

Object#

@staticmethod
def Object(socket)

Initialize a Object with a DataSocket

Go to top - main - nodes - nodes menus

Points#

@staticmethod
def Points(socket)

Initialize a Points with a DataSocket

Go to top - main - nodes - nodes menus

String#

@staticmethod
def String(socket)

Initialize a String with a DataSocket

Go to top - main - nodes - nodes menus

Texture#

@staticmethod
def Texture(socket)

Initialize a Texture with a DataSocket

Go to top - main - nodes - nodes menus

Vector#

@staticmethod
def Vector(socket)

Initialize a Vector with a DataSocket

Go to top - main - nodes - nodes menus

Volume#

@staticmethod
def Volume(socket)

Initialize a Volume with a DataSocket

Go to top - main - nodes - nodes menus

unitize#

@staticmethod
def unitize(names)

Utility to build unique names from a list with homonyms

:param names: The list of names to unitize :type names: list of strs :return: list with the same number of names where homonyms are suffixed by their rank :rtype: list of strs

Go to top - main - nodes - nodes menus

Methods#

as_attribute#

def as_attribute(self, owning_socket, domain='POINT')

Indicates that the node is an attribute.

:param owning_socket: The owning socket it is an atribute of :param domain: The domain if ‘Capture Attribute’ is necessary :type owning_socket: DataSocket :type domain: str

Set the property :attr:is_atribute to True to indicate that the socket is the attribute of a Geometry. The domain is stored in the property domain

see :func:Tree.check_attributes

Go to top - main - nodes - nodes menus

attribute_is_solved#

def attribute_is_solved(self)

Check if the attribute is already solved.

No need to insert a Capture Attribute Node when the socket is already connected to nodes Capture Attribute or Transfer Attribute.

see :func:Tree.check_attributes

Go to top - main - nodes - nodes menus

connected_geometries#

def connected_geometries(self)

List of the connected geometries

Explore the fowards links until finding a node with an input geometry. The resulting list will allow to determine if a ‘Capture Attribute’ is necessary.

Go to top - main - nodes - nodes menus

get_datasocket#

def get_datasocket(self, index)

Get the data socket by its index.

param index:

Index of the output socket to get

type index:

int

return:

The data socket at the given socket

rtype:

DataSocket

Note

The index is the user index. It can differ from the geometry node index of the socket when several sockets share the same name. For instance the node Random value has several output sockets named Value. Only one is enabled at the same time. All these sockets share the same index, which is 0. The socket returned by get_datasocket is the one which is enabled.

import geonodes as gn

with gn.Tree("Geometry Nodes") as tree:

    # Node 'Random Value' initialized for FLOAT

    v = gn.Float.Random()

    # Let's explore the node

    random_node = v.node

    # The actual output sockets of the geometry node
    # Note that we loop on bnode which is the wrapped node

    print("Actual sockets:")
    for i, bsocket in enumerate(random_node.bnode.outputs):
        print(i, bsocket.name, bsocket.enabled)
    print()

    # All the socket share the same name and user index
    # The one whih is return is the enabled one

    print("User sockets:")
    for key in random_node.outsockets:
        socket = getattr(v.node, key)
        print(key, socket.socket_index, socket.bl_idname)
Actual sockets:
0 Value False
1 Value True
2 Value False
3 Value False

User sockets:
value 1 NodeSocketFloat

Go to top - main - nodes - nodes menus

get_label#

def get_label(self)

Build the node label

If the label provided at initialization time is None, the node is labeled by concatening its unique id with its standard name.

Go to top - main - nodes - nodes menus

get_output_socket#

def get_output_socket(self, name)

ock_ind = self.outsockets.get(name.lower())

Go to top - main - nodes - nodes menus

plug#

def plug(self, index, *values)

Plug the values to the input socket whose index is provided.

param index:

The index of the input sockets (a valid index for Node.inputs)

param values:

Each value can be an acceptable default value for the socket or an output socket

type index:

int

type values:

list of values

Since an input socket can be multi input, the values argument is a list.

If the socket is multi input, the plug method is called once per provide value. If a value is None, nothing happens.

A not None value can be:

  • either a valid valud for the socket (eg: 123 for Integer socket)

  • or an output socket of another Node

When it is a socket, it can be a Blender socket or a DataSocket

—– Index can be a string

Go to top - main - nodes - nodes menus

plug_node#

def plug_node(self, node)

Plug all the sockets of a node.

param node:

The node whose output sockets will be plugged

type node:

Node

Plug the output sockets of node whose name match an input socket of self.

Go to top - main - nodes - nodes menus

plugged#

def plugged(self, index)

The liste of plugged sockets

param index:

the index of the socket to consider

type index:

int

return:

The list of connected sockets

rtype:

list of DataSockets

Go to top - main - nodes - nodes menus

switch_input_sockets#

def switch_input_sockets(self, index0, index1)

Utility method which switchs the links of two sockets.

param index0:

The first index

param index1:

The second index

type index0:

int

typ index1:

int

Used when implementing operators rxxx_

Go to top - main - nodes - nodes menus