Geometry Nodes: support storing 2d vector attributes
This allows choosing the 2d vector type in the Store Named Attribute node. Similar to byte-colors, there is not a special socket type for this (currently). In geometry nodes itself, vectors are all still 3d.
This commit is contained in:
parent
45dbd69296
commit
f0dc4d67e5
Notes:
blender-bot
2023-02-13 14:07:37 +01:00
Referenced by issue #102189, Geometry Node: Vector in face corner domain have different interpolation method unlike general uv for subdivision
|
@ -2175,6 +2175,7 @@ static bool generic_attribute_type_supported(const EnumPropertyItem *item)
|
|||
{
|
||||
return ELEM(item->value,
|
||||
CD_PROP_FLOAT,
|
||||
CD_PROP_FLOAT2,
|
||||
CD_PROP_FLOAT3,
|
||||
CD_PROP_COLOR,
|
||||
CD_PROP_BOOL,
|
||||
|
@ -2192,7 +2193,8 @@ static const EnumPropertyItem *rna_GeometryNodeAttributeType_type_itemf(bContext
|
|||
|
||||
static bool generic_attribute_type_supported_with_socket(const EnumPropertyItem *item)
|
||||
{
|
||||
return generic_attribute_type_supported(item) && !ELEM(item->value, CD_PROP_BYTE_COLOR);
|
||||
return generic_attribute_type_supported(item) &&
|
||||
!ELEM(item->value, CD_PROP_BYTE_COLOR, CD_PROP_FLOAT2);
|
||||
}
|
||||
static const EnumPropertyItem *rna_GeometryNodeAttributeType_type_with_socket_itemf(
|
||||
bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free)
|
||||
|
|
|
@ -59,7 +59,7 @@ static void node_update(bNodeTree *ntree, bNode *node)
|
|||
bNodeSocket *socket_boolean = socket_color4f->next;
|
||||
bNodeSocket *socket_int32 = socket_boolean->next;
|
||||
|
||||
nodeSetSocketAvailability(ntree, socket_vector, data_type == CD_PROP_FLOAT3);
|
||||
nodeSetSocketAvailability(ntree, socket_vector, ELEM(data_type, CD_PROP_FLOAT2, CD_PROP_FLOAT3));
|
||||
nodeSetSocketAvailability(ntree, socket_float, data_type == CD_PROP_FLOAT);
|
||||
nodeSetSocketAvailability(
|
||||
ntree, socket_color4f, ELEM(data_type, CD_PROP_COLOR, CD_PROP_BYTE_COLOR));
|
||||
|
@ -113,6 +113,11 @@ static void node_geo_exec(GeoNodeExecParams params)
|
|||
case CD_PROP_FLOAT:
|
||||
field = params.get_input<Field<float>>("Value_Float");
|
||||
break;
|
||||
case CD_PROP_FLOAT2: {
|
||||
field = params.get_input<Field<float3>>("Value_Vector");
|
||||
field = bke::get_implicit_type_conversions().try_convert(field, CPPType::get<float2>());
|
||||
break;
|
||||
}
|
||||
case CD_PROP_FLOAT3:
|
||||
field = params.get_input<Field<float3>>("Value_Vector");
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue