23 .supported_type({GeometryComponent::Type::Mesh,
24 GeometryComponent::Type::Volume,
25 GeometryComponent::Type::PointCloud,
26 GeometryComponent::Type::Curve,
27 GeometryComponent::Type::GreasePencil});
78 bool no_faces_warning =
false;
79 bool point_selection_warning =
false;
80 bool volume_selection_warning =
false;
81 bool curves_selection_warning =
false;
83 geometry_set.modify_geometry_sets([&](
GeometrySet &geometry_set) {
84 if (
Mesh *mesh = geometry_set.get_mesh_for_write()) {
85 if (mesh->faces_num == 0) {
86 if (mesh->verts_num > 0) {
87 no_faces_warning =
true;
94 &mesh->id, field_context, selection_field, attributes, AttrDomain::Face, material);
97 if (
Volume *volume = geometry_set.get_volume_for_write()) {
99 if (selection_field.node().depends_on_input()) {
100 volume_selection_warning =
true;
103 if (
PointCloud *pointcloud = geometry_set.get_pointcloud_for_write()) {
105 if (selection_field.node().depends_on_input()) {
106 point_selection_warning =
true;
109 if (
Curves *curves = geometry_set.get_curves_for_write()) {
111 if (selection_field.node().depends_on_input()) {
112 curves_selection_warning =
true;
115 if (
GreasePencil *grease_pencil = geometry_set.get_grease_pencil_for_write()) {
117 Vector<Mesh *> mesh_by_layer(grease_pencil->layers().size(),
nullptr);
118 for (
const int layer_index : grease_pencil->layers().index_range()) {
119 Drawing *drawing = grease_pencil->get_eval_drawing(grease_pencil->layer(layer_index));
120 if (drawing ==
nullptr) {
124 if (
curves.curves_num() == 0) {
141 if (no_faces_warning) {
142 params.error_message_add(NodeWarningType::Info,
143 TIP_(
"Mesh has no faces for material assignment"));
145 if (volume_selection_warning) {
147 NodeWarningType::Info,
148 TIP_(
"Volumes only support a single material; selection input cannot be a field"));
150 if (point_selection_warning) {
152 NodeWarningType::Info,
153 TIP_(
"Point clouds only support a single material; selection input cannot be a field"));
155 if (curves_selection_warning) {
157 NodeWarningType::Info,
158 TIP_(
"Curves only support a single material; selection input cannot be a field"));
161 params.set_output(
"Geometry", std::move(geometry_set));