Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/geometry/nodes/node_geo_set_material_index.cc
| Show All 14 Lines | |||||
| */ | */ | ||||
| #include "node_geometry_util.hh" | #include "node_geometry_util.hh" | ||||
| namespace blender::nodes { | namespace blender::nodes { | ||||
| static void geo_node_set_material_index_declare(NodeDeclarationBuilder &b) | static void geo_node_set_material_index_declare(NodeDeclarationBuilder &b) | ||||
| { | { | ||||
| b.add_input<decl::Geometry>("Geometry").supported_type(GEO_COMPONENT_TYPE_MESH); | b.add_input<decl::Geometry>(N_("Geometry")).supported_type(GEO_COMPONENT_TYPE_MESH); | ||||
| b.add_input<decl::Bool>("Selection").default_value(true).hide_value().supports_field(); | b.add_input<decl::Bool>(N_("Selection")).default_value(true).hide_value().supports_field(); | ||||
| b.add_input<decl::Int>("Material Index").supports_field().min(0); | b.add_input<decl::Int>(N_("Material Index")).supports_field().min(0); | ||||
| b.add_output<decl::Geometry>("Geometry"); | b.add_output<decl::Geometry>(N_("Geometry")); | ||||
| } | } | ||||
| static void set_material_index_in_component(GeometryComponent &component, | static void set_material_index_in_component(GeometryComponent &component, | ||||
| const Field<bool> &selection_field, | const Field<bool> &selection_field, | ||||
| const Field<int> &index_field) | const Field<int> &index_field) | ||||
| { | { | ||||
| GeometryComponentFieldContext field_context{component, ATTR_DOMAIN_FACE}; | GeometryComponentFieldContext field_context{component, ATTR_DOMAIN_FACE}; | ||||
| const int domain_size = component.attribute_domain_size(ATTR_DOMAIN_FACE); | const int domain_size = component.attribute_domain_size(ATTR_DOMAIN_FACE); | ||||
| ▲ Show 20 Lines • Show All 44 Lines • Show Last 20 Lines | |||||