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
This commit is contained in:
parent
5f2317fa9b
commit
c4f7f59c65
Notes:
blender-bot
2023-02-14 05:43:04 +01:00
Referenced by commit d813ee55fd
, Fix: Incorrect info message in set material node
|
@ -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));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue