Geometry Nodes: support creating new attributes in modifier

This patch allows passing a field to the modifier as output. In the
modifier, the user can choose an attribute name. The attribute
will be filled with values computed by the field. This only works
for realized mesh/curve/point data. As mentioned in T91376, the
output domain is selected in the node group itself. We might want
to add this functionality to the modifier later as well, but not now.

Differential Revision: https://developer.blender.org/D12644
This commit is contained in:
2021-09-27 15:33:48 +02:00
parent 43167a2c25
commit 3d2ce25afd
4 changed files with 156 additions and 19 deletions

View File

@@ -754,6 +754,11 @@ class NodeTreeInterfacePanel:
# Display descriptions only for Geometry Nodes, since it's only used in the modifier panel.
if tree.type == 'GEOMETRY':
layout.prop(active_socket, "description")
field_socket_prefixes = {
"NodeSocketInt", "NodeSocketColor", "NodeSocketVector", "NodeSocketBool", "NodeSocketFloat"}
is_field_type = any(active_socket.bl_socket_idname.startswith(prefix) for prefix in field_socket_prefixes)
if in_out == "OUT" and is_field_type:
layout.prop(active_socket, "attribute_domain")
active_socket.draw(context, layout)