From 8e1ef54ae9359ed4611ed54230433bae743eca80 Mon Sep 17 00:00:00 2001 From: Habib Gahbiche Date: Tue, 14 Oct 2025 16:56:11 +0200 Subject: [PATCH 1/3] Fix #147678: Unsupported/Unlisted nodes can be created from menu-inputs in the compoositor Remove support in the compositor for the following nodes: - Combine Bundle - Separate Bundle - Closure Input - Closure Output - Evaluate Closure - Repeat Input - Repeat Output Pull Request: https://projects.blender.org/blender/blender/pulls/147998 --- source/blender/nodes/geometry/nodes/node_geo_closure.cc | 4 ++-- .../blender/nodes/geometry/nodes/node_geo_combine_bundle.cc | 2 +- .../blender/nodes/geometry/nodes/node_geo_evaluate_closure.cc | 2 +- source/blender/nodes/geometry/nodes/node_geo_repeat.cc | 4 ++-- .../blender/nodes/geometry/nodes/node_geo_separate_bundle.cc | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/source/blender/nodes/geometry/nodes/node_geo_closure.cc b/source/blender/nodes/geometry/nodes/node_geo_closure.cc index d67609d17cd..5064039c024 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_closure.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_closure.cc @@ -137,7 +137,7 @@ static bool node_insert_link(bke::NodeInsertLinkParams ¶ms) static void node_register() { static blender::bke::bNodeType ntype; - common_node_type_base(&ntype, "NodeClosureInput", NODE_CLOSURE_INPUT); + sh_geo_node_type_base(&ntype, "NodeClosureInput", NODE_CLOSURE_INPUT); ntype.ui_name = "Closure Input"; ntype.nclass = NODE_CLASS_INTERFACE; ntype.declare = node_declare; @@ -271,7 +271,7 @@ static void node_blend_read(bNodeTree & /*tree*/, bNode &node, BlendDataReader & static void node_register() { static blender::bke::bNodeType ntype; - common_node_type_base(&ntype, "NodeClosureOutput", NODE_CLOSURE_OUTPUT); + sh_geo_node_type_base(&ntype, "NodeClosureOutput", NODE_CLOSURE_OUTPUT); ntype.ui_name = "Closure Output"; ntype.nclass = NODE_CLASS_INTERFACE; ntype.declare = node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_combine_bundle.cc b/source/blender/nodes/geometry/nodes/node_geo_combine_bundle.cc index 88c46131db3..bac34904910 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_combine_bundle.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_combine_bundle.cc @@ -192,7 +192,7 @@ static void node_register() { static blender::bke::bNodeType ntype; - common_node_type_base(&ntype, "NodeCombineBundle", NODE_COMBINE_BUNDLE); + sh_geo_node_type_base(&ntype, "NodeCombineBundle", NODE_COMBINE_BUNDLE); ntype.ui_name = "Combine Bundle"; ntype.ui_description = "Combine multiple socket values into one."; ntype.nclass = NODE_CLASS_CONVERTER; diff --git a/source/blender/nodes/geometry/nodes/node_geo_evaluate_closure.cc b/source/blender/nodes/geometry/nodes/node_geo_evaluate_closure.cc index cbd3eea3100..48238339fb7 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_evaluate_closure.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_evaluate_closure.cc @@ -220,7 +220,7 @@ static void node_register() { static blender::bke::bNodeType ntype; - common_node_type_base(&ntype, "NodeEvaluateClosure", NODE_EVALUATE_CLOSURE); + sh_geo_node_type_base(&ntype, "NodeEvaluateClosure", NODE_EVALUATE_CLOSURE); ntype.ui_name = "Evaluate Closure"; ntype.ui_description = "Execute a given closure"; ntype.nclass = NODE_CLASS_CONVERTER; diff --git a/source/blender/nodes/geometry/nodes/node_geo_repeat.cc b/source/blender/nodes/geometry/nodes/node_geo_repeat.cc index f371f02b619..3f499b82e82 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_repeat.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_repeat.cc @@ -145,7 +145,7 @@ static int node_shader_fn(GPUMaterial *mat, static void node_register() { static blender::bke::bNodeType ntype; - common_node_type_base(&ntype, "GeometryNodeRepeatInput", GEO_NODE_REPEAT_INPUT); + sh_geo_node_type_base(&ntype, "GeometryNodeRepeatInput", GEO_NODE_REPEAT_INPUT); ntype.ui_name = "Repeat Input"; ntype.enum_name_legacy = "REPEAT_INPUT"; ntype.nclass = NODE_CLASS_INTERFACE; @@ -305,7 +305,7 @@ static int node_shader_fn(GPUMaterial *mat, static void node_register() { static blender::bke::bNodeType ntype; - common_node_type_base(&ntype, "GeometryNodeRepeatOutput", GEO_NODE_REPEAT_OUTPUT); + sh_geo_node_type_base(&ntype, "GeometryNodeRepeatOutput", GEO_NODE_REPEAT_OUTPUT); ntype.ui_name = "Repeat Output"; ntype.enum_name_legacy = "REPEAT_OUTPUT"; ntype.nclass = NODE_CLASS_INTERFACE; diff --git a/source/blender/nodes/geometry/nodes/node_geo_separate_bundle.cc b/source/blender/nodes/geometry/nodes/node_geo_separate_bundle.cc index 4f3a53dcda2..6730352bdb9 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_separate_bundle.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_separate_bundle.cc @@ -238,7 +238,7 @@ static void node_register() { static blender::bke::bNodeType ntype; - common_node_type_base(&ntype, "NodeSeparateBundle", NODE_SEPARATE_BUNDLE); + sh_geo_node_type_base(&ntype, "NodeSeparateBundle", NODE_SEPARATE_BUNDLE); ntype.ui_name = "Separate Bundle"; ntype.ui_description = "Split a bundle into multiple sockets."; ntype.nclass = NODE_CLASS_CONVERTER; From db6bb019380bd17b4c84e796fa6ebd0e6bf32e1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=B8=D0=BB=D1=8C=D1=8F=20=5F?= Date: Tue, 14 Oct 2025 16:56:48 +0200 Subject: [PATCH 2/3] Fix #147797: Geometry Nodes: Assertion in edge calculation for import mesh To scatter all map edges for original indices we don't need to take a slice of destination edges. Pull Request: https://projects.blender.org/blender/blender/pulls/147874 --- source/blender/blenkernel/intern/mesh_calc_edges.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/blenkernel/intern/mesh_calc_edges.cc b/source/blender/blenkernel/intern/mesh_calc_edges.cc index 2474fa300ac..cda13f07c8a 100644 --- a/source/blender/blenkernel/intern/mesh_calc_edges.cc +++ b/source/blender/blenkernel/intern/mesh_calc_edges.cc @@ -421,7 +421,7 @@ void mesh_calc_edges(Mesh &mesh, array_utils::scatter( edge_map.as_span().cast(), edge_map_to_result_index.as_span().slice(edge_offsets[task_index]), - edge_verts.slice(edge_offsets[task_index])); + edge_verts); }); calc_edges::update_edge_indices_in_face_loops( From 0be7678702f079e9e206b4f683d927e2792dea44 Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Tue, 14 Oct 2025 16:57:26 +0200 Subject: [PATCH 3/3] Fix #148003: crash when using incorrect grid type in Get Named Grid node The node was lacking any grid type checking. Now it also does implicit conversions when the requested grid type does not match the type of the stored grid. Pull Request: https://projects.blender.org/blender/blender/pulls/148038 --- .../geometry/nodes/node_geo_get_named_grid.cc | 69 +++++++++++++++---- 1 file changed, 56 insertions(+), 13 deletions(-) diff --git a/source/blender/nodes/geometry/nodes/node_geo_get_named_grid.cc b/source/blender/nodes/geometry/nodes/node_geo_get_named_grid.cc index 6c0c73ea203..7a630aa7e0a 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_get_named_grid.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_get_named_grid.cc @@ -43,6 +43,45 @@ static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr) layout->prop(ptr, "data_type", UI_ITEM_NONE, "", ICON_NONE); } +#ifdef WITH_OPENVDB +static std::optional try_get_named_grid( + GeoNodeExecParams ¶ms, + Volume &volume, + const StringRef grid_name, + const bool remove_grid, + const eNodeSocketDatatype desired_socket_type) +{ + const bke::VolumeGridData *grid = BKE_volume_grid_find(&volume, grid_name); + if (!grid) { + return std::nullopt; + } + const VolumeGridType stored_grid_type = grid->grid_type(); + const std::optional current_socket_type = bke::grid_type_to_socket_type( + stored_grid_type); + if (!current_socket_type) { + return std::nullopt; + } + /* Increment user count before removing from volume. */ + grid->add_user(); + if (remove_grid) { + BKE_volume_grid_remove(&volume, grid); + } + SocketValueVariant value_variant = SocketValueVariant::From(bke::GVolumeGrid(grid)); + if (current_socket_type != desired_socket_type) { + std::optional converted_value = implicitly_convert_socket_value( + *bke::node_socket_type_find_static(*current_socket_type), + value_variant, + *bke::node_socket_type_find_static(desired_socket_type)); + if (!converted_value) { + return std::nullopt; + } + params.error_message_add(NodeWarningType::Info, "Implicit grid type conversion"); + value_variant = std::move(*converted_value); + } + return value_variant; +} +#endif + static void node_geo_exec(GeoNodeExecParams params) { #ifdef WITH_OPENVDB @@ -50,25 +89,29 @@ static void node_geo_exec(GeoNodeExecParams params) GeometrySet geometry_set = params.extract_input("Volume"); const std::string grid_name = params.extract_input("Name"); const bool remove_grid = params.extract_input("Remove"); - const VolumeGridType grid_type = *bke::socket_type_to_grid_type( - eNodeSocketDatatype(node.custom1)); + const eNodeSocketDatatype socket_type = eNodeSocketDatatype(node.custom1); if (Volume *volume = geometry_set.get_volume_for_write()) { - if (const bke::VolumeGridData *grid = BKE_volume_grid_find(volume, grid_name)) { - /* Increment user count before removing from volume. */ - grid->add_user(); - if (remove_grid) { - BKE_volume_grid_remove(volume, grid); - } - - params.set_output("Grid", bke::GVolumeGrid(grid)); - params.set_output("Volume", geometry_set); + if (std::optional value_variant = try_get_named_grid( + params, *volume, grid_name, remove_grid, socket_type)) + { + params.set_output("Grid", std::move(*value_variant)); + params.set_output("Volume", std::move(geometry_set)); return; } } + if (!grid_name.empty()) { + params.error_message_add(NodeWarningType::Warning, + "No supported grid found with the given name"); + } + if (std::optional grid_type = bke::socket_type_to_grid_type(socket_type)) { + params.set_output("Grid", bke::GVolumeGrid(*grid_type)); + params.set_output("Volume", std::move(geometry_set)); + return; + } + params.set_output("Volume", std::move(geometry_set)); + params.set_default_remaining_outputs(); - params.set_output("Grid", bke::GVolumeGrid(grid_type)); - params.set_output("Volume", geometry_set); #else node_geo_exec_with_missing_openvdb(params); #endif