Blender  V3.3
Public Member Functions | Static Public Attributes | List of all members
InstancesComponent Class Reference

#include <BKE_geometry_set.hh>

Inheritance diagram for InstancesComponent:
GeometryComponent

Public Member Functions

 ~InstancesComponent ()=default
 
void ensure_geometry_instances ()
 
void foreach_referenced_geometry (blender::FunctionRef< void(const GeometrySet &geometry_set)> callback) const
 
Geometry Component Implementation
 InstancesComponent ()
 
GeometryComponentcopy () const override
 
void clear ()
 
void reserve (int min_capacity)
 
void resize (int capacity)
 
int add_reference (const InstanceReference &reference)
 
void add_instance (int instance_handle, const blender::float4x4 &transform)
 
blender::Span< InstanceReferencereferences () const
 
void remove_unused_references ()
 
GeometrySetgeometry_set_from_reference (int reference_index)
 
blender::Span< int > instance_reference_handles () const
 
blender::MutableSpan< int > instance_reference_handles ()
 
blender::MutableSpan< blender::float4x4instance_transforms ()
 
blender::Span< blender::float4x4instance_transforms () const
 
int instances_num () const
 
int references_num () const
 
void remove_instances (const blender::IndexMask mask)
 
blender::Span< int > almost_unique_ids () const
 
blender::bke::CustomDataAttributesinstance_attributes ()
 
const blender::bke::CustomDataAttributesinstance_attributes () const
 
std::optional< blender::bke::AttributeAccessorattributes () const final
 
std::optional< blender::bke::MutableAttributeAccessorattributes_for_write () final
 
bool is_empty () const final
 
bool owns_direct_data () const override
 
void ensure_owns_direct_data () override
 
- Public Member Functions inherited from GeometryComponent
virtual ~GeometryComponent ()=default
 
 GeometryComponent (GeometryComponentType type)
 
int attribute_domain_size (eAttrDomain domain) const
 
void user_add () const
 
void user_remove () const
 
bool is_mutable () const
 
GeometryComponentType type () const
 

Static Public Attributes

static constexpr GeometryComponentType static_type = GEO_COMPONENT_TYPE_INSTANCES
 

Additional Inherited Members

- Static Public Member Functions inherited from GeometryComponent
static GeometryComponentcreate (GeometryComponentType component_type)
 

Detailed Description

A geometry component that stores instances. The instance data can be any type described by InstanceReference. Geometry instances can even contain instances themselves, for nested instancing. Each instance has an index into an array of unique instance data, and a transform. The component can also store generic attributes for each instance.

The component works differently from other geometry components in that it stores data about instancing directly, rather than owning a pointer to a separate data structure.

This component is not responsible for handling the interface to a render engine, or other areas that work with all visible geometry, that is handled by the dependency graph iterator (see DEG_depsgraph_query.h).

Definition at line 697 of file BKE_geometry_set.hh.

Constructor & Destructor Documentation

◆ InstancesComponent()

InstancesComponent::InstancesComponent ( )

Definition at line 39 of file geometry_component_instances.cc.

Referenced by copy().

◆ ~InstancesComponent()

InstancesComponent::~InstancesComponent ( )
default

Member Function Documentation

◆ add_instance()

void InstancesComponent::add_instance ( int  instance_handle,
const blender::float4x4 transform 
)

◆ add_reference()

int InstancesComponent::add_reference ( const InstanceReference reference)

◆ almost_unique_ids()

blender::Span< int > InstancesComponent::almost_unique_ids ( ) const

◆ attributes()

std::optional< blender::bke::AttributeAccessor > InstancesComponent::attributes ( ) const
finalvirtual

Get access to the attributes in this geometry component. May return none if the geometry does not support the attribute system.

Reimplemented from GeometryComponent.

Definition at line 514 of file geometry_component_instances.cc.

References blender::bke::get_instances_accessor_functions_ref().

Referenced by blender::nodes::node_geo_instances_to_points_cc::convert_instances_to_points(), and blender::nodes::node_geo_duplicate_elements_cc::duplicate_instances().

◆ attributes_for_write()

std::optional< blender::bke::MutableAttributeAccessor > InstancesComponent::attributes_for_write ( )
finalvirtual

◆ clear()

void InstancesComponent::clear ( )

◆ copy()

GeometryComponent * InstancesComponent::copy ( ) const
overridevirtual

Implements GeometryComponent.

Definition at line 43 of file geometry_component_instances.cc.

References InstancesComponent().

◆ ensure_geometry_instances()

void InstancesComponent::ensure_geometry_instances ( )

◆ ensure_owns_direct_data()

void InstancesComponent::ensure_owns_direct_data ( )
overridevirtual

◆ foreach_referenced_geometry()

void InstancesComponent::foreach_referenced_geometry ( blender::FunctionRef< void(const GeometrySet &geometry_set)>  callback) const

◆ geometry_set_from_reference()

GeometrySet & InstancesComponent::geometry_set_from_reference ( int  reference_index)

With write access to the instances component, the data in the instanced geometry sets can be changed. This is a function on the component rather than each reference to ensure const correctness for that reason.

Definition at line 103 of file geometry_component_instances.cc.

References BLI_assert, InstanceReference::GeometrySet, and GeometryComponent::type().

Referenced by gather_mutable_geometry_sets().

◆ instance_attributes() [1/2]

blender::bke::CustomDataAttributes & InstancesComponent::instance_attributes ( )

◆ instance_attributes() [2/2]

const blender::bke::CustomDataAttributes & InstancesComponent::instance_attributes ( ) const

Definition at line 373 of file geometry_component_instances.cc.

◆ instance_reference_handles() [1/2]

blender::MutableSpan< int > InstancesComponent::instance_reference_handles ( )

Definition at line 89 of file geometry_component_instances.cc.

◆ instance_reference_handles() [2/2]

blender::Span< int > InstancesComponent::instance_reference_handles ( ) const

◆ instance_transforms() [1/2]

blender::MutableSpan< blender::float4x4 > InstancesComponent::instance_transforms ( )

◆ instance_transforms() [2/2]

blender::Span< blender::float4x4 > InstancesComponent::instance_transforms ( ) const

Definition at line 98 of file geometry_component_instances.cc.

◆ instances_num()

int InstancesComponent::instances_num ( ) const

◆ is_empty()

bool InstancesComponent::is_empty ( ) const
finalvirtual

Reimplemented from GeometryComponent.

Definition at line 270 of file geometry_component_instances.cc.

◆ owns_direct_data()

bool InstancesComponent::owns_direct_data ( ) const
overridevirtual

Implements GeometryComponent.

Definition at line 275 of file geometry_component_instances.cc.

◆ references()

blender::Span< InstanceReference > InstancesComponent::references ( ) const

◆ references_num()

int InstancesComponent::references_num ( ) const

Definition at line 265 of file geometry_component_instances.cc.

◆ remove_instances()

void InstancesComponent::remove_instances ( const blender::IndexMask  mask)

◆ remove_unused_references()

void InstancesComponent::remove_unused_references ( )

◆ reserve()

void InstancesComponent::reserve ( int  min_capacity)

◆ resize()

void InstancesComponent::resize ( int  capacity)

Member Data Documentation

◆ static_type

constexpr GeometryComponentType InstancesComponent::static_type = GEO_COMPONENT_TYPE_INSTANCES
inlinestaticconstexpr

Definition at line 794 of file BKE_geometry_set.hh.


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