21 const bNode *node =
b.node_or_null();
28 b.use_custom_socket_order();
29 b.allow_any_socket_order();
30 b.add_default_layout();
31 b.add_input(data_type,
"Grid")
33 .structure_type(StructureType::Grid)
34 .is_default_link_socket();
35 b.add_output(data_type,
"Grid").structure_type(StructureType::Grid).align_with_previous();
36 b.add_input(data_type,
"Background").structure_type(StructureType::Single);
48 switch (socket.
type) {
71 const StructureType structure_type = other_socket.
runtime->inferred_structure_type;
72 const bool is_grid = structure_type == StructureType::Grid;
73 const bool is_dynamic = structure_type == StructureType::Dynamic;
76 if (is_grid || is_dynamic) {
78 bNode &node =
params.add_node(
"GeometryNodeSetGridBackground");
80 params.update_and_connect_available_socket(node,
"Grid");
83 if (!is_grid || is_dynamic) {
85 bNode &node =
params.add_node(
"GeometryNodeSetGridBackground");
87 params.update_and_connect_available_socket(node,
"Background");
93 bNode &node =
params.add_node(
"GeometryNodeSetGridBackground");
95 params.update_and_connect_available_socket(node,
"Grid");
103 bke::GVolumeGrid grid =
params.extract_input<bke::GVolumeGrid>(
"Grid");
105 params.set_default_remaining_outputs();
111 bke::VolumeTreeAccessToken tree_token;
112 openvdb::GridBase &grid_base = grid.get_for_write().grid_for_write(tree_token);
113 bke::volume_grid::set_grid_background(grid_base, background.get_single_ptr());
115 params.set_output(
"Grid", std::move(grid));
131 "Node socket data type",
143 ntype.
ui_name =
"Set Grid Background";
144 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)
void node_register_type(bNodeType &ntype)
static void node_geo_exec(GeoNodeExecParams params)
static void node_layout(uiLayout *layout, bContext *, PointerRNA *ptr)
static void node_rna(StructRNA *srna)
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)
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)