29 b.use_custom_socket_order();
30 b.allow_any_socket_order();
31 b.add_default_layout();
32 b.add_input(data_type,
"Grid"_ustr)
34 .structure_type(StructureType::Grid)
35 .is_default_link_socket();
36 b.add_output(data_type,
"Grid"_ustr).structure_type(StructureType::Grid).align_with_previous();
37 b.add_input(data_type,
"Background"_ustr).structure_type(StructureType::Single);
39 .description(
"Override all values stored for inactive voxels as well");
51 switch (socket.
type) {
75 const bool is_grid = structure_type == StructureType::Grid;
76 const bool is_dynamic = structure_type == StructureType::Dynamic;
79 if (is_grid || is_dynamic) {
82 node.custom1 = *data_type;
86 if (!is_grid || is_dynamic) {
89 node.custom1 = *data_type;
97 node.custom1 = *data_type;
106 bke::GVolumeGrid grid = params.
extract_input<bke::GVolumeGrid>(
"Grid"_ustr);
114 const GPointer background = background_variant.
get();
116 const bool update_inactive = params.
get_input<
bool>(
"Update Inactive"_ustr);
118 bke::VolumeTreeAccessToken tree_token;
119 openvdb::GridBase &grid_base = grid.get_for_write().grid_for_write(tree_token);
120 bke::volume_grid::set_grid_background(grid_base, background);
122 if (update_inactive) {
123 bke::volume_grid::set_inactive_values(grid_base, background);
126 params.
set_output(
"Grid"_ustr, std::move(grid));
142 "Node socket data type",
154 ntype.
ui_name =
"Set Grid Background";
155 ntype.
ui_description =
"Set the background value used for inactive voxels and tiles";
#define NODE_CLASS_GEOMETRY
#define NOD_REGISTER_NODE(REGISTER_FUNC)
#define NOD_inline_enum_accessors(member)
nodes::StructureType inferred_structure_type
void add_item(std::string socket_name, SocketLinkOperation::LinkSocketFn fn, int weight=0)
const bNodeSocket & other_socket() const
eNodeSocketInOut in_out() const
T extract_input(const UString identifier)
T get_input(const UString identifier) const
void set_default_remaining_outputs()
void set_output(const UString identifier, T &&value)
void update_and_connect_available_socket(bNode &new_node, UString socket_name)
bNode & add_node(UString idname)
void node_register_type(bNodeType &ntype)
static void node_geo_exec(GeoNodeExecParams params)
static void node_rna(StructRNA *srna)
static void node_layout(ui::Layout &layout, bContext *, PointerRNA *ptr)
static void node_declare(NodeDeclarationBuilder &b)
static void node_init(bNodeTree *, bNode *node)
static std::optional< eNodeSocketDatatype > node_type_for_socket_type(const bNodeSocket &socket)
static void node_register()
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)
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)
bke::bNodeSocketRuntime * runtime
static constexpr int _160
void(*) draw_buttons(ui::Layout &, bContext *C, PointerRNA *ptr)
std::string ui_description
NodeGeometryExecFunction geometry_node_execute
void(*) initfunc(bNodeTree *ntree, bNode *node)
NodeGatherSocketLinkOperationsFunction gather_link_search_ops
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)