22 b.use_custom_socket_order();
23 b.allow_any_socket_order();
25 .supported_type({GeometryComponent::Type::Mesh,
26 GeometryComponent::Type::Volume,
27 GeometryComponent::Type::PointCloud,
28 GeometryComponent::Type::Curve,
29 GeometryComponent::Type::GreasePencil});
32 .align_with_previous()
45 const int domain_size = attributes.
domain_size(domain);
63 if (new_index == -1) {
65 new_index = orig_materials_num;
83 bool no_faces_warning =
false;
84 bool point_selection_warning =
false;
85 bool volume_selection_warning =
false;
86 bool curves_selection_warning =
false;
89 if (
Mesh *mesh = geometry_set.get_mesh_for_write()) {
90 if (mesh->faces_num == 0) {
91 if (mesh->verts_num > 0) {
92 no_faces_warning =
true;
99 &mesh->id, field_context, selection_field, attributes, AttrDomain::Face, material);
102 if (
Volume *volume = geometry_set.get_volume_for_write()) {
104 if (selection_field.node().depends_on_input()) {
105 volume_selection_warning =
true;
108 if (
PointCloud *pointcloud = geometry_set.get_pointcloud_for_write()) {
110 if (selection_field.node().depends_on_input()) {
111 point_selection_warning =
true;
114 if (
Curves *curves = geometry_set.get_curves_for_write()) {
116 if (selection_field.node().depends_on_input()) {
117 curves_selection_warning =
true;
120 if (
GreasePencil *grease_pencil = geometry_set.get_grease_pencil_for_write()) {
122 for (
const int layer_index : grease_pencil->layers().index_range()) {
123 Drawing *drawing = grease_pencil->get_eval_drawing(grease_pencil->layer(layer_index));
124 if (drawing ==
nullptr) {
145 if (no_faces_warning) {
147 TIP_(
"Mesh has no faces for material assignment"));
149 if (volume_selection_warning) {
152 TIP_(
"Volumes only support a single material; selection input cannot be a field"));
154 if (point_selection_warning) {
157 TIP_(
"Point clouds only support a single material; selection input cannot be a field"));
159 if (curves_selection_warning) {
162 TIP_(
"Curves only support a single material; selection input cannot be a field"));
165 params.set_output(
"Geometry", std::move(geometry_set));