19 b.use_custom_socket_order();
20 b.allow_any_socket_order();
22 .supported_type({GeometryComponent::Type::Mesh, GeometryComponent::Type::GreasePencil})
23 .description(
"Geometry to update the material indices on");
24 b.add_output<
decl::Geometry>(
"Geometry").propagate_all().align_with_previous();
26 b.add_input<
decl::Int>(
"Material Index").
min(0).field_on_all();
34 for (
const int layer_index : grease_pencil.layers().index_range()) {
35 Drawing *drawing = grease_pencil.get_eval_drawing(grease_pencil.layer(layer_index));
36 if (drawing ==
nullptr) {
68 params.set_output(
"Geometry", std::move(geometry_set));
76 ntype.
ui_name =
"Set Material Index";
77 ntype.
ui_description =
"Set the material index for each selected geometry element";
Low-level operations for curves.
Low-level operations for grease pencil.
#define NODE_CLASS_GEOMETRY
#define GEO_NODE_SET_MATERIAL_INDEX
#define NOD_REGISTER_NODE(REGISTER_FUNC)
MutableAttributeAccessor attributes_for_write()
bke::CurvesGeometry & strokes_for_write()
void node_register_type(bNodeType &ntype)
bool try_capture_field_on_geometry(MutableAttributeAccessor attributes, const fn::FieldContext &field_context, const StringRef attribute_id, AttrDomain domain, const fn::Field< bool > &selection, const fn::GField &field)
void foreach_real_geometry(bke::GeometrySet &geometry, FunctionRef< void(bke::GeometrySet &geometry_set)> fn)
static void node_declare(NodeDeclarationBuilder &b)
static void node_register()
static void set_material_index_in_grease_pencil(GreasePencil &grease_pencil, const Field< bool > &selection, const Field< int > &material_index)
static void node_geo_exec(GeoNodeExecParams params)
void geo_node_type_base(blender::bke::bNodeType *ntype, std::string idname, const std::optional< int16_t > legacy_type)
GreasePencil * get_grease_pencil_for_write()
Mesh * get_mesh_for_write()
std::string ui_description
NodeGeometryExecFunction geometry_node_execute
const char * enum_name_legacy
NodeDeclareFunction declare