23 b.add_input<
decl::Geometry>(
"Volume"_ustr).description(
"Volume to take a named grid out of");
38 .structure_type(StructureType::Grid);
49static std::optional<SocketValueVariant> try_get_named_grid(
53 const bool remove_grid,
63 if (!current_socket_type) {
72 if (current_socket_type != desired_socket_type) {
77 if (!converted_value) {
81 value_variant = std::move(*converted_value);
92 const std::string grid_name = params.
extract_input<std::string>(
"Name"_ustr);
93 const bool remove_grid = params.
extract_input<
bool>(
"Remove"_ustr);
97 if (std::optional<SocketValueVariant> value_variant = try_get_named_grid(
98 params, *volume, grid_name, remove_grid, socket_type))
100 params.
set_output(
"Grid"_ustr, std::move(*value_variant));
101 params.
set_output(
"Volume"_ustr, std::move(geometry_set));
105 if (!grid_name.empty()) {
107 "No supported grid found with the given name");
110 params.
set_output(
"Grid"_ustr, bke::GVolumeGrid(*grid_type));
111 params.
set_output(
"Volume"_ustr, std::move(geometry_set));
114 params.
set_output(
"Volume"_ustr, std::move(geometry_set));
132 "Node socket data type",
144 ntype.
ui_name =
"Get Named Grid";
145 ntype.
ui_description =
"Get volume grid from a volume geometry with the specified name";
#define NODE_CLASS_GEOMETRY
#define GEO_NODE_GET_NAMED_GRID
#define BLT_I18NCONTEXT_OPERATOR_DEFAULT
#define NOD_REGISTER_NODE(REGISTER_FUNC)
#define NOD_inline_enum_accessors(member)
void error_message_add(const NodeWarningType type, StringRef message) const
T extract_input(const UString identifier)
const bNode & node() const
void set_default_remaining_outputs()
void set_output(const UString identifier, T &&value)
std::optional< std::string > translation_context
static SocketValueVariant from(T &&value)
std::optional< VolumeGridType > socket_type_to_grid_type(eNodeSocketDatatype type)
void node_register_type(bNodeType &ntype)
std::optional< eNodeSocketDatatype > grid_type_to_socket_type(VolumeGridType type)
bNodeSocketType * node_socket_type_find_static(int type, int subtype=0)
static void node_declare(NodeDeclarationBuilder &b)
static void node_geo_exec(GeoNodeExecParams params)
static void node_rna(StructRNA *srna)
static void node_register()
static void node_layout(ui::Layout &layout, bContext *, PointerRNA *ptr)
static void node_init(bNodeTree *, bNode *node)
PropertyRNA * RNA_def_node_enum(StructRNA *srna, const char *identifier, const char *ui_name, const char *ui_description, const EnumPropertyItem *static_items, const EnumRNAAccessors accessors, std::optional< int > default_value, const EnumPropertyItemFunc item_func, const bool allow_animation)
const EnumPropertyItem * grid_socket_type_items_filter_fn(bContext *, PointerRNA *, PropertyRNA *, bool *r_free)
std::optional< SocketValueVariant > implicitly_convert_socket_value(const bke::bNodeSocketType &from_type, const SocketValueVariant &from_value, const bke::bNodeSocketType &to_type)
void node_geo_exec_with_missing_openvdb(GeoNodeExecParams ¶ms)
const bke::VolumeGridData * BKE_volume_grid_find(const Volume *volume, StringRef name)
void BKE_volume_grid_remove(Volume *volume, const bke::VolumeGridData *grid)
const EnumPropertyItem rna_enum_node_socket_data_type_items[]
void geo_node_type_base(bke::bNodeType *ntype, UString idname, const std::optional< int16_t > legacy_type)
Volume * get_volume_for_write()
void(*) draw_buttons(ui::Layout &, bContext *C, PointerRNA *ptr)
std::string ui_description
NodeGeometryExecFunction geometry_node_execute
void(*) initfunc(bNodeTree *ntree, bNode *node)
const char * enum_name_legacy
NodeDeclareFunction declare
void use_property_decorate_set(bool is_decorate)
void use_property_split_set(bool is_sep)
void prop(PointerRNA *ptr, PropertyRNA *prop, int index, int value, eUI_Item_Flag flag, std::optional< StringRef > name_opt, int icon, std::optional< StringRef > placeholder=std::nullopt)