Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/geometry/nodes/node_geo_set_material.cc
| Show All 17 Lines | |||||
| static void node_declare(NodeDeclarationBuilder &b) | static void node_declare(NodeDeclarationBuilder &b) | ||||
| { | { | ||||
| b.add_input<decl::Geometry>(N_("Geometry")) | b.add_input<decl::Geometry>(N_("Geometry")) | ||||
| .supported_type({GEO_COMPONENT_TYPE_MESH, | .supported_type({GEO_COMPONENT_TYPE_MESH, | ||||
| GEO_COMPONENT_TYPE_VOLUME, | GEO_COMPONENT_TYPE_VOLUME, | ||||
| GEO_COMPONENT_TYPE_POINT_CLOUD, | GEO_COMPONENT_TYPE_POINT_CLOUD, | ||||
| GEO_COMPONENT_TYPE_CURVE}); | GEO_COMPONENT_TYPE_CURVE}); | ||||
| b.add_input<decl::Bool>(N_("Selection")).default_value(true).hide_value().supports_field(); | b.add_input<decl::Bool>(N_("Selection")).default_value(true).hide_value().field_on_all(); | ||||
| b.add_input<decl::Material>(N_("Material")).hide_label(); | b.add_input<decl::Material>(N_("Material")).hide_label(); | ||||
| b.add_output<decl::Geometry>(N_("Geometry")); | b.add_output<decl::Geometry>(N_("Geometry")).propagate_all(); | ||||
| } | } | ||||
| static void assign_material_to_faces(Mesh &mesh, const IndexMask selection, Material *material) | static void assign_material_to_faces(Mesh &mesh, const IndexMask selection, Material *material) | ||||
| { | { | ||||
| if (selection.size() != mesh.totpoly) { | if (selection.size() != mesh.totpoly) { | ||||
| /* If the entire mesh isn't selected, and there is no material slot yet, add an empty | /* If the entire mesh isn't selected, and there is no material slot yet, add an empty | ||||
| * slot so that the faces that aren't selected can still refer to the default material. */ | * slot so that the faces that aren't selected can still refer to the default material. */ | ||||
| BKE_id_material_eval_ensure_default_slot(&mesh.id); | BKE_id_material_eval_ensure_default_slot(&mesh.id); | ||||
| ▲ Show 20 Lines • Show All 100 Lines • Show Last 20 Lines | |||||