diff options
author | Jacques Lucke <jacques@blender.org> | 2021-08-09 13:54:02 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2021-08-09 13:54:02 +0300 |
commit | 71e3f18b4ae76ee958cf20f2ac2e10172ce8aa3b (patch) | |
tree | ed5a849f5d0936787eb1d40c27cdc7acb55d6ba0 /source/blender/editors | |
parent | 92b8d2f7e4167905013c5bac78f3ff524eaee96b (diff) |
add Store Local Attribute node
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/space_node/node_edit.cc | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/source/blender/editors/space_node/node_edit.cc b/source/blender/editors/space_node/node_edit.cc index c71805bddf9..8e8ec9fd51c 100644 --- a/source/blender/editors/space_node/node_edit.cc +++ b/source/blender/editors/space_node/node_edit.cc @@ -2990,6 +2990,25 @@ void NODE_OT_cryptomatte_layer_remove(wmOperatorType *ot) /* ****************** Geometry Expander Add Output ******************* */ +static eNodeSocketDatatype custom_data_type_to_socket_type(const CustomDataType type) +{ + switch (type) { + case CD_PROP_FLOAT: + return SOCK_FLOAT; + case CD_PROP_FLOAT2: + case CD_PROP_FLOAT3: + return SOCK_VECTOR; + case CD_PROP_COLOR: + return SOCK_RGBA; + case CD_PROP_INT32: + return SOCK_INT; + case CD_PROP_BOOL: + return SOCK_BOOLEAN; + default: + return SOCK_FLOAT; + } +} + static void foreach_available_attribute( bNodeTree *ntree, bNode *UNUSED(current_node), @@ -3018,6 +3037,15 @@ static void foreach_available_attribute( callback(attribute); } } + if (node->type == GEO_NODE_ATTRIBUTE_STORE_LOCAL) { + GeometryExpanderOutput attribute; + attribute.type = GEOMETRY_EXPANDER_OUTPUT_TYPE_LOCAL; + attribute.socket_type = custom_data_type_to_socket_type((CustomDataType)node->custom1); + attribute.array_source = GEOMETRY_EXPANDER_ARRAY_SOURCE_MESH_VERTICES; + STRNCPY(attribute.local_node_name, node->name); + STRNCPY(attribute.local_socket_identifier, ""); + callback(attribute); + } } { GeometryExpanderOutput attribute; |