26 const bNode *node =
b.node_or_null();
33 b.add_input(data_type,
"Grid").hide_value().structure_type(StructureType::Grid);
36 .description(
"Transform from grid index space to object space");
37 b.add_output(data_type,
"Background Value").description(
"Default value outside of grid voxels");
49 switch (socket.
type) {
67 const StructureType structure_type = other_socket.
runtime->inferred_structure_type;
68 const bool is_grid = structure_type == StructureType::Grid;
69 const bool is_dynamic = structure_type == StructureType::Dynamic;
73 if (is_grid || is_dynamic) {
77 bNode &node =
params.add_node(
"GeometryNodeGridInfo");
79 params.update_and_connect_available_socket(node,
"Grid");
87 bNode &node =
params.add_node(
"GeometryNodeGridInfo");
88 params.update_and_connect_available_socket(node,
"Transform");
94 bNode &node =
params.add_node(
"GeometryNodeGridInfo");
96 params.update_and_connect_available_socket(node,
"Background Value");
107 const auto grid =
params.extract_input<bke::GVolumeGrid>(
"Grid");
109 params.set_default_remaining_outputs();
113 bke::VolumeTreeAccessToken tree_token;
114 const std::shared_ptr<const openvdb::GridBase> vdb_grid = grid->grid_ptr(tree_token);
115 params.set_output(
"Transform", BKE_volume_transform_to_blender(vdb_grid->transform()));
119 using ValueT =
decltype(type_tag);
120 using type_traits =
typename bke::VolumeGridTraits<ValueT>;
121 using TreeType =
typename type_traits::TreeType;
122 using GridType = openvdb::Grid<TreeType>;
124 if constexpr (!std::is_same_v<typename type_traits::BlenderType, void>) {
125 const std::shared_ptr<const GridType> vdb_typed_grid = openvdb::GridBase::grid<GridType>(
127 params.set_output(
"Background Value",
128 type_traits::to_blender(vdb_typed_grid->background()));
146 "Node socket data type",
159 ntype.
ui_description =
"Retrieve information about a volume grid";
#define NOD_REGISTER_NODE(REGISTER_FUNC)
#define NOD_inline_enum_accessors(member)
void convert_to_static_type(const CPPType &cpp_type, const Func &func)
void node_register_type(bNodeType &ntype)
const CPPType * socket_type_to_geo_nodes_base_cpp_type(eNodeSocketDatatype type)
static void node_register()
static void node_geo_exec(GeoNodeExecParams params)
static void node_declare(NodeDeclarationBuilder &b)
static void node_init(bNodeTree *, bNode *node)
static void node_rna(StructRNA *srna)
static std::optional< eNodeSocketDatatype > node_type_for_socket_type(const bNodeSocket &socket)
static void node_layout(uiLayout *layout, bContext *, PointerRNA *ptr)
static void node_gather_link_search_ops(GatherLinkSearchOpParams ¶ms)
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)
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[]
bNodeSocketRuntimeHandle * runtime
std::string ui_description
void(* initfunc)(bNodeTree *ntree, bNode *node)
NodeGeometryExecFunction geometry_node_execute
void(* draw_buttons)(uiLayout *, bContext *C, PointerRNA *ptr)
NodeGatherSocketLinkOperationsFunction gather_link_search_ops
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)