Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/geometry/nodes/node_geo_material_selection.cc
| Show First 20 Lines • Show All 94 Lines • ▼ Show 20 Lines | public: | ||||
| bool is_equal_to(const fn::FieldNode &other) const override | bool is_equal_to(const fn::FieldNode &other) const override | ||||
| { | { | ||||
| if (const MaterialSelectionFieldInput *other_material_selection = | if (const MaterialSelectionFieldInput *other_material_selection = | ||||
| dynamic_cast<const MaterialSelectionFieldInput *>(&other)) { | dynamic_cast<const MaterialSelectionFieldInput *>(&other)) { | ||||
| return material_ == other_material_selection->material_; | return material_ == other_material_selection->material_; | ||||
| } | } | ||||
| return false; | return false; | ||||
| } | } | ||||
| std::optional<eAttrDomain> preferred_domain( | |||||
| const GeometryComponent & /*component*/) const override | |||||
| { | |||||
| return ATTR_DOMAIN_FACE; | |||||
| } | |||||
| }; | }; | ||||
| static void node_geo_exec(GeoNodeExecParams params) | static void node_geo_exec(GeoNodeExecParams params) | ||||
| { | { | ||||
| Material *material = params.extract_input<Material *>("Material"); | Material *material = params.extract_input<Material *>("Material"); | ||||
| Field<bool> material_field{std::make_shared<MaterialSelectionFieldInput>(material)}; | Field<bool> material_field{std::make_shared<MaterialSelectionFieldInput>(material)}; | ||||
| params.set_output("Selection", std::move(material_field)); | params.set_output("Selection", std::move(material_field)); | ||||
| } | } | ||||
| Show All 15 Lines | |||||