Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/geometry/nodes/node_geo_input_mesh_island.cc
| Show First 20 Lines • Show All 55 Lines • ▼ Show 20 Lines | uint64_t hash() const override | ||||
| /* Some random constant hash. */ | /* Some random constant hash. */ | ||||
| return 635467354; | return 635467354; | ||||
| } | } | ||||
| bool is_equal_to(const fn::FieldNode &other) const override | bool is_equal_to(const fn::FieldNode &other) const override | ||||
| { | { | ||||
| return dynamic_cast<const IslandFieldInput *>(&other) != nullptr; | return dynamic_cast<const IslandFieldInput *>(&other) != nullptr; | ||||
| } | } | ||||
| std::optional<eAttrDomain> preferred_domain(const Mesh & /*mesh*/) const override | |||||
| { | |||||
| return ATTR_DOMAIN_POINT; | |||||
| } | |||||
| }; | }; | ||||
| class IslandCountFieldInput final : public bke::MeshFieldInput { | class IslandCountFieldInput final : public bke::MeshFieldInput { | ||||
| public: | public: | ||||
| IslandCountFieldInput() : bke::MeshFieldInput(CPPType::get<int>(), "Island Count") | IslandCountFieldInput() : bke::MeshFieldInput(CPPType::get<int>(), "Island Count") | ||||
| { | { | ||||
| category_ = Category::Generated; | category_ = Category::Generated; | ||||
| } | } | ||||
| Show All 23 Lines | uint64_t hash() const override | ||||
| /* Some random hash. */ | /* Some random hash. */ | ||||
| return 45634572457; | return 45634572457; | ||||
| } | } | ||||
| bool is_equal_to(const fn::FieldNode &other) const override | bool is_equal_to(const fn::FieldNode &other) const override | ||||
| { | { | ||||
| return dynamic_cast<const IslandCountFieldInput *>(&other) != nullptr; | return dynamic_cast<const IslandCountFieldInput *>(&other) != nullptr; | ||||
| } | } | ||||
| std::optional<eAttrDomain> preferred_domain(const Mesh & /*mesh*/) const override | |||||
| { | |||||
| return ATTR_DOMAIN_POINT; | |||||
| } | |||||
| }; | }; | ||||
| static void node_geo_exec(GeoNodeExecParams params) | static void node_geo_exec(GeoNodeExecParams params) | ||||
| { | { | ||||
| if (params.output_is_required("Island Index")) { | if (params.output_is_required("Island Index")) { | ||||
| Field<int> field{std::make_shared<IslandFieldInput>()}; | Field<int> field{std::make_shared<IslandFieldInput>()}; | ||||
| params.set_output("Island Index", std::move(field)); | params.set_output("Island Index", std::move(field)); | ||||
| } | } | ||||
| Show All 18 Lines | |||||