20 b.use_custom_socket_order();
21 b.allow_any_socket_order();
23 .supported_type({GeometryComponent::Type::Mesh,
24 GeometryComponent::Type::Volume,
25 GeometryComponent::Type::PointCloud,
26 GeometryComponent::Type::Curve,
27 GeometryComponent::Type::GreasePencil});
28 b.add_output<
decl::Geometry>(
"Geometry").propagate_all().align_with_previous();
40 const int domain_size = attributes.
domain_size(domain);
58 if (new_index == -1) {
60 new_index = orig_materials_num;
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 for (
const int layer_index : grease_pencil->layers().index_range()) {
118 Drawing *drawing = grease_pencil->get_eval_drawing(grease_pencil->layer(layer_index));
119 if (drawing ==
nullptr) {
140 if (no_faces_warning) {
142 TIP_(
"Mesh has no faces for material assignment"));
144 if (volume_selection_warning) {
147 TIP_(
"Volumes only support a single material; selection input cannot be a field"));
149 if (point_selection_warning) {
152 TIP_(
"Point clouds only support a single material; selection input cannot be a field"));
154 if (curves_selection_warning) {
157 TIP_(
"Curves only support a single material; selection input cannot be a field"));
160 params.set_output(
"Geometry", std::move(geometry_set));