Differential D15954 Diff 56253 source/blender/nodes/geometry/nodes/node_geo_input_shortest_edge_paths.cc
Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/geometry/nodes/node_geo_input_shortest_edge_paths.cc
| Show First 20 Lines • Show All 137 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 ShortestEdgePathsNextVertFieldInput *other_field = | if (const ShortestEdgePathsNextVertFieldInput *other_field = | ||||
| dynamic_cast<const ShortestEdgePathsNextVertFieldInput *>(&other)) { | dynamic_cast<const ShortestEdgePathsNextVertFieldInput *>(&other)) { | ||||
| return other_field->end_selection_ == end_selection_ && other_field->cost_ == cost_; | return other_field->end_selection_ == end_selection_ && other_field->cost_ == cost_; | ||||
| } | } | ||||
| return false; | return false; | ||||
| } | } | ||||
| std::optional<eAttrDomain> preferred_domain(const Mesh & /*mesh*/) const override | |||||
| { | |||||
| return ATTR_DOMAIN_POINT; | |||||
| } | |||||
| }; | }; | ||||
| class ShortestEdgePathsCostFieldInput final : public bke::MeshFieldInput { | class ShortestEdgePathsCostFieldInput final : public bke::MeshFieldInput { | ||||
| private: | private: | ||||
| Field<bool> end_selection_; | Field<bool> end_selection_; | ||||
| Field<float> cost_; | Field<float> cost_; | ||||
| public: | public: | ||||
| ▲ Show 20 Lines • Show All 47 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 ShortestEdgePathsCostFieldInput *other_field = | if (const ShortestEdgePathsCostFieldInput *other_field = | ||||
| dynamic_cast<const ShortestEdgePathsCostFieldInput *>(&other)) { | dynamic_cast<const ShortestEdgePathsCostFieldInput *>(&other)) { | ||||
| return other_field->end_selection_ == end_selection_ && other_field->cost_ == cost_; | return other_field->end_selection_ == end_selection_ && other_field->cost_ == cost_; | ||||
| } | } | ||||
| return false; | return false; | ||||
| } | } | ||||
| 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) | ||||
| { | { | ||||
| Field<bool> end_selection = params.extract_input<Field<bool>>("End Vertex"); | Field<bool> end_selection = params.extract_input<Field<bool>>("End Vertex"); | ||||
| Field<float> cost = params.extract_input<Field<float>>("Edge Cost"); | Field<float> cost = params.extract_input<Field<float>>("Edge Cost"); | ||||
| Field<int> next_vert_field{ | Field<int> next_vert_field{ | ||||
| Show All 20 Lines | |||||