From 5841cb21f73c92e89892112d8e0415177190cf58 Mon Sep 17 00:00:00 2001 From: Omar Emara Date: Thu, 9 Oct 2025 17:23:12 +0200 Subject: [PATCH] Fix #146759: Radial Tilling node crashes in the compositor The Radial Tilling node crashes in the compositor in GPU mode. This is because the compositor does not yet support 2D vectors in shader code generation, but properly supports and expects them in the interface, which the Radial Tilling node declares. This results in a bad shader which crashes Blender. To properly fix this, we need to: - Support 2D vectors in compositor GPU material shader code generation. - Support 2D vectors in shader node GPU stack construction. - Adjust the interface of radial tilling to actually use 2D vectors. This seems risky for 5.0, so this patch temporarily drops support for the node in the compositor in 5.0. Then once 2D vectors are supported, it can be enabled again. Pull Request: https://projects.blender.org/blender/blender/pulls/147627 --- .../startup/bl_ui/node_add_menu_compositor.py | 1 - .../blender/nodes/shader/node_shader_util.cc | 22 +++++++++++++++++++ .../blender/nodes/shader/node_shader_util.hh | 3 +++ .../shader/nodes/node_shader_radial_tiling.cc | 2 +- 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/scripts/startup/bl_ui/node_add_menu_compositor.py b/scripts/startup/bl_ui/node_add_menu_compositor.py index ee91b5dbc27..437000cc3d4 100644 --- a/scripts/startup/bl_ui/node_add_menu_compositor.py +++ b/scripts/startup/bl_ui/node_add_menu_compositor.py @@ -302,7 +302,6 @@ class NODE_MT_compositor_node_vector_base(node_add_menu.NodeMenu): ops.value = "'VECTOR'" self.node_operator(layout, "ShaderNodeSeparateXYZ") layout.separator() - self.node_operator(layout, "ShaderNodeRadialTiling") self.node_operator(layout, "ShaderNodeVectorCurve") self.node_operator_with_searchable_enum(context, layout, "ShaderNodeVectorMath", "operation") self.node_operator(layout, "ShaderNodeVectorRotate") diff --git a/source/blender/nodes/shader/node_shader_util.cc b/source/blender/nodes/shader/node_shader_util.cc index 97cf0344261..1e5b8b0314c 100644 --- a/source/blender/nodes/shader/node_shader_util.cc +++ b/source/blender/nodes/shader/node_shader_util.cc @@ -38,6 +38,17 @@ bool sh_node_poll_default(const blender::bke::bNodeType * /*ntype*/, return true; } +static bool sh_geo_poll_default(const blender::bke::bNodeType * /*ntype*/, + const bNodeTree *ntree, + const char **r_disabled_hint) +{ + if (!STR_ELEM(ntree->idname, "ShaderNodeTree", "GeometryNodeTree")) { + *r_disabled_hint = RPT_("Not a shader or geometry node tree"); + return false; + } + return true; +} + static bool common_poll_default(const blender::bke::bNodeType * /*ntype*/, const bNodeTree *ntree, const char **r_disabled_hint) @@ -60,6 +71,17 @@ void sh_node_type_base(blender::bke::bNodeType *ntype, ntype->gather_link_search_ops = blender::nodes::search_link_ops_for_basic_node; } +void sh_geo_node_type_base(blender::bke::bNodeType *ntype, + std::string idname, + const std::optional legacy_type) +{ + blender::bke::node_type_base(*ntype, idname, legacy_type); + + ntype->poll = sh_geo_poll_default; + ntype->insert_link = node_insert_link_default; + ntype->gather_link_search_ops = blender::nodes::search_link_ops_for_basic_node; +} + void common_node_type_base(blender::bke::bNodeType *ntype, std::string idname, const std::optional legacy_type) diff --git a/source/blender/nodes/shader/node_shader_util.hh b/source/blender/nodes/shader/node_shader_util.hh index a2d14d2f9c6..355b5c6bf28 100644 --- a/source/blender/nodes/shader/node_shader_util.hh +++ b/source/blender/nodes/shader/node_shader_util.hh @@ -46,6 +46,9 @@ bool sh_node_poll_default(const blender::bke::bNodeType *ntype, void sh_node_type_base(blender::bke::bNodeType *ntype, std::string idname, std::optional legacy_type = std::nullopt); +void sh_geo_node_type_base(blender::bke::bNodeType *ntype, + std::string idname, + std::optional legacy_type = std::nullopt); void common_node_type_base(blender::bke::bNodeType *ntype, std::string idname, std::optional legacy_type = std::nullopt); diff --git a/source/blender/nodes/shader/nodes/node_shader_radial_tiling.cc b/source/blender/nodes/shader/nodes/node_shader_radial_tiling.cc index f62492cdbe3..6c3a22d067b 100644 --- a/source/blender/nodes/shader/nodes/node_shader_radial_tiling.cc +++ b/source/blender/nodes/shader/nodes/node_shader_radial_tiling.cc @@ -209,7 +209,7 @@ void register_node_type_sh_radial_tiling() static blender::bke::bNodeType ntype; - common_node_type_base(&ntype, "ShaderNodeRadialTiling"); + sh_geo_node_type_base(&ntype, "ShaderNodeRadialTiling"); ntype.ui_name = "Radial Tiling"; ntype.ui_description = "Transform Coordinate System for Radial Tiling"; ntype.nclass = NODE_CLASS_OP_VECTOR;