25 b.add_input<
decl::Bool>(
N_(
"Selection")).default_value(
true).hide_value().supports_field();
38 int new_material_index = -1;
42 new_material_index = i;
46 if (new_material_index == -1) {
53 for (
const int i : selection) {
55 poly.
mat_nr = new_material_index;
67 bool point_selection_warning =
false;
68 bool volume_selection_warning =
false;
69 bool curves_selection_warning =
false;
71 geometry_set.modify_geometry_sets([&](
GeometrySet &geometry_set) {
72 if (geometry_set.has_mesh()) {
78 selection_evaluator.add(selection_field);
79 selection_evaluator.evaluate();
80 const IndexMask selection = selection_evaluator.get_evaluated_as_mask(0);
84 if (
Volume *volume = geometry_set.get_volume_for_write()) {
86 if (selection_field.node().depends_on_input()) {
87 volume_selection_warning =
true;
90 if (
PointCloud *pointcloud = geometry_set.get_pointcloud_for_write()) {
92 if (selection_field.node().depends_on_input()) {
93 point_selection_warning =
true;
96 if (
Curves *
curves = geometry_set.get_curves_for_write()) {
98 if (selection_field.node().depends_on_input()) {
99 curves_selection_warning =
true;
104 if (volume_selection_warning) {
107 TIP_(
"Volumes only support a single material; selection input can not be a field"));
109 if (point_selection_warning) {
112 TIP_(
"Point clouds only support a single material; selection input can not be a field"));
114 if (curves_selection_warning) {
117 TIP_(
"Curves only support a single material; selection input can not be a field"));
120 params.set_output(
"Geometry", std::move(geometry_set));
void * CustomData_duplicate_referenced_layer(struct CustomData *data, int type, int totelem)
@ GEO_COMPONENT_TYPE_MESH
@ GEO_COMPONENT_TYPE_POINT_CLOUD
@ GEO_COMPONENT_TYPE_CURVE
@ GEO_COMPONENT_TYPE_VOLUME
General operations, lookup, etc. for materials.
void BKE_id_material_eval_ensure_default_slot(struct ID *id)
void BKE_id_material_eval_assign(struct ID *id, int slot, struct Material *material)
#define NODE_CLASS_GEOMETRY
#define GEO_NODE_SET_MATERIAL
void nodeRegisterType(struct bNodeType *ntype)
in reality light always falls off quadratically Particle Info
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to curves
static void assign_material_to_faces(Mesh &mesh, const IndexMask selection, Material *material)
static void node_geo_exec(GeoNodeExecParams params)
static void node_declare(NodeDeclarationBuilder &b)
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
void register_node_type_geo_set_material()
void geo_node_type_base(bNodeType *ntype, int type, const char *name, short nclass)
NodeGeometryExecFunction geometry_node_execute
NodeDeclareFunction declare