Blender V5.3
blender::nodes::GeometrySet Struct Reference

#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)

Geometry Set

 GeometrySet ()
 GeometrySet (const GeometrySet &other)
 GeometrySet (GeometrySet &&other)
 ~GeometrySet ()
GeometrySet & operator= (const GeometrySet &other)
GeometrySet & operator= (GeometrySet &&other)
GeometryComponent & get_component_for_write (GeometryComponent::Type component_type)
const GeometryComponent * get_component (GeometryComponent::Type component_type) const
bool has (const GeometryComponent::Type component_type) const
void remove (const GeometryComponent::Type component_type)
void keep_only (Span< GeometryComponent::Type > component_types)
void add (const GeometryComponent &component)
Vector< const GeometryComponent * > get_components () const
std::optional< Bounds< float3 > > compute_boundbox_without_instances (bool use_radius=true, bool use_subdiv=false) const
void clear ()
bool owns_direct_data () const
void ensure_owns_direct_data ()
void ensure_owns_all_data ()
void ensure_no_shared_components ()
void attribute_foreach (Span< GeometryComponent::Type > component_types, bool include_instances, AttributeForeachCallback callback) const
Vector< GeometryComponent::Type > gather_component_types (bool include_instances, bool ignore_empty) const
bool has_mesh () const
bool has_pointcloud () const
bool has_instances () const
bool has_volume () const
bool has_curves () const
bool has_realized_data () const
bool has_grease_pencil () const
bool is_empty () const
const Mesh * get_mesh () const
const PointCloud * get_pointcloud () const
const Volume * get_volume () const
const Curves * get_curves () const
const Instances * get_instances () const
const CurvesEditHints * get_curve_edit_hints () const
const GreasePencilEditHints * get_grease_pencil_edit_hints () const
const GizmoEditHints * get_gizmo_edit_hints () const
const GreasePencil * get_grease_pencil () const
Mesh * get_mesh_for_write ()
PointCloud * get_pointcloud_for_write ()
Volume * get_volume_for_write ()
Curves * get_curves_for_write ()
Instances * get_instances_for_write ()
CurvesEditHints * get_curve_edit_hints_for_write ()
GreasePencilEditHints * get_grease_pencil_edit_hints_for_write ()
GizmoEditHints * get_gizmo_edit_hints_for_write ()
GreasePencil * get_grease_pencil_for_write ()
void replace_mesh (Mesh *mesh, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
void replace_pointcloud (PointCloud *pointcloud, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
void replace_volume (Volume *volume, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
void replace_curves (Curves *curves, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
void replace_instances (Instances *instances, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
void replace_grease_pencil (GreasePencil *grease_pencil, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
bool has_bundle () const
const nodes::Bundle * bundle () const
const nodes::BundlePtr & bundle_ptr () const
nodes::BundlePtr & bundle_ptr ()
nodes::Bundle & bundle_for_write ()
void copy_bundle_from (const GeometrySet &other)
void merge_bundle_from (const GeometrySet &other)
void set_name (std::string name)
StringRefNull name () const
void count_memory (MemoryCounter &memory) const
static GeometrySet from_mesh (Mesh *mesh, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
static GeometrySet from_volume (Volume *volume, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
static GeometrySet from_pointcloud (PointCloud *pointcloud, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
static GeometrySet from_curves (Curves *curves, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
static GeometrySet from_instances (std::unique_ptr< Instances > instances)
static GeometrySet from_instances (Instances *instances, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
static GeometrySet from_grease_pencil (GreasePencil *grease_pencil, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)

Detailed Description

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.

Member Typedef Documentation

◆ AttributeForeachCallback

Constructor & Destructor Documentation

◆ GeometrySet() [1/3]

The methods are defaulted here so that they are not instantiated in every translation unit.

Referenced by blender::nodes::LazyFunctionForForeachGeometryElementZone::build_graph_contents().

◆ GeometrySet() [2/3]

blender::bke::GeometrySet::GeometrySet ( const GeometrySet & other)
default

◆ GeometrySet() [3/3]

blender::bke::GeometrySet::GeometrySet ( GeometrySet && other)
default

◆ ~GeometrySet()

Member Function Documentation

◆ add()

Definition at line 164 of file geometry_set.cc.

◆ attribute_foreach()

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.

◆ bundle()

Definition at line 764 of file geometry_set.cc.

◆ bundle_for_write()

◆ bundle_ptr() [1/2]

◆ bundle_ptr() [2/2]

Definition at line 769 of file geometry_set.cc.

◆ clear()

Remove all geometry components from the geometry set.

Definition at line 265 of file geometry_set.cc.

◆ compute_boundbox_without_instances()

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.

◆ copy_bundle_from()

Definition at line 787 of file geometry_set.cc.

◆ count_memory()

Definition at line 628 of file geometry_set.cc.

◆ ensure_no_shared_components()

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.

◆ ensure_owns_all_data()

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.

◆ ensure_owns_direct_data()

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.

◆ from_curves()

◆ from_grease_pencil()

Create a new geometry set that only contains the given Grease Pencil data.

Definition at line 469 of file geometry_set.cc.

Referenced by blender::nodes::node_geo_curves_to_grease_pencil_cc::node_geo_exec().

◆ from_instances() [1/2]

◆ from_instances() [2/2]

◆ from_mesh()

◆ from_pointcloud()

◆ from_volume()

Create a new geometry set that only contains the given volume.

Definition at line 434 of file geometry_set.cc.

Referenced by blender::nodes::node_geo_import_vdb::node_geo_exec().

◆ gather_component_types()

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.

◆ get_component() [1/2]

template<typename Component>
const Component * blender::bke::GeometrySet::get_component ( ) const
inline

Definition at line 195 of file BKE_geometry_set.hh.

◆ get_component() [2/2]

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.

◆ get_component_for_write() [1/2]

template<typename Component>
Component & blender::bke::GeometrySet::get_component_for_write ( )
inline

Definition at line 180 of file BKE_geometry_set.hh.

◆ get_component_for_write() [2/2]

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.

◆ get_component_ptr()

◆ get_components()

Get all geometry components in this geometry set for read-only access.

Definition at line 172 of file geometry_set.cc.

◆ get_curve_edit_hints()

Returns read-only curve edit hints or null.

Definition at line 351 of file geometry_set.cc.

◆ get_curve_edit_hints_for_write()

Returns mutable curve edit hints or null.

Definition at line 592 of file geometry_set.cc.

◆ get_curves()

Returns a read-only curves data-block or null.

Definition at line 339 of file geometry_set.cc.

◆ get_curves_for_write()

Returns a mutable curves data-block or null. No ownership is transferred.

Definition at line 580 of file geometry_set.cc.

◆ get_gizmo_edit_hints()

Returns read-only gizmo edit hints or null.

Definition at line 363 of file geometry_set.cc.

◆ get_gizmo_edit_hints_for_write()

Returns mutable gizmo edit hints or null.

Definition at line 612 of file geometry_set.cc.

◆ get_grease_pencil()

Returns a read-only Grease Pencil data-block or null.

Definition at line 369 of file geometry_set.cc.

◆ get_grease_pencil_edit_hints()

Returns read-only Grease Pencil edit hints or null.

Definition at line 357 of file geometry_set.cc.

◆ get_grease_pencil_edit_hints_for_write()

Returns mutable Grease Pencil edit hints or null.

Definition at line 602 of file geometry_set.cc.

◆ get_grease_pencil_for_write()

Returns a mutable Grease Pencil data-block or null. No ownership is transferred.

Definition at line 622 of file geometry_set.cc.

◆ get_instances()

Returns read-only instances or null.

Definition at line 345 of file geometry_set.cc.

◆ get_instances_for_write()

Returns mutable instances or null. No ownership is transferred.

Definition at line 586 of file geometry_set.cc.

◆ get_mesh()

Returns a read-only mesh or null.

Definition at line 315 of file geometry_set.cc.

◆ get_mesh_for_write()

Returns a mutable mesh or null. No ownership is transferred.

Definition at line 562 of file geometry_set.cc.

◆ get_pointcloud()

Returns a read-only point cloud of null.

Definition at line 327 of file geometry_set.cc.

◆ get_pointcloud_for_write()

Returns a mutable point cloud or null. No ownership is transferred.

Definition at line 568 of file geometry_set.cc.

◆ get_volume()

Returns a read-only volume or null.

Definition at line 333 of file geometry_set.cc.

◆ get_volume_for_write()

Returns a mutable volume or null. No ownership is transferred.

Definition at line 574 of file geometry_set.cc.

◆ has() [1/2]

template<typename Component>
bool blender::bke::GeometrySet::has ( ) const
inline

Definition at line 202 of file BKE_geometry_set.hh.

◆ has() [2/2]

bool blender::bke::GeometrySet::has ( const GeometryComponent::Type component_type) const

Definition at line 142 of file geometry_set.cc.

◆ has_bundle()

Definition at line 759 of file geometry_set.cc.

◆ has_component()

template<typename Component>
bool blender::bke::GeometrySet::has_component ( ) const
inline

Definition at line 208 of file BKE_geometry_set.hh.

◆ has_curves()

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.

◆ has_grease_pencil()

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.

◆ has_instances()

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.

◆ has_mesh()

Returns true when the geometry set has a mesh component that has a mesh.

Definition at line 321 of file geometry_set.cc.

◆ has_pointcloud()

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.

◆ has_realized_data()

Returns true when the geometry set has any data that is not an instance.

Definition at line 400 of file geometry_set.cc.

◆ has_volume()

Returns true when the geometry set has a volume component that has a volume.

Definition at line 388 of file geometry_set.cc.

◆ hash()

Definition at line 470 of file BKE_geometry_set.hh.

◆ is_empty()

Return true if the geometry set has any component that isn't empty.

Definition at line 421 of file geometry_set.cc.

◆ keep_only()

Remove all geometry components with types that are not in the provided list.

Definition at line 153 of file geometry_set.cc.

◆ merge_bundle_from()

Definition at line 792 of file geometry_set.cc.

◆ name()

Definition at line 810 of file geometry_set.cc.

◆ operator=() [1/2]

GeometrySet & blender::bke::GeometrySet::operator= ( const GeometrySet & other)
default

◆ operator=() [2/2]

GeometrySet & blender::bke::GeometrySet::operator= ( GeometrySet && other)
default

◆ owns_direct_data()

Definition at line 294 of file geometry_set.cc.

◆ remove() [1/2]

template<typename Component>
void blender::bke::GeometrySet::remove ( )
inline

Definition at line 215 of file BKE_geometry_set.hh.

◆ remove() [2/2]

Definition at line 148 of file geometry_set.cc.

◆ replace_curves()

Clear the existing curves data-block and replace it with the given one.

Definition at line 491 of file geometry_set.cc.

◆ replace_grease_pencil()

Clear the existing Grease Pencil data-block and replace it with the given one.

Definition at line 547 of file geometry_set.cc.

◆ replace_instances()

Clear the existing instances and replace them with the given one.

Definition at line 505 of file geometry_set.cc.

◆ replace_mesh()

Clear the existing mesh and replace it with the given one.

Definition at line 477 of file geometry_set.cc.

◆ replace_pointcloud()

Clear the existing point cloud and replace with the given one.

Definition at line 519 of file geometry_set.cc.

◆ replace_volume()

Clear the existing volume and replace with the given one.

Definition at line 533 of file geometry_set.cc.

◆ set_name()

void blender::bke::GeometrySet::set_name ( std::string name)

Definition at line 805 of file geometry_set.cc.

◆ operator<<

std::ostream & operator<< ( std::ostream & stream,
const GeometrySet & geometry_set )
friend

Definition at line 211 of file geometry_set.cc.

◆ operator==

bool operator== ( const GeometrySet & a,
const GeometrySet & b )
friend

Definition at line 463 of file BKE_geometry_set.hh.


The documentation for this struct was generated from the following files: