Fix: Geometry Nodes: Properly expose supported grid socket types
The Grid Info node was not exposing the other supported socket types (`Integer` and `Boolean`). The other Sample Grid, Sample Grid Index and Get Named Grid nodes were updated to use the same enum filtering as the Grid Info node and ensured tooltips were consistent. Pull Request: https://projects.blender.org/blender/blender/pulls/146785
This commit is contained in:
committed by
Hans Goudey
parent
8111fe2369
commit
79c1198770
@@ -43,11 +43,6 @@ static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
|
||||
layout->prop(ptr, "data_type", UI_ITEM_NONE, "", ICON_NONE);
|
||||
}
|
||||
|
||||
static void node_init(bNodeTree * /*tree*/, bNode *node)
|
||||
{
|
||||
node->custom1 = SOCK_FLOAT;
|
||||
}
|
||||
|
||||
static void node_geo_exec(GeoNodeExecParams params)
|
||||
{
|
||||
#ifdef WITH_OPENVDB
|
||||
@@ -79,12 +74,17 @@ static void node_geo_exec(GeoNodeExecParams params)
|
||||
#endif
|
||||
}
|
||||
|
||||
static void node_init(bNodeTree * /*tree*/, bNode *node)
|
||||
{
|
||||
node->custom1 = SOCK_FLOAT;
|
||||
}
|
||||
|
||||
static void node_rna(StructRNA *srna)
|
||||
{
|
||||
RNA_def_node_enum(srna,
|
||||
"data_type",
|
||||
"Data Type",
|
||||
"Type of grid data",
|
||||
"Node socket data type",
|
||||
rna_enum_node_socket_data_type_items,
|
||||
NOD_inline_enum_accessors(custom1),
|
||||
SOCK_FLOAT,
|
||||
|
||||
@@ -89,7 +89,7 @@ static void node_rna(StructRNA *srna)
|
||||
RNA_def_node_enum(srna,
|
||||
"data_type",
|
||||
"Data Type",
|
||||
"Type of grid data",
|
||||
"Node socket data type",
|
||||
rna_enum_node_socket_data_type_items,
|
||||
NOD_inline_enum_accessors(custom1),
|
||||
SOCK_FLOAT,
|
||||
|
||||
@@ -109,11 +109,6 @@ static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
|
||||
layout->prop(ptr, "data_type", UI_ITEM_NONE, "", ICON_NONE);
|
||||
}
|
||||
|
||||
static void node_init(bNodeTree * /*tree*/, bNode *node)
|
||||
{
|
||||
node->custom1 = SOCK_FLOAT;
|
||||
}
|
||||
|
||||
#ifdef WITH_OPENVDB
|
||||
|
||||
template<typename T>
|
||||
@@ -249,16 +244,9 @@ static void node_geo_exec(GeoNodeExecParams params)
|
||||
#endif
|
||||
}
|
||||
|
||||
static const EnumPropertyItem *data_type_filter_fn(bContext * /*C*/,
|
||||
PointerRNA * /*ptr*/,
|
||||
PropertyRNA * /*prop*/,
|
||||
bool *r_free)
|
||||
static void node_init(bNodeTree * /*tree*/, bNode *node)
|
||||
{
|
||||
*r_free = true;
|
||||
return enum_items_filter(
|
||||
rna_enum_node_socket_data_type_items, [](const EnumPropertyItem &item) -> bool {
|
||||
return ELEM(item.value, SOCK_FLOAT, SOCK_INT, SOCK_BOOLEAN, SOCK_VECTOR);
|
||||
});
|
||||
node->custom1 = SOCK_FLOAT;
|
||||
}
|
||||
|
||||
static void node_rna(StructRNA *srna)
|
||||
@@ -270,7 +258,7 @@ static void node_rna(StructRNA *srna)
|
||||
rna_enum_node_socket_data_type_items,
|
||||
NOD_inline_enum_accessors(custom1),
|
||||
SOCK_FLOAT,
|
||||
data_type_filter_fn);
|
||||
grid_socket_type_items_filter_fn);
|
||||
}
|
||||
|
||||
static void node_register()
|
||||
|
||||
@@ -99,11 +99,6 @@ static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
|
||||
layout->prop(ptr, "data_type", UI_ITEM_NONE, "", ICON_NONE);
|
||||
}
|
||||
|
||||
static void node_init(bNodeTree * /*tree*/, bNode *node)
|
||||
{
|
||||
node->custom1 = SOCK_FLOAT;
|
||||
}
|
||||
|
||||
#ifdef WITH_OPENVDB
|
||||
|
||||
template<typename T>
|
||||
@@ -214,16 +209,9 @@ static void node_geo_exec(GeoNodeExecParams params)
|
||||
#endif
|
||||
}
|
||||
|
||||
static const EnumPropertyItem *data_type_filter_fn(bContext * /*C*/,
|
||||
PointerRNA * /*ptr*/,
|
||||
PropertyRNA * /*prop*/,
|
||||
bool *r_free)
|
||||
static void node_init(bNodeTree * /*tree*/, bNode *node)
|
||||
{
|
||||
*r_free = true;
|
||||
return enum_items_filter(
|
||||
rna_enum_node_socket_data_type_items, [](const EnumPropertyItem &item) -> bool {
|
||||
return ELEM(item.value, SOCK_FLOAT, SOCK_INT, SOCK_BOOLEAN, SOCK_VECTOR);
|
||||
});
|
||||
node->custom1 = SOCK_FLOAT;
|
||||
}
|
||||
|
||||
static void node_rna(StructRNA *srna)
|
||||
@@ -235,7 +223,7 @@ static void node_rna(StructRNA *srna)
|
||||
rna_enum_node_socket_data_type_items,
|
||||
NOD_inline_enum_accessors(custom1),
|
||||
SOCK_FLOAT,
|
||||
data_type_filter_fn);
|
||||
grid_socket_type_items_filter_fn);
|
||||
}
|
||||
|
||||
static void node_register()
|
||||
|
||||
@@ -537,7 +537,7 @@ bool socket_type_supports_fields(const eNodeSocketDatatype socket_type)
|
||||
|
||||
bool socket_type_supports_grids(const eNodeSocketDatatype socket_type)
|
||||
{
|
||||
return ELEM(socket_type, SOCK_FLOAT, SOCK_VECTOR);
|
||||
return ELEM(socket_type, SOCK_FLOAT, SOCK_VECTOR, SOCK_INT, SOCK_BOOLEAN);
|
||||
}
|
||||
|
||||
bool socket_type_always_single(const eNodeSocketDatatype socket_type)
|
||||
|
||||
Reference in New Issue
Block a user