|
Blender V4.5
|
#include <BKE_geometry_set.hh>
Public Types | |
| using | AttributeForeachCallback |
| using | ForeachSubGeometryCallback = FunctionRef<void(GeometrySet &geometry_set)> |
Public Member Functions | |
| template<typename Component> | |
| Component & | get_component_for_write () |
| 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 |
Public Attributes | |
| std::string | name |
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 145 of file BKE_geometry_set.hh.
Definition at line 257 of file BKE_geometry_set.hh.
| using blender::bke::GeometrySet::ForeachSubGeometryCallback = FunctionRef<void(GeometrySet &geometry_set)> |
Definition at line 275 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 180 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 645 of file geometry_set.cc.
| void blender::bke::GeometrySet::clear | ( | ) |
Remove all geometry components from the geometry set.
Definition at line 281 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 199 of file geometry_set.cc.
| void blender::bke::GeometrySet::count_memory | ( | MemoryCounter & | memory | ) | const |
Definition at line 634 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 322 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 302 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 288 of file geometry_set.cc.
|
static |
Create a new geometry set that only contains the given curves.
Definition at line 461 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 475 of file geometry_set.cc.
|
static |
Create a new geometry set that only contains the given instances.
Definition at line 468 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 440 of file geometry_set.cc.
|
static |
Create a new geometry set that only contains the given point cloud.
Definition at line 454 of file geometry_set.cc.
|
static |
Create a new geometry set that only contains the given volume.
Definition at line 447 of file geometry_set.cc.
| void blender::bke::GeometrySet::gather_attributes_for_propagation | ( | Span< GeometryComponent::Type > | component_types, |
| GeometryComponent::Type | dst_component_type, | ||
| bool | include_instances, | ||
| const AttributeFilter & | attribute_filter, | ||
| Map< StringRef, AttributeDomainAndType > & | r_attributes ) const |
Definition at line 717 of file geometry_set.cc.
| Vector< GeometryComponent::Type > blender::bke::GeometrySet::gather_component_types | ( | bool | include_instances, |
| bool | ignore_empty ) const |
Definition at line 791 of file geometry_set.cc.
|
inline |
Definition at line 183 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 140 of file geometry_set.cc.
|
inline |
Definition at line 173 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 113 of file geometry_set.cc.
| Vector< const GeometryComponent * > blender::bke::GeometrySet::get_components | ( | ) | const |
Get all geometry components in this geometry set for read-only access.
Definition at line 188 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 367 of file geometry_set.cc.
| CurvesEditHints * blender::bke::GeometrySet::get_curve_edit_hints_for_write | ( | ) |
Returns mutable curve edit hints or null.
Definition at line 598 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 355 of file geometry_set.cc.
Returns a mutable curves data-block or null. No ownership is transferred.
Definition at line 586 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 379 of file geometry_set.cc.
| GizmoEditHints * blender::bke::GeometrySet::get_gizmo_edit_hints_for_write | ( | ) |
Returns mutable gizmo edit hints or null.
Definition at line 618 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 385 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 373 of file geometry_set.cc.
| GreasePencilEditHints * blender::bke::GeometrySet::get_grease_pencil_edit_hints_for_write | ( | ) |
Returns mutable Grease Pencil edit hints or null.
Definition at line 608 of file geometry_set.cc.
Returns a mutable Grease Pencil data-block or null. No ownership is transferred.
Definition at line 628 of file geometry_set.cc.
| const Instances * blender::bke::GeometrySet::get_instances | ( | ) | const |
Returns read-only instances or null.
Definition at line 361 of file geometry_set.cc.
Returns mutable instances or null. No ownership is transferred.
Definition at line 592 of file geometry_set.cc.
| const Mesh * blender::bke::GeometrySet::get_mesh | ( | ) | const |
Returns a read-only mesh or null.
Definition at line 331 of file geometry_set.cc.
Returns a mutable mesh or null. No ownership is transferred.
Definition at line 568 of file geometry_set.cc.
| const PointCloud * blender::bke::GeometrySet::get_pointcloud | ( | ) | const |
Returns a read-only point cloud of null.
Definition at line 343 of file geometry_set.cc.
Returns a mutable point cloud or null. No ownership is transferred.
Definition at line 574 of file geometry_set.cc.
| const Volume * blender::bke::GeometrySet::get_volume | ( | ) | const |
Returns a read-only volume or null.
Definition at line 349 of file geometry_set.cc.
Returns a mutable volume or null. No ownership is transferred.
Definition at line 580 of file geometry_set.cc.
|
inline |
Definition at line 190 of file BKE_geometry_set.hh.
| bool blender::bke::GeometrySet::has | ( | const GeometryComponent::Type | component_type | ) | const |
Definition at line 145 of file geometry_set.cc.
|
inline |
Definition at line 196 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 410 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 428 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 397 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 337 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 391 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 416 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 404 of file geometry_set.cc.
|
inline |
Definition at line 460 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 434 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 156 of file geometry_set.cc.
| void blender::bke::GeometrySet::keep_only_during_modify | ( | Span< GeometryComponent::Type > | component_types | ) |
Keeps the provided geometry types, but also instances and edit data. Instances must not be removed while using modify_geometry_sets.
Definition at line 167 of file geometry_set.cc.
Modify every (recursive) instance separately. This is often more efficient than realizing all instances just to change the same thing on all of them.
Definition at line 818 of file geometry_set.cc.
|
default |
|
default |
| bool blender::bke::GeometrySet::owns_direct_data | ( | ) | const |
Definition at line 310 of file geometry_set.cc.
|
inline |
Definition at line 203 of file BKE_geometry_set.hh.
| void blender::bke::GeometrySet::remove | ( | const GeometryComponent::Type | component_type | ) |
Definition at line 151 of file geometry_set.cc.
Definition at line 175 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 497 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 553 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 511 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 483 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 525 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 539 of file geometry_set.cc.
|
friend |
Definition at line 227 of file geometry_set.cc.
|
friend |
Definition at line 454 of file BKE_geometry_set.hh.
| std::string blender::bke::GeometrySet::name |
A user defined name for this geometry. It is not expected to be unique. Its main purpose is help debugging instance trees. It may eventually also be used when exporting instance trees or when creating separate objects from them.
Definition at line 156 of file BKE_geometry_set.hh.