23 b.add_input<
decl::Geometry>(
"Volume").description(
"Volume to take a named grid out of");
30 const bNode *node =
b.node_or_null();
47static std::optional<SocketValueVariant> try_get_named_grid(
51 const bool remove_grid,
61 if (!current_socket_type) {
70 if (current_socket_type != desired_socket_type) {
75 if (!converted_value) {
79 value_variant = std::move(*converted_value);
90 const std::string grid_name =
params.extract_input<std::string>(
"Name");
91 const bool remove_grid =
params.extract_input<
bool>(
"Remove");
95 if (std::optional<SocketValueVariant> value_variant = try_get_named_grid(
96 params, *volume, grid_name, remove_grid, socket_type))
98 params.set_output(
"Grid", std::move(*value_variant));
99 params.set_output(
"Volume", std::move(geometry_set));
103 if (!grid_name.empty()) {
105 "No supported grid found with the given name");
108 params.set_output(
"Grid", bke::GVolumeGrid(*grid_type));
109 params.set_output(
"Volume", std::move(geometry_set));
112 params.set_output(
"Volume", std::move(geometry_set));
113 params.set_default_remaining_outputs();
130 "Node socket data type",
142 ntype.
ui_name =
"Get Named Grid";
143 ntype.
ui_description =
"Get volume grid from a volume geometry with the specified name";
#define NODE_CLASS_GEOMETRY
#define GEO_NODE_GET_NAMED_GRID
const blender::bke::VolumeGridData * BKE_volume_grid_find(const Volume *volume, blender::StringRef name)
void BKE_volume_grid_remove(Volume *volume, const blender::bke::VolumeGridData *grid)
#define BLT_I18NCONTEXT_OPERATOR_DEFAULT
#define NOD_REGISTER_NODE(REGISTER_FUNC)
#define NOD_inline_enum_accessors(member)
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(uiLayout *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)
void geo_node_type_base(blender::bke::bNodeType *ntype, std::string idname, const std::optional< int16_t > legacy_type)
const EnumPropertyItem rna_enum_node_socket_data_type_items[]
Volume * get_volume_for_write()
std::string ui_description
void(* initfunc)(bNodeTree *ntree, bNode *node)
NodeGeometryExecFunction geometry_node_execute
const char * enum_name_legacy
void(* draw_buttons)(uiLayout *, bContext *C, PointerRNA *ptr)
NodeDeclareFunction declare
void use_property_decorate_set(bool is_sep)
void use_property_split_set(bool value)
void prop(PointerRNA *ptr, PropertyRNA *prop, int index, int value, eUI_Item_Flag flag, std::optional< blender::StringRef > name_opt, int icon, std::optional< blender::StringRef > placeholder=std::nullopt)