Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/geometry/nodes/node_geo_material_assign.cc
| Show All 24 Lines | |||||
| #include "BKE_material.h" | #include "BKE_material.h" | ||||
| namespace blender::nodes { | namespace blender::nodes { | ||||
| static void geo_node_material_assign_declare(NodeDeclarationBuilder &b) | static void geo_node_material_assign_declare(NodeDeclarationBuilder &b) | ||||
| { | { | ||||
| b.add_input<decl::Geometry>("Geometry"); | b.add_input<decl::Geometry>("Geometry"); | ||||
| b.add_input<decl::Material>("Material").hide_label(); | b.add_input<decl::Material>("Material").hide_label(); | ||||
| b.add_input<decl::Bool>("Selection").default_value(true).hide_value(); | b.add_input<decl::Bool>("Selection").default_value(true).hide_value().supports_field(); | ||||
| b.add_output<decl::Geometry>("Geometry"); | b.add_output<decl::Geometry>("Geometry"); | ||||
| } | } | ||||
| 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) | ||||
| { | { | ||||
| int new_material_index = -1; | int new_material_index = -1; | ||||
| for (const int i : IndexRange(mesh.totcol)) { | for (const int i : IndexRange(mesh.totcol)) { | ||||
| Material *other_material = mesh.mat[i]; | Material *other_material = mesh.mat[i]; | ||||
| ▲ Show 20 Lines • Show All 57 Lines • Show Last 20 Lines | |||||