Class Instance#
main - nodes - nodes menus
Domain is the root class for:
Vertex, node domain ‘POINT’
Edge, node domain ‘EDGE’
Face, node domain ‘FACE’
Corner, node domain ‘CORNER’
ControlPoint, node domain ‘POINT’
Spline, node domain *’SPLINE’ (or ‘CURVE’)
CloudPoint, node domain ‘POINT’
Instance, node domain ‘INSTANCE’
Domain provides mechanism to keep the context, by maintaining:
the
selection
the node domain value in ‘POINT’, ‘EDGE’, ‘FACE’, ‘CORNER’, ‘SPLINE’, ‘INSTANCE’
the geometry it is a domain of
By keeping the context geometry, it is not necessary to explicitly create Capture Attribute. Domain class determines if it is necessary or not to create this node.
Domains are not initialized directly but by geometries:
Mesh initializes 4 domains:
Curve initializes 2 domains:
points
property of type ControlPointsplines
property of type Spline
Instances initializes 1 domain:
insts
property of type Instance
Points initializes 1 domain:
points
property of type CloudPoint
Note that the node domain ‘POINT’ is used by 3 Domains.
Selection mechanism#
One important feature of Domain is the selection mechanism. The selection is expressed using the array syntax:
mesh.verts[1]
: select theindex == 1
mesh.faces[10:20]
: select theindex
in the range 10 to 20 (exc)mesh.faces[8, 17]
: select theindex
equal to 8 or 17mesh.edges[(mesh.edges.index % 2).equal(0)]
: select the evenindex
Nodes having a Selection socket use the Domain selection initialized with this syntax.
In the following example, two vertices selected by the user are move upwards:
import geonodes as gn
with gn.Tree("Test") as tree:
index1 = gn.Integer.Input(0, "Index 1")
index2 = gn.Integer.Input(1, "Index 2")
cube = gn.Mesh.Cube()
cube.verts[index1, index2].position += (0, 0, .2)
tree.og = cube
Constructor#
Instance(self, data_socket, selection=None)
Args:#
data_socket (DataSocket): the data class the domain belongs to
selection (any): the selection to use
Content#
Properties
ID | as_cloud_points | as_control_points | as_corners | as_edges | as_faces | as_insts | as_splines | as_verts | count | data_socket | domain | domain_index | index | normal | position | rotation | scale | selection | selection_index
Class and static methods
random_boolean | random_float | random_integer | random_vector
Methods
accumulate_field | attribute_max | attribute_mean | attribute_median | attribute_min | attribute_node | attribute_range | attribute_statistic | attribute_std | attribute_sum | attribute_var | capture_attribute | delete | duplicate | field_at_index | index_for_sample | interpolate | material_selection | named_attribute | named_boolean | named_color | named_float | named_integer | named_vector | remove_named_attribute | rotate | sample_index | select | separate | set_ID | set_position | set_scale | socket_stack | store_named_attribute | store_named_attribute_no_selection | store_named_boolean | store_named_color | store_named_float | store_named_integer | store_named_vector | to_points | translate | view | viewer
Properties#
ID#
Node: ID | Blender reference | api reference
Returns:#
socket
ID
Setter
Node: Set ID | Blender reference | api reference
Node implemented as property setter.
Args:#
attr_value: ID
Go to top - main - nodes - nodes menus
as_cloud_points#
Type cast to CloudPoint.
Go to top - main - nodes - nodes menus
as_control_points#
Type cast to ControlPoint.
Go to top - main - nodes - nodes menus
as_corners#
Type cast to Corner.
Go to top - main - nodes - nodes menus
as_edges#
Type cast to Edge.
Go to top - main - nodes - nodes menus
as_faces#
Type cast to Face.
Go to top - main - nodes - nodes menus
as_insts#
Type cast to Instance.
Go to top - main - nodes - nodes menus
as_splines#
Type cast to Spline.
Go to top - main - nodes - nodes menus
as_verts#
Type cast to Vertex.
Go to top - main - nodes - nodes menus
count#
Node: Domain Size | Blender reference | api reference
Returns:#
socket
instance_count
Go to top - main - nodes - nodes menus
data_socket#
Returns the data socket it belongs to.
Returns:#
DataSocket
Go to top - main - nodes - nodes menus
domain#
Gives the Geometry Nodes domain string to use in the generated nodes.
Vertex : ‘POINT’,
Edge : ‘EDGE’,
Face : ‘FACE’,
Corner : ‘CORNER’,
ControlPoint : ‘POINT’,
Spline : ‘CURVE’,
CloudPoint : ‘POINT’,
Instance : ‘INSTANCE’,
Returns:#
domain string (str)
Go to top - main - nodes - nodes menus
domain_index#
Node: Index | Blender reference | api reference
Returns:#
socket
index
Go to top - main - nodes - nodes menus
index#
Node: Index | Blender reference | api reference
Returns:#
socket
index
Go to top - main - nodes - nodes menus
normal#
Node: Normal | Blender reference | api reference
Returns:#
socket
normal
Go to top - main - nodes - nodes menus
position#
Node: Position | Blender reference | api reference
Returns:#
socket
position
Setter
Node: Set Position | Blender reference | api reference
Node implemented as property setter.
Args:#
attr_value: position
Go to top - main - nodes - nodes menus
rotation#
Node: Instance Rotation | Blender reference | api reference
Returns:#
socket
rotation
Go to top - main - nodes - nodes menus
scale#
Node: Instance Scale | Blender reference | api reference
Returns:#
socket
scale
Go to top - main - nodes - nodes menus
selection#
Returns the selection value to use in nodes with a Selection socket.
Returns:#
Boolean
Go to top - main - nodes - nodes menus
selection_index#
Returns the selection index.
CAUTION: raise an error if the selection is not a integer.
Returns:#
Integer
Go to top - main - nodes - nodes menus
Class and static methods#
random_boolean#
@staticmethod
def random_boolean(probability=None, ID=None, seed=None)
Node: Random Value | Blender reference | api reference
Args:#
probability: Float
ID: Integer
seed: Integer
Returns:#
socket
value
Go to top - main - nodes - nodes menus
random_float#
@staticmethod
def random_float(min=None, max=None, ID=None, seed=None)
Node: Random Value | Blender reference | api reference
Args:#
min: [‘Vector’, ‘Float’, ‘Integer’]
max: [‘Vector’, ‘Float’, ‘Integer’]
ID: Integer
seed: Integer
Returns:#
socket
value
Go to top - main - nodes - nodes menus
random_integer#
@staticmethod
def random_integer(min=None, max=None, ID=None, seed=None)
Node: Random Value | Blender reference | api reference
Args:#
min: [‘Vector’, ‘Float’, ‘Integer’]
max: [‘Vector’, ‘Float’, ‘Integer’]
ID: Integer
seed: Integer
Returns:#
socket
value
Go to top - main - nodes - nodes menus
random_vector#
@staticmethod
def random_vector(min=None, max=None, ID=None, seed=None)
Node: Random Value | Blender reference | api reference
Args:#
min: [‘Vector’, ‘Float’, ‘Integer’]
max: [‘Vector’, ‘Float’, ‘Integer’]
ID: Integer
seed: Integer
Returns:#
socket
value
Go to top - main - nodes - nodes menus
Methods#
accumulate_field#
def accumulate_field(self, value=None, group_index=None)
Node: Accumulate Field | Blender reference | api reference
Args:#
value: [‘Vector’, ‘Float’, ‘Integer’]
group_index: Integer
Returns:#
tuple (’
leading
’, ‘trailing
’, ‘total
’)
Go to top - main - nodes - nodes menus
attribute_max#
def attribute_max(self, attribute=None)
Args:#
attribute: [‘Float’, ‘Vector’]
Returns:#
socket
max
Go to top - main - nodes - nodes menus
attribute_mean#
def attribute_mean(self, attribute=None)
Args:#
attribute: [‘Float’, ‘Vector’]
Returns:#
socket
mean
Go to top - main - nodes - nodes menus
attribute_median#
def attribute_median(self, attribute=None)
Args:#
attribute: [‘Float’, ‘Vector’]
Returns:#
socket
median
Go to top - main - nodes - nodes menus
attribute_min#
def attribute_min(self, attribute=None)
Args:#
attribute: [‘Float’, ‘Vector’]
Returns:#
socket
min
Go to top - main - nodes - nodes menus
attribute_node#
def attribute_node(self, node)
Define an input node as attribute
Called when creating an input node in a property getter. Performs two actions:
- Call the method :func:`Node.as_attribute` to tag the node as being an attribute.
This will allow the :func:`Tree.check_attributes` to see if it is necessary to create
a *Capture Attribute* for this field.
- Set the nde property :attr:`field_of` to self in order to implement the transfer attribute
mechanism.
Args:#
node (Node): The node created by the domain
Returns:#
The node argument
Go to top - main - nodes - nodes menus
attribute_range#
def attribute_range(self, attribute=None)
Args:#
attribute: [‘Float’, ‘Vector’]
Returns:#
socket
range
Go to top - main - nodes - nodes menus
attribute_statistic#
def attribute_statistic(self, attribute=None)
Args:#
attribute: [‘Float’, ‘Vector’]
Returns:#
node with sockets [‘mean’, ‘median’, ‘sum’, ‘min’, ‘max’, ‘range’, ‘standard_deviation’, ‘variance’]
Go to top - main - nodes - nodes menus
attribute_std#
def attribute_std(self, attribute=None)
Args:#
attribute: [‘Float’, ‘Vector’]
Returns:#
socket
standard_deviation
Go to top - main - nodes - nodes menus
attribute_sum#
def attribute_sum(self, attribute=None)
Args:#
attribute: [‘Float’, ‘Vector’]
Returns:#
socket
sum
Go to top - main - nodes - nodes menus
attribute_var#
def attribute_var(self, attribute=None)
Args:#
attribute: [‘Float’, ‘Vector’]
Returns:#
socket
variance
Go to top - main - nodes - nodes menus
capture_attribute#
def capture_attribute(self, value=None)
Node: Capture Attribute | Blender reference | api reference
Args:#
value: [‘Vector’, ‘Float’, ‘Color’, ‘Boolean’, ‘Integer’]
Returns:#
socket
attribute
Go to top - main - nodes - nodes menus
delete#
def delete(self, mode='ALL')
Node: Delete Geometry | Blender reference | api reference
Args:#
mode (str): ‘ALL’ in [ALL, EDGE_FACE, ONLY_FACE]
Returns:#
self
Go to top - main - nodes - nodes menus
duplicate#
def duplicate(self, amount=None)
Node: Duplicate Elements | Blender reference | api reference
Args:#
amount: Integer
Returns:#
socket
duplicate_index
Go to top - main - nodes - nodes menus
field_at_index#
def field_at_index(self, index=None, value=None)
Node: Field at Index | Blender reference | api reference
Args:#
index: Integer
value: [‘Float’, ‘Integer’, ‘Vector’, ‘Color’, ‘Boolean’]
Returns:#
socket
value
Go to top - main - nodes - nodes menus
index_for_sample#
def index_for_sample(self, default=None)
Return default if not None or Input index socket.
The node ‘Sample Index’ has an input with default value to 0. If mehod argument is None, create a node ‘Input Index’ as input.
sample_index method is implemented:
def sample_index(self, value=None, index=None, clamp=False):
return nodes.SampleIndex(..., index=self.index_for_sample(index), ...)
Returns:#
default or Input index
Go to top - main - nodes - nodes menus
interpolate#
def interpolate(self, value=None)
Node: Interpolate Domain | Blender reference | api reference
Args:#
value: [‘Float’, ‘Integer’, ‘Vector’, ‘Color’, ‘Boolean’]
Returns:#
socket
value
Go to top - main - nodes - nodes menus
material_selection#
def material_selection(self, material=None)
Node: Material Selection | Blender reference | api reference
Args:#
material: Material
Returns:#
socket
selection
Go to top - main - nodes - nodes menus
named_attribute#
def named_attribute(self, name=None, data_type='FLOAT')
Node: Named Attribute | Blender reference | api reference
Args:#
name: String
data_type (str): ‘FLOAT’ in [FLOAT, INT, FLOAT_VECTOR, FLOAT_COLOR, BOOLEAN]
Returns:#
socket
attribute
Go to top - main - nodes - nodes menus
named_boolean#
def named_boolean(self, name=None)
Node: Named Attribute | Blender reference | api reference
Args:#
name: String
Returns:#
socket
attribute
Go to top - main - nodes - nodes menus
named_color#
def named_color(self, name=None)
Node: Named Attribute | Blender reference | api reference
Args:#
name: String
Returns:#
socket
attribute
Go to top - main - nodes - nodes menus
named_float#
def named_float(self, name=None)
Node: Named Attribute | Blender reference | api reference
Args:#
name: String
Returns:#
socket
attribute
Go to top - main - nodes - nodes menus
named_integer#
def named_integer(self, name=None)
Node: Named Attribute | Blender reference | api reference
Args:#
name: String
Returns:#
socket
attribute
Go to top - main - nodes - nodes menus
named_vector#
def named_vector(self, name=None)
Node: Named Attribute | Blender reference | api reference
Args:#
name: String
Returns:#
socket
attribute
Go to top - main - nodes - nodes menus
remove_named_attribute#
def remove_named_attribute(self, name=None)
Args:#
name: String
Returns:#
self
Go to top - main - nodes - nodes menus
rotate#
def rotate(self, rotation=None, pivot_point=None, local_space=None)
Node: Rotate Instances | Blender reference | api reference
Args:#
rotation: Vector
pivot_point: Vector
local_space: Boolean
Returns:#
self
Go to top - main - nodes - nodes menus
sample_index#
def sample_index(self, value=None, index=None, clamp=False)
Node: Sample Index | Blender reference | api reference
Args:#
value: [‘Float’, ‘Integer’, ‘Vector’, ‘Color’, ‘Boolean’]
index: Integer
clamp (bool): False
Returns:#
socket
value
Go to top - main - nodes - nodes menus
select#
def select(self, selection)
Select the domain
If the method is called on a Domain which already has a selection, the two selections are combined:
verts = mesh.verts[10:20] # Selection of vertices from 10 to 20
v = verts.select((verts.index % 2).equal(0)) # Even indices in the previous selection
Args:#
selection (Boolean or Integer): The selection condition
Returns:#
Domain with the given selection (Domain)
If a selection is existing, the resulting selection is a logical and betwenn the two
Go to top - main - nodes - nodes menus
separate#
def separate(self)
Node: Separate Geometry | Blender reference | api reference
Returns:#
tuple (’
selection
’, ‘inverted
’)
Go to top - main - nodes - nodes menus
set_ID#
def set_ID(self, ID=None)
Node: Set ID | Blender reference | api reference
Args:#
ID: Integer
Returns:#
self
Go to top - main - nodes - nodes menus
set_position#
def set_position(self, position=None, offset=None)
Node: Set Position | Blender reference | api reference
Args:#
position: Vector
offset: Vector
Returns:#
self
Go to top - main - nodes - nodes menus
set_scale#
def set_scale(self, scale=None, center=None, local_space=None)
Node: Scale Instances | Blender reference | api reference
Args:#
scale: Vector
center: Vector
local_space: Boolean
Returns:#
self
Go to top - main - nodes - nodes menus
socket_stack#
def socket_stack(self, node, socket_name=None)
Make the owning socket jump to the output socket of the node passed in argumment.
Args:#
node (Node): The node to jump to
socket_name: The name of the output socket (first one if None)
Go to top - main - nodes - nodes menus
store_named_attribute#
def store_named_attribute(self, name=None, value=None, data_type=None)
Store a named attribute
If selection exists, create an intermediary cloud of points to update selectively the items.
Args:#
name (str): name of the attribute
value (any): value of the attribute
data_type (str): valeu data type
Returns:#
data socket (DataSocket)
Go to top - main - nodes - nodes menus
store_named_attribute_no_selection#
def store_named_attribute_no_selection(self, name=None, value=None)
Args:#
name: String
value: [‘Vector’, ‘Float’, ‘Color’, ‘Boolean’, ‘Integer’]
Returns:#
self
Go to top - main - nodes - nodes menus
store_named_boolean#
def store_named_boolean(self, name, value)
Store a named attribute of type Boolean
Args:#
name (str): the attribute name
value (float): the value to store
Returns:#
Data socket (DataSocket)
Go to top - main - nodes - nodes menus
store_named_color#
def store_named_color(self, name, value)
Store a named attribute of type Color
Args:#
name (str): the attribute name
value (float): the value to store
Returns:#
Data socket (DataSocket)
Go to top - main - nodes - nodes menus
store_named_float#
def store_named_float(self, name, value)
Store a named attribute of type Float
Args:#
name (str): the attribute name
value (float): the value to store
Returns:#
Data socket (DataSocket)
Go to top - main - nodes - nodes menus
store_named_integer#
def store_named_integer(self, name, value)
Store a named attribute of type Integer
Args:#
name (str): the attribute name
value (float): the value to store
Returns:#
Data socket (DataSocket)
Go to top - main - nodes - nodes menus
store_named_vector#
def store_named_vector(self, name, value)
Store a named attribute of type Vector
Args:#
name (str): the attribute name
value (float): the value to store
Returns:#
Data socket (DataSocket)
Go to top - main - nodes - nodes menus
to_points#
def to_points(self, position=None, radius=None)
Args:#
position: Vector
radius: Float
Returns:#
socket
points
of class Points
Go to top - main - nodes - nodes menus
translate#
def translate(self, translation=None, local_space=None)
Args:#
translation: Vector
local_space: Boolean
Returns:#
self
Go to top - main - nodes - nodes menus
view#
def view(self, value=None)
Node: Viewer | Blender reference | api reference
Args:#
value: [‘Float’, ‘Vector’, ‘Color’, ‘Integer’, ‘Boolean’]
Returns:#
node with sockets []
Go to top - main - nodes - nodes menus
viewer#
def viewer(self, value=None)
Node: Viewer | Blender reference | api reference
Args:#
value: [‘Float’, ‘Vector’, ‘Color’, ‘Integer’, ‘Boolean’]
Returns:#
node with sockets []
Go to top - main - nodes - nodes menus