diff options
author | Christophe Hery <chery> | 2022-04-11 22:52:20 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-04-11 22:52:20 +0300 |
commit | c4f7f59c659f7d986e4a2602eff4135fc58cf2f1 (patch) | |
tree | 3d48eff8aeb9414d4b0534f68d2bb0b44f7dfc2d /source/blender/nodes | |
parent | 5f2317fa9b7155b6a4e9742ce75890b2dc8a575c (diff) |
Curves: Add support for new curves type in Set Material node
Simply add the few lines so that the Cycles renderable New Curves
(with a small temporary patch to output the new type to render engines)
would get assigned a shader (in particular a hair shader).
Differential Revision: https://developer.blender.org/D14622
Diffstat (limited to 'source/blender/nodes')
-rw-r--r-- | source/blender/nodes/geometry/nodes/node_geo_set_material.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/source/blender/nodes/geometry/nodes/node_geo_set_material.cc b/source/blender/nodes/geometry/nodes/node_geo_set_material.cc index c48129acbdc..70063b3af19 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_set_material.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_set_material.cc @@ -9,6 +9,7 @@ #include "DNA_meshdata_types.h" #include "DNA_pointcloud_types.h" #include "DNA_volume_types.h" +#include "DNA_curves_types.h" #include "BKE_material.h" @@ -63,6 +64,7 @@ static void node_geo_exec(GeoNodeExecParams params) /* Only add the warnings once, even if there are many unique instances. */ bool point_selection_warning = false; bool volume_selection_warning = false; + bool curves_selection_warning = false; geometry_set.modify_geometry_sets([&](GeometrySet &geometry_set) { if (geometry_set.has_mesh()) { @@ -89,6 +91,12 @@ static void node_geo_exec(GeoNodeExecParams params) point_selection_warning = true; } } + if (Curves *curves = geometry_set.get_curves_for_write()) { + BKE_id_material_eval_assign(&curves->id, 1, material); + if (selection_field.node().depends_on_input()) { + curves_selection_warning = true; + } + } }); if (volume_selection_warning) { @@ -101,6 +109,11 @@ static void node_geo_exec(GeoNodeExecParams params) NodeWarningType::Info, TIP_("Point clouds only support a single material; selection input can not be a field")); } + if (curves_selection_warning) { + params.error_message_add( + NodeWarningType::Info, + TIP_("Curves only support a single material; selection input can not be a field")); + } params.set_output("Geometry", std::move(geometry_set)); } |