|
Blender V5.3
|
Classes | |
| class | IndexMapping |
| struct | AttributeComponents |
Enumerations | |
| enum class | GeoMismatch : int8_t { NumPoints , NumEdges , NumCorners , NumFaces , NumCurves , PointAttributes , EdgeAttributes , CornerAttributes , FaceAttributes , CurveAttributes , LayerAttributes , EdgeTopology , FaceTopology , CurveTopology , Attributes , AttributeTypes , Indices , NumLayers , NumFrames , LayerOrder , Frames } |
Functions | |
| const char * | mismatch_to_string (const GeoMismatch &mismatch) |
| std::optional< GeoMismatch > | compare_meshes (const Mesh &mesh1, const Mesh &mesh2, float threshold) |
| Checks if the two meshes are different, returning the type of mismatch if any. Changes in index order are detected, but treated as a mismatch. | |
| std::optional< GeoMismatch > | compare_curves (const CurvesGeometry &curves1, const CurvesGeometry &curves2, float threshold) |
| Checks if the two curves geometries are different, returning the type of mismatch if any. Changes in index order are detected, but treated as a mismatch. | |
| std::optional< GeoMismatch > | compare_lattices (const Lattice &lattice1, const Lattice &lattice2, float threshold) |
| Checks if the two lattices are different, returning the type of mismatch if any. | |
| std::optional< GeoMismatch > | compare_grease_pencil (const GreasePencil &grease_pencil_1, const GreasePencil &grease_pencil_2, float threshold) |
| Checks if two Grease Pencil geometries are different, returning the type of mismatch if any. | |
| template<typename T> | |
| static void | sort_indices (MutableSpan< int > indices, const Span< T > values) |
| static void | sort_indices_with_id_maps (MutableSpan< int > indices, const Span< int > values, const Span< int > values_to_sorted, const Span< int > set_ids) |
| template<typename T> | |
| static void | sort_per_set_based_on_attributes (const Span< int > set_sizes, MutableSpan< int > sorted_to_domain1, MutableSpan< int > sorted_to_domain2, const Span< T > values1, const Span< T > values2) |
| static void | sort_per_set_with_id_maps (const Span< int > set_sizes, const Span< int > values1, const Span< int > values2, const Span< int > values1_to_sorted, const Span< int > values2_to_sorted, const Span< int > value_set_ids, MutableSpan< int > sorted_to_domain1, MutableSpan< int > sorted_to_domain2) |
| template<typename T> | |
| static bool | values_different (const T value1, const T value2, const float threshold) |
| template<typename T> | |
| static bool | update_set_ids (StringRef name, MutableSpan< int > set_ids, const Span< T > values1, const Span< T > values2, const Span< int > sorted_to_values1, const Span< int > sorted_to_values2, const float threshold) |
| static bool | update_set_ids_with_id_maps (MutableSpan< int > set_ids, const Span< int > domain_to_values1, const Span< int > domain_to_values2, const Span< int > values1_to_sorted, const Span< int > values2_to_sorted, const Span< int > value_set_ids, const Span< int > sorted_to_domain1, const Span< int > sorted_to_domain2) |
| static void | update_set_sizes (const Span< int > set_ids, MutableSpan< int > set_sizes) |
| static void | edges_from_vert_sets (const Span< int2 > edges, const Span< int > verts_to_sorted, const Span< int > vert_set_ids, MutableSpan< OrderedEdge > r_edges) |
| static bool | sort_edges (const Span< int2 > edges1, const Span< int2 > edges2, const IndexMapping &verts, IndexMapping &edges) |
| static bool | sort_corners_based_on_domain (const Span< int > corner_domain1, const Span< int > corner_domain2, const IndexMapping &domain, IndexMapping &corners) |
| static void | calc_smallest_corner_ids (const Span< int > face_offsets, const Span< int > corners_to_sorted, const Span< int > corner_set_ids, MutableSpan< int > smallest_corner_ids) |
| static bool | sort_faces_based_on_corners (const IndexMapping &corners, const Span< int > face_offsets1, const Span< int > face_offsets2, IndexMapping &faces) |
| static bool | ignored_attribute (const StringRef name) |
| static std::optional< GeoMismatch > | verify_attributes_compatible (const AttributeAccessor &attributes1, const AttributeAccessor &attributes2) |
| static std::optional< AttributeComponents > | get_attribute_components (const AttrType type) |
| template<typename T, typename ComponentT> | |
| static void | gather_component (const GSpan values, const int components_num, const int component, MutableSpan< ComponentT > dst) |
| template<typename Fn> | |
| static void | to_static_int_component_type (const AttrType type, Fn &&fn) |
| template<typename T> | |
| static bool | sort_using_values (const StringRef name, const Span< T > values1, const Span< T > values2, const float threshold, IndexMapping &maps) |
| static GeoMismatch | attribute_mismatch_for_domain (const AttrDomain domain) |
| static std::optional< GeoMismatch > | sort_domain_using_attributes (const AttributeAccessor &attributes1, const AttributeAccessor &attributes2, const AttrDomain domain, const Span< StringRef > excluded_attributes, IndexMapping &maps, const float threshold) |
| static void | make_set_sizes_one (IndexMapping &indices) |
| static bool | all_set_sizes_one (const Span< int > set_sizes) |
| static std::optional< GeoMismatch > | construct_vert_mapping (const Mesh &mesh1, const Mesh &mesh2, IndexMapping &verts, IndexMapping &edges) |
| static bool | sort_curves (const OffsetIndices< int > offset_indices1, const OffsetIndices< int > offset_indices2, IndexMapping &curves) |
| static std::optional< GeoMismatch > | compare_grease_pencil_layer (const GreasePencil &grease_pencil_1, const GreasePencil &grease_pencil_2, const greasepencil::Layer &layer_1, const greasepencil::Layer &layer_2, const float threshold) |
Variables | |
| static CLG_LogRef | LOG = {"geometry.compare"} |
|
strong |
Definition at line 35 of file geometry_compare.cc.
|
static |
Definition at line 757 of file geometry_compare.cc.
References all_set_sizes_one().
Referenced by all_set_sizes_one(), and construct_vert_mapping().
|
static |
Definition at line 632 of file geometry_compare.cc.
References attribute_mismatch_for_domain(), Attributes, BLI_assert_unreachable, blender::bke::Corner, CornerAttributes, blender::bke::Curve, CurveAttributes, blender::bke::Edge, EdgeAttributes, blender::bke::Face, FaceAttributes, blender::bke::Layer, LayerAttributes, blender::bke::Point, and PointAttributes.
Referenced by attribute_mismatch_for_domain(), and sort_domain_using_attributes().
|
static |
Definition at line 421 of file geometry_compare.cc.
References calc_smallest_corner_ids(), blender::MutableSpan< T >::index_range(), and blender::IndexRange::IndexRange().
Referenced by calc_smallest_corner_ids(), and sort_faces_based_on_corners().
| std::optional< GeoMismatch > blender::bke::compare_geometry::compare_curves | ( | const CurvesGeometry & | curves1, |
| const CurvesGeometry & | curves2, | ||
| float | threshold ) |
Checks if the two curves geometries are different, returning the type of mismatch if any. Changes in index order are detected, but treated as a mismatch.
Definition at line 1046 of file geometry_compare.cc.
References blender::bke::CurvesGeometry::attributes(), compare_curves(), blender::bke::Curve, blender::bke::CurvesGeometry::curves_num(), CurveTopology, blender::bke::compare_geometry::IndexMapping::from_sorted1, blender::bke::compare_geometry::IndexMapping::from_sorted2, blender::Array< T, InlineBufferCapacity, Allocator >::index_range(), Indices, NumCurves, NumPoints, blender::bke::CurvesGeometry::offsets(), blender::bke::Point, blender::bke::CurvesGeometry::points_num(), sort_curves(), sort_domain_using_attributes(), and verify_attributes_compatible().
Referenced by compare_curves(), and compare_grease_pencil_layer().
| std::optional< GeoMismatch > blender::bke::compare_geometry::compare_grease_pencil | ( | const GreasePencil & | grease_pencil_1, |
| const GreasePencil & | grease_pencil_2, | ||
| float | threshold ) |
Checks if two Grease Pencil geometries are different, returning the type of mismatch if any.
Definition at line 1182 of file geometry_compare.cc.
References compare_grease_pencil(), compare_grease_pencil_layer(), blender::bke::compare_geometry::IndexMapping::from_sorted1, blender::bke::compare_geometry::IndexMapping::from_sorted2, blender::Array< T, InlineBufferCapacity, Allocator >::index_range(), blender::Span< T >::index_range(), blender::bke::Layer, layer, LayerOrder, NumLayers, blender::Span< T >::size(), sort_domain_using_attributes(), and verify_attributes_compatible().
Referenced by compare_grease_pencil().
|
static |
Definition at line 1132 of file geometry_compare.cc.
References compare_curves(), compare_grease_pencil_layer(), blender::bke::greasepencil::Layer::frame_at(), Frames, blender::bke::greasepencil::Layer::frames(), blender::Span< T >::index_range(), LayerOrder, NumFrames, blender::bke::greasepencil::Layer::sorted_keys(), and blender::bke::greasepencil::Drawing::strokes().
Referenced by compare_grease_pencil(), and compare_grease_pencil_layer().
| std::optional< GeoMismatch > blender::bke::compare_geometry::compare_lattices | ( | const Lattice & | lattice1, |
| const Lattice & | lattice2, | ||
| float | threshold ) |
Checks if the two lattices are different, returning the type of mismatch if any.
Definition at line 1101 of file geometry_compare.cc.
References compare_lattices(), blender::Lattice::def, blender::IndexRange::IndexRange(), NumPoints, blender::Lattice::pntsu, blender::Lattice::pntsv, blender::Lattice::pntsw, PointAttributes, and values_different().
Referenced by compare_lattices().
| std::optional< GeoMismatch > blender::bke::compare_geometry::compare_meshes | ( | const Mesh & | mesh1, |
| const Mesh & | mesh2, | ||
| float | threshold ) |
Checks if the two meshes are different, returning the type of mismatch if any. Changes in index order are detected, but treated as a mismatch.
Instead of just blindly comparing the two meshes, the code tries to determine if they are isomorphic. Two meshes are considered isomorphic, if, for each domain, there is a bijection between the two meshes such that the bijections preserve connectivity.
In general, determining if two graphs are isomorphic is a very difficult problem (no polynomial time algorithm is known). Because we have more information than just connectivity (attributes), we can compute it in a more reasonable time in most cases.
Definition at line 872 of file geometry_compare.cc.
References compare_meshes(), construct_vert_mapping(), blender::bke::Corner, blender::Mesh::corners_num, blender::bke::Edge, blender::Mesh::edges_num, EdgeTopology, blender::bke::Face, blender::Mesh::faces_num, FaceTopology, blender::bke::compare_geometry::IndexMapping::from_sorted1, blender::bke::compare_geometry::IndexMapping::from_sorted2, blender::Array< T, InlineBufferCapacity, Allocator >::index_range(), Indices, make_set_sizes_one(), NumCorners, NumEdges, NumFaces, NumPoints, blender::bke::Point, blender::bke::compare_geometry::IndexMapping::recalculate_inverse_maps(), sort_corners_based_on_domain(), sort_domain_using_attributes(), sort_edges(), sort_faces_based_on_corners(), verify_attributes_compatible(), and blender::Mesh::verts_num.
Referenced by compare_meshes().
|
static |
Tries to construct a (bijective) mapping from the vertices of the first mesh to the vertices of the second mesh, such that:
Definition at line 779 of file geometry_compare.cc.
References all_set_sizes_one(), blender::Vector< T, InlineBufferCapacity, Allocator >::append(), blender::BLI_assert(), blender::bke::mesh::build_vert_to_edge_map(), construct_vert_mapping(), EdgeTopology, blender::Vector< T, InlineBufferCapacity, Allocator >::first(), blender::bke::compare_geometry::IndexMapping::from_sorted1, blender::bke::compare_geometry::IndexMapping::from_sorted2, blender::Array< T, InlineBufferCapacity, Allocator >::index_range(), blender::IndexRange::IndexRange(), blender::Vector< T, InlineBufferCapacity, Allocator >::is_empty(), blender::bke::compare_geometry::IndexMapping::recalculate_inverse_maps(), blender::bke::compare_geometry::IndexMapping::set_ids, blender::bke::compare_geometry::IndexMapping::set_sizes, blender::Span< T >::size(), blender::bke::compare_geometry::IndexMapping::to_sorted1, blender::bke::compare_geometry::IndexMapping::to_sorted2, and blender::Mesh::verts_num.
Referenced by compare_meshes(), and construct_vert_mapping().
|
static |
Definition at line 346 of file geometry_compare.cc.
References blender::e, edges_from_vert_sets(), blender::MutableSpan< T >::index_range(), and blender::OrderedEdge::OrderedEdge().
Referenced by edges_from_vert_sets(), and sort_edges().
|
static |
Definition at line 577 of file geometry_compare.cc.
References blender::data, blender::GSpan::data(), gather_component(), blender::MutableSpan< T >::index_range(), and T.
Referenced by gather_component(), and sort_domain_using_attributes().
|
static |
Definition at line 545 of file geometry_compare.cc.
References BLI_assert_unreachable, blender::bke::Bool, blender::bke::ColorByte, blender::bke::ColorFloat, blender::bke::Float, blender::bke::Float2, blender::bke::Float3, blender::bke::Float4, blender::bke::Float4x4, get_attribute_components(), blender::bke::Int16_2D, blender::bke::Int32, blender::bke::Int32_2D, blender::bke::Int8, blender::bke::Quaternion, and blender::bke::String.
Referenced by get_attribute_components(), and sort_domain_using_attributes().
|
static |
The UV selection & pin layers are ignored in the comparisons because the original flags they replace were ignored as well. Because of the lazy creation of these layers it would need careful handling of the test files to compare these layers. For now it has been decided to skip them.
Definition at line 480 of file geometry_compare.cc.
References blender::bke::attribute_name_is_anonymous(), ELEM, ignored_attribute(), and blender::blender::StringRefBase::startswith().
Referenced by ignored_attribute(), sort_domain_using_attributes(), and verify_attributes_compatible().
|
static |
Definition at line 729 of file geometry_compare.cc.
References blender::bke::compare_geometry::IndexMapping::from_sorted1, blender::bke::compare_geometry::IndexMapping::from_sorted2, blender::Array< T, InlineBufferCapacity, Allocator >::index_range(), blender::IndexRange::IndexRange(), make_set_sizes_one(), blender::bke::compare_geometry::IndexMapping::set_ids, and blender::bke::compare_geometry::IndexMapping::set_sizes.
Referenced by compare_meshes(), and make_set_sizes_one().
| const char * blender::bke::compare_geometry::mismatch_to_string | ( | const GeoMismatch & | mismatch | ) |
Convert the mismatch to a human-readable string for display.
Definition at line 59 of file geometry_compare.cc.
References Attributes, AttributeTypes, BLI_assert_unreachable, CornerAttributes, CurveAttributes, CurveTopology, EdgeAttributes, EdgeTopology, FaceAttributes, FaceTopology, Frames, Indices, LayerAttributes, LayerOrder, mismatch_to_string(), NumCorners, NumCurves, NumEdges, NumFaces, NumFrames, NumLayers, NumPoints, and PointAttributes.
Referenced by mismatch_to_string().
|
static |
Sort the corners based on the sorted vertex/edge set ids.
Definition at line 393 of file geometry_compare.cc.
References blender::bke::compare_geometry::IndexMapping::set_ids, sort_corners_based_on_domain(), sort_per_set_with_id_maps(), blender::bke::compare_geometry::IndexMapping::to_sorted1, blender::bke::compare_geometry::IndexMapping::to_sorted2, update_set_ids_with_id_maps(), and update_set_sizes().
Referenced by compare_meshes(), and sort_corners_based_on_domain().
|
static |
Sort curves based on their sizes.
Definition at line 1017 of file geometry_compare.cc.
References blender::Array< T, InlineBufferCapacity, Allocator >::as_mutable_span(), blender::Array< T, InlineBufferCapacity, Allocator >::as_span(), blender::offset_indices::copy_group_sizes(), blender::offset_indices::OffsetIndices< T >::index_range(), blender::offset_indices::OffsetIndices< T >::size(), sort_curves(), sort_per_set_based_on_attributes(), update_set_ids(), and update_set_sizes().
Referenced by compare_curves(), and sort_curves().
|
static |
Sort the domain using all the attributes on that domain except the ones in excluded_attributes
Definition at line 658 of file geometry_compare.cc.
References blender::bke::AttributeAccessor::all_names(), blender::Array< T, InlineBufferCapacity, Allocator >::as_mutable_span(), blender::Array< T, InlineBufferCapacity, Allocator >::as_span(), attribute_mismatch_for_domain(), blender::bke::cpp_type_to_attribute_type(), blender::bke::GAttributeReader::domain, gather_component(), get_attribute_components(), ignored_attribute(), blender::IndexRange::IndexRange(), blender::bke::AttributeAccessor::lookup(), blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::remove_as(), blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::remove_if(), blender::GSpan::size(), sort_domain_using_attributes(), sort_using_values(), T, to_static_int_component_type(), blender::GVArrayCommon::type(), and blender::bke::GAttributeReader::varray.
Referenced by compare_curves(), compare_grease_pencil(), compare_meshes(), and sort_domain_using_attributes().
|
static |
Sort the edges based on the sorted vertex set ids.
Definition at line 361 of file geometry_compare.cc.
References blender::Array< T, InlineBufferCapacity, Allocator >::as_span(), edges_from_vert_sets(), blender::bke::compare_geometry::IndexMapping::from_sorted1, blender::bke::compare_geometry::IndexMapping::from_sorted2, blender::bke::compare_geometry::IndexMapping::set_ids, blender::bke::compare_geometry::IndexMapping::set_sizes, blender::Span< T >::size(), sort_edges(), sort_per_set_based_on_attributes(), blender::bke::compare_geometry::IndexMapping::to_sorted1, blender::bke::compare_geometry::IndexMapping::to_sorted2, update_set_ids(), and update_set_sizes().
Referenced by compare_meshes(), and sort_edges().
|
static |
Sort the faces using the sorted corner set ids.
Definition at line 442 of file geometry_compare.cc.
References blender::Array< T, InlineBufferCapacity, Allocator >::as_span(), calc_smallest_corner_ids(), blender::bke::compare_geometry::IndexMapping::from_sorted1, blender::bke::compare_geometry::IndexMapping::from_sorted2, blender::bke::compare_geometry::IndexMapping::set_ids, blender::bke::compare_geometry::IndexMapping::set_sizes, blender::Array< T, InlineBufferCapacity, Allocator >::size(), sort_faces_based_on_corners(), sort_per_set_based_on_attributes(), update_set_ids(), and update_set_sizes().
Referenced by compare_meshes(), and sort_faces_based_on_corners().
|
static |
Sort the indices using the values.
Definition at line 155 of file geometry_compare.cc.
References blender::MutableSpan< T >::begin(), blender::MutableSpan< T >::end(), and sort_indices().
Referenced by sort_indices(), and sort_per_set_based_on_attributes().
|
static |
Sort the indices using the set ids of the values.
Definition at line 165 of file geometry_compare.cc.
References blender::MutableSpan< T >::begin(), blender::MutableSpan< T >::end(), and sort_indices_with_id_maps().
Referenced by sort_indices_with_id_maps(), and sort_per_set_with_id_maps().
|
static |
Definition at line 177 of file geometry_compare.cc.
References blender::Span< T >::size(), blender::MutableSpan< T >::slice(), sort_indices(), and sort_per_set_based_on_attributes().
Referenced by sort_curves(), sort_edges(), sort_faces_based_on_corners(), sort_per_set_based_on_attributes(), and sort_using_values().
|
static |
Definition at line 199 of file geometry_compare.cc.
References blender::MutableSpan< T >::size(), blender::MutableSpan< T >::slice(), sort_indices_with_id_maps(), and sort_per_set_with_id_maps().
Referenced by sort_corners_based_on_domain(), and sort_per_set_with_id_maps().
|
static |
Definition at line 615 of file geometry_compare.cc.
References blender::bke::compare_geometry::IndexMapping::from_sorted1, blender::bke::compare_geometry::IndexMapping::from_sorted2, blender::bke::compare_geometry::IndexMapping::set_ids, blender::bke::compare_geometry::IndexMapping::set_sizes, sort_per_set_based_on_attributes(), sort_using_values(), update_set_ids(), and update_set_sizes().
Referenced by sort_domain_using_attributes(), and sort_using_values().
|
static |
Call the function with the scalar type of an integer attribute type's components.
Definition at line 589 of file geometry_compare.cc.
References BLI_assert_unreachable, blender::bke::Bool, blender::bke::ColorByte, blender::bke::Int16_2D, blender::bke::Int32, blender::bke::Int32_2D, blender::bke::Int8, and to_static_int_component_type().
Referenced by sort_domain_using_attributes(), and to_static_int_component_type().
|
static |
Split the sets into smaller sets based on the sorted attribute values.
Definition at line 250 of file geometry_compare.cc.
References blender::Span< T >::index_range(), blender::MutableSpan< T >::is_empty(), T, update_set_ids(), and values_different().
Referenced by sort_curves(), sort_edges(), sort_faces_based_on_corners(), sort_using_values(), and update_set_ids().
|
static |
Split the sets into smaller sets based on the set ids of the sorted values.
Definition at line 294 of file geometry_compare.cc.
References blender::Span< T >::index_range(), blender::MutableSpan< T >::is_empty(), and update_set_ids_with_id_maps().
Referenced by sort_corners_based_on_domain(), and update_set_ids_with_id_maps().
|
static |
Update set sizes, using the updated set ids.
Definition at line 331 of file geometry_compare.cc.
References blender::Span< T >::size(), and update_set_sizes().
Referenced by sort_corners_based_on_domain(), sort_curves(), sort_edges(), sort_faces_based_on_corners(), sort_using_values(), and update_set_sizes().
|
static |
Checks if the two values are different. For floats, the equality is checked based on a threshold.
Definition at line 234 of file geometry_compare.cc.
References blender::compare_threshold_relative(), T, and values_different().
Referenced by compare_lattices(), update_set_ids(), and values_different().
|
static |
Verify that both geometries have the same attributes:
Definition at line 492 of file geometry_compare.cc.
References blender::bke::AttributeAccessor::all_names(), Attributes, AttributeTypes, CLOG_WARN, blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::contains(), blender::bke::GAttributeReader::domain, ignored_attribute(), LOG, blender::bke::AttributeAccessor::lookup(), blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::remove_if(), blender::GVArrayCommon::type(), blender::bke::GAttributeReader::varray, and verify_attributes_compatible().
Referenced by compare_curves(), compare_grease_pencil(), compare_meshes(), and verify_attributes_compatible().
|
static |
Definition at line 33 of file geometry_compare.cc.
Referenced by verify_attributes_compatible().