|
Blender V5.3
|
#include <BKE_geometry_set.hh>
Classes | |
| struct | GatheredAttributes |
Public Types | |
| using | AttributeForeachCallback |
Public Member Functions | |
| template<typename Component> | |
| Component & | get_component_for_write () |
| GeometryComponentPtr | get_component_ptr (GeometryComponent::Type component_type) const |
| template<typename Component> | |
| const Component * | get_component () const |
| template<typename Component> | |
| bool | has () const |
| template<typename Component> | |
| bool | has_component () const |
| template<typename Component> | |
| void | remove () |
| uint64_t | hash () const |
Friends | |
| std::ostream & | operator<< (std::ostream &stream, const GeometrySet &geometry_set) |
| bool | operator== (const GeometrySet &a, const GeometrySet &b) |
A geometry set is a container for multiple kinds of geometry. It does not own geometry directly itself, instead geometry is owned by multiple #GeometryComponents, and the geometry set increases the user count of each component, so they avoid losing the data. This means individual components might be shared between multiple geometries and other code. Shared components are copied automatically when write access is requested.
The components usually do not store data directly, but keep a reference to a data structure defined elsewhere. There is at most one component of each type:
Copying a geometry set is a relatively cheap operation, because it does not copy the referenced geometry components, so GeometrySet can often be passed or moved by value.
Definition at line 151 of file BKE_geometry_set.hh.
Definition at line 263 of file BKE_geometry_set.hh.
|
default |
The methods are defaulted here so that they are not instantiated in every translation unit.
|
default |
|
default |
|
default |
| void blender::bke::GeometrySet::add | ( | const GeometryComponent & | component | ) |
Definition at line 164 of file geometry_set.cc.
| void blender::bke::GeometrySet::attribute_foreach | ( | Span< GeometryComponent::Type > | component_types, |
| bool | include_instances, | ||
| AttributeForeachCallback | callback ) const |
Definition at line 639 of file geometry_set.cc.
| const nodes::Bundle * blender::bke::GeometrySet::bundle | ( | ) | const |
Definition at line 764 of file geometry_set.cc.
Definition at line 779 of file geometry_set.cc.
Definition at line 774 of file geometry_set.cc.
| const nodes::BundlePtr & blender::bke::GeometrySet::bundle_ptr | ( | ) | const |
Definition at line 769 of file geometry_set.cc.
| void blender::bke::GeometrySet::clear | ( | ) |
Remove all geometry components from the geometry set.
Definition at line 265 of file geometry_set.cc.
| std::optional< Bounds< float3 > > blender::bke::GeometrySet::compute_boundbox_without_instances | ( | bool | use_radius = true, |
| bool | use_subdiv = false ) const |
Definition at line 183 of file geometry_set.cc.
| void blender::bke::GeometrySet::copy_bundle_from | ( | const GeometrySet & | other | ) |
Definition at line 787 of file geometry_set.cc.
| void blender::bke::GeometrySet::count_memory | ( | MemoryCounter & | memory | ) | const |
Definition at line 628 of file geometry_set.cc.
Typically, multiple GeometrySet may share the same GeometryComponent. This is fine as long as we can guarantee that the data is read-only. However, if some geometry is available in Python, that guarantee is not possible currently. For that case it can make sense that the GeometrySet is the unique owner of the geometries it contains.
Definition at line 306 of file geometry_set.cc.
Same as ensure_owns_direct_data but also turns object/collection instances into geometry instances so that they can be owned.
Definition at line 286 of file geometry_set.cc.
Make sure that the geometry can be cached. This does not ensure ownership of object/collection instances. This is necessary because sometimes components only have read-only or editing access to their data, which might be freed later if this geometry set outlasts the data.
Definition at line 272 of file geometry_set.cc.
|
static |
Create a new geometry set that only contains the given curves.
Definition at line 448 of file geometry_set.cc.
Referenced by blender::geometry::tests::TEST_F().
|
static |
Create a new geometry set that only contains the given Grease Pencil data.
Definition at line 469 of file geometry_set.cc.
|
static |
Definition at line 455 of file geometry_set.cc.
|
static |
Create a new geometry set that only contains the given instances.
Definition at line 462 of file geometry_set.cc.
Referenced by blender::geometry::join_component_type(), and blender::geometry::tests::TEST_F().
|
static |
Create a new geometry set that only contains the given mesh.
Definition at line 427 of file geometry_set.cc.
|
static |
Create a new geometry set that only contains the given point cloud.
Definition at line 441 of file geometry_set.cc.
|
static |
Create a new geometry set that only contains the given volume.
Definition at line 434 of file geometry_set.cc.
| Vector< GeometryComponent::Type > blender::bke::GeometrySet::gather_component_types | ( | bool | include_instances, |
| bool | ignore_empty ) const |
Definition at line 751 of file geometry_set.cc.
|
inline |
Definition at line 195 of file BKE_geometry_set.hh.
| const GeometryComponent * blender::bke::GeometrySet::get_component | ( | GeometryComponent::Type | component_type | ) | const |
Get the component of the given type. Might return null if the component does not exist yet.
Definition at line 137 of file geometry_set.cc.
|
inline |
Definition at line 180 of file BKE_geometry_set.hh.
| GeometryComponent & blender::bke::GeometrySet::get_component_for_write | ( | GeometryComponent::Type | component_type | ) |
This method can only be used when the geometry set is mutable. It returns a mutable geometry component of the given type.
Definition at line 119 of file geometry_set.cc.
|
inline |
Definition at line 186 of file BKE_geometry_set.hh.
| Vector< const GeometryComponent * > blender::bke::GeometrySet::get_components | ( | ) | const |
Get all geometry components in this geometry set for read-only access.
Definition at line 172 of file geometry_set.cc.
| const CurvesEditHints * blender::bke::GeometrySet::get_curve_edit_hints | ( | ) | const |
Returns read-only curve edit hints or null.
Definition at line 351 of file geometry_set.cc.
Returns mutable curve edit hints or null.
Definition at line 592 of file geometry_set.cc.
| const Curves * blender::bke::GeometrySet::get_curves | ( | ) | const |
Returns a read-only curves data-block or null.
Definition at line 339 of file geometry_set.cc.
Returns a mutable curves data-block or null. No ownership is transferred.
Definition at line 580 of file geometry_set.cc.
| const GizmoEditHints * blender::bke::GeometrySet::get_gizmo_edit_hints | ( | ) | const |
Returns read-only gizmo edit hints or null.
Definition at line 363 of file geometry_set.cc.
Returns mutable gizmo edit hints or null.
Definition at line 612 of file geometry_set.cc.
| const GreasePencil * blender::bke::GeometrySet::get_grease_pencil | ( | ) | const |
Returns a read-only Grease Pencil data-block or null.
Definition at line 369 of file geometry_set.cc.
| const GreasePencilEditHints * blender::bke::GeometrySet::get_grease_pencil_edit_hints | ( | ) | const |
Returns read-only Grease Pencil edit hints or null.
Definition at line 357 of file geometry_set.cc.
Returns mutable Grease Pencil edit hints or null.
Definition at line 602 of file geometry_set.cc.
Returns a mutable Grease Pencil data-block or null. No ownership is transferred.
Definition at line 622 of file geometry_set.cc.
| const Instances * blender::bke::GeometrySet::get_instances | ( | ) | const |
Returns read-only instances or null.
Definition at line 345 of file geometry_set.cc.
Returns mutable instances or null. No ownership is transferred.
Definition at line 586 of file geometry_set.cc.
| const Mesh * blender::bke::GeometrySet::get_mesh | ( | ) | const |
Returns a read-only mesh or null.
Definition at line 315 of file geometry_set.cc.
Returns a mutable mesh or null. No ownership is transferred.
Definition at line 562 of file geometry_set.cc.
| const PointCloud * blender::bke::GeometrySet::get_pointcloud | ( | ) | const |
Returns a read-only point cloud of null.
Definition at line 327 of file geometry_set.cc.
Returns a mutable point cloud or null. No ownership is transferred.
Definition at line 568 of file geometry_set.cc.
| const Volume * blender::bke::GeometrySet::get_volume | ( | ) | const |
Returns a read-only volume or null.
Definition at line 333 of file geometry_set.cc.
Returns a mutable volume or null. No ownership is transferred.
Definition at line 574 of file geometry_set.cc.
|
inline |
Definition at line 202 of file BKE_geometry_set.hh.
| bool blender::bke::GeometrySet::has | ( | const GeometryComponent::Type | component_type | ) | const |
Definition at line 142 of file geometry_set.cc.
| bool blender::bke::GeometrySet::has_bundle | ( | ) | const |
Definition at line 759 of file geometry_set.cc.
|
inline |
Definition at line 208 of file BKE_geometry_set.hh.
| bool blender::bke::GeometrySet::has_curves | ( | ) | const |
Returns true when the geometry set has a curves component that has a curves data-block.
Definition at line 394 of file geometry_set.cc.
| bool blender::bke::GeometrySet::has_grease_pencil | ( | ) | const |
Returns true when the geometry set has a Grease Pencil component that has grease pencil data.
Definition at line 415 of file geometry_set.cc.
| bool blender::bke::GeometrySet::has_instances | ( | ) | const |
Returns true when the geometry set has an instances component that has at least one instance.
Definition at line 381 of file geometry_set.cc.
| bool blender::bke::GeometrySet::has_mesh | ( | ) | const |
Returns true when the geometry set has a mesh component that has a mesh.
Definition at line 321 of file geometry_set.cc.
| bool blender::bke::GeometrySet::has_pointcloud | ( | ) | const |
Returns true when the geometry set has a point cloud component that has a point cloud.
Definition at line 375 of file geometry_set.cc.
| bool blender::bke::GeometrySet::has_realized_data | ( | ) | const |
Returns true when the geometry set has any data that is not an instance.
Definition at line 400 of file geometry_set.cc.
| bool blender::bke::GeometrySet::has_volume | ( | ) | const |
Returns true when the geometry set has a volume component that has a volume.
Definition at line 388 of file geometry_set.cc.
|
inline |
Definition at line 470 of file BKE_geometry_set.hh.
| bool blender::bke::GeometrySet::is_empty | ( | ) | const |
Return true if the geometry set has any component that isn't empty.
Definition at line 421 of file geometry_set.cc.
| void blender::bke::GeometrySet::keep_only | ( | Span< GeometryComponent::Type > | component_types | ) |
Remove all geometry components with types that are not in the provided list.
Definition at line 153 of file geometry_set.cc.
| void blender::bke::GeometrySet::merge_bundle_from | ( | const GeometrySet & | other | ) |
Definition at line 792 of file geometry_set.cc.
| StringRefNull blender::bke::GeometrySet::name | ( | ) | const |
Definition at line 810 of file geometry_set.cc.
|
default |
|
default |
| bool blender::bke::GeometrySet::owns_direct_data | ( | ) | const |
Definition at line 294 of file geometry_set.cc.
|
inline |
Definition at line 215 of file BKE_geometry_set.hh.
| void blender::bke::GeometrySet::remove | ( | const GeometryComponent::Type | component_type | ) |
Definition at line 148 of file geometry_set.cc.
| void blender::bke::GeometrySet::replace_curves | ( | Curves * | curves, |
| GeometryOwnershipType | ownership = GeometryOwnershipType::Owned ) |
Clear the existing curves data-block and replace it with the given one.
Definition at line 491 of file geometry_set.cc.
| void blender::bke::GeometrySet::replace_grease_pencil | ( | GreasePencil * | grease_pencil, |
| GeometryOwnershipType | ownership = GeometryOwnershipType::Owned ) |
Clear the existing Grease Pencil data-block and replace it with the given one.
Definition at line 547 of file geometry_set.cc.
| void blender::bke::GeometrySet::replace_instances | ( | Instances * | instances, |
| GeometryOwnershipType | ownership = GeometryOwnershipType::Owned ) |
Clear the existing instances and replace them with the given one.
Definition at line 505 of file geometry_set.cc.
| void blender::bke::GeometrySet::replace_mesh | ( | Mesh * | mesh, |
| GeometryOwnershipType | ownership = GeometryOwnershipType::Owned ) |
Clear the existing mesh and replace it with the given one.
Definition at line 477 of file geometry_set.cc.
| void blender::bke::GeometrySet::replace_pointcloud | ( | PointCloud * | pointcloud, |
| GeometryOwnershipType | ownership = GeometryOwnershipType::Owned ) |
Clear the existing point cloud and replace with the given one.
Definition at line 519 of file geometry_set.cc.
| void blender::bke::GeometrySet::replace_volume | ( | Volume * | volume, |
| GeometryOwnershipType | ownership = GeometryOwnershipType::Owned ) |
Clear the existing volume and replace with the given one.
Definition at line 533 of file geometry_set.cc.
| void blender::bke::GeometrySet::set_name | ( | std::string | name | ) |
Definition at line 805 of file geometry_set.cc.
|
friend |
Definition at line 211 of file geometry_set.cc.
|
friend |
Definition at line 463 of file BKE_geometry_set.hh.