6# include <openvdb/openvdb.h>
7# include <openvdb/tools/Composite.h>
31 const bNode *node =
b.node_or_null();
33 auto &first_grid =
b.add_input<
decl::Float>(
"Grid 1").hide_value();
36 static const auto make_available = [](
bNode &
node) {
60 first_grid.available(
false);
63 first_grid.available(
true);
85 grids.append(std::move(grid));
101 get_float_grids(inputs, operands);
105 operands.
append(std::move(grid));
107 get_float_grids(inputs, operands);
112 params.set_default_remaining_outputs();
116 bke::VolumeTreeAccessToken result_token;
117 openvdb::FloatGrid &result_grid = operands.
first().grid_for_write(result_token);
118 const openvdb::math::Transform &transform = result_grid.transform();
121 bke::VolumeTreeAccessToken tree_token;
122 std::shared_ptr<openvdb::FloatGrid> resampled_storage;
123 openvdb::FloatGrid &grid = geometry::resample_sdf_grid_if_necessary(
124 volume_grid, tree_token, transform, resampled_storage);
129 openvdb::tools::csgIntersection(result_grid, grid);
132 openvdb::tools::csgUnion(result_grid, grid);
135 openvdb::tools::csgDifference(result_grid, grid);
139 catch (
const openvdb::ValueError & ) {
141 params.set_default_remaining_outputs();
146 params.set_output(
"Grid", std::move(operands.
first()));
159 "Keep the part of the grids that is common between all operands"},
165 "Combine grids in a subtractive way"},
166 {0,
nullptr, 0,
nullptr,
nullptr},
#define NODE_CLASS_GEOMETRY
#define NOD_REGISTER_NODE(REGISTER_FUNC)
#define NOD_inline_enum_accessors(member)
void uiItemR(uiLayout *layout, PointerRNA *ptr, const char *propname, eUI_Item_Flag flag, const char *name, int icon)
void append(const T &value)
MutableSpan< T > as_mutable_span()
void make_available(bNode &node) const
local_group_size(16, 16) .push_constant(Type b
draw_view push_constant(Type::INT, "radiance_src") .push_constant(Type capture_info_buf storage_buf(1, Qualifier::READ, "ObjectBounds", "bounds_buf[]") .push_constant(Type draw_view int
void node_register_type(bNodeType *ntype)
static void node_rna(StructRNA *srna)
static void node_init(bNodeTree *, bNode *node)
static void node_register()
static void node_geo_exec(GeoNodeExecParams params)
static void node_layout(uiLayout *layout, bContext *, PointerRNA *ptr)
static void node_declare(NodeDeclarationBuilder &b)
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)
void search_link_ops_for_volume_grid_node(GatherLinkSearchOpParams ¶ms)
void node_geo_exec_with_missing_openvdb(GeoNodeExecParams ¶ms)
void geo_node_type_base(blender::bke::bNodeType *ntype, int type, const char *name, short nclass)
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