Blender V5.3
blender::bke::Instances Class Reference

#include <BKE_instances.hh>

Public Member Functions

 Instances ()
 Instances (int size)
 Instances (Instances &&other)
 Instances (const Instances &other)
 ~Instances ()
Instances & operator= (const Instances &other)
Instances & operator= (Instances &&other)
void resize (int size)
int add_reference (const InstanceReference &reference)
int add_reference (InstanceReference &&reference)
int add_new_reference (InstanceReference reference)
std::optional< int > find_reference_handle (const InstanceReference &query)
Span< InstanceReference > references () const
MutableSpan< InstanceReference > references_for_write ()
void remove_unused_references ()
void ensure_geometry_instances ()
GeometrySet & geometry_set_from_reference (int reference_index)
Span< int > reference_handles () const
MutableSpan< int > reference_handles_for_write ()
Span< float4x4 > transforms () const
MutableSpan< float4x4 > transforms_for_write ()
int instances_num () const
int references_num () const
void remove (const IndexMask &mask, const AttributeFilter &attribute_filter)
Span< int > unique_ids () const
Span< int > reference_user_counts () const
bke::AttributeAccessor attributes () const
bke::MutableAttributeAccessor attributes_for_write ()
void foreach_referenced_geometry (FunctionRef< void(const GeometrySet &geometry_set)> callback) const
bool owns_direct_data () const
void ensure_owns_direct_data ()
void count_memory (MemoryCounter &memory) const
void tag_reference_handles_changed ()
#InstanceReference Inline Methods
bke::AttributeStorage & attribute_storage ()
const bke::AttributeStorage & attribute_storage () const

Detailed Description

Definition at line 115 of file BKE_instances.hh.

Constructor & Destructor Documentation

◆ Instances() [1/4]

◆ Instances() [2/4]

blender::bke::Instances::Instances ( int size)

Definition at line 171 of file instances.cc.

References blender::bke::Instance.

◆ Instances() [3/4]

blender::bke::Instances::Instances ( Instances && other)

Definition at line 176 of file instances.cc.

References Instances().

◆ Instances() [4/4]

blender::bke::Instances::Instances ( const Instances & other)

Definition at line 185 of file instances.cc.

References Instances().

◆ ~Instances()

Member Function Documentation

◆ add_new_reference()

◆ add_reference() [1/2]

int blender::bke::Instances::add_reference ( const InstanceReference & reference)

Returns a handle for the given reference. If the reference exists already, the handle of the existing reference is returned. Otherwise a new handle is added.

Definition at line 268 of file instances.cc.

References add_new_reference(), and find_reference_handle().

Referenced by blender::geometry::copy_and_reorder_instaces(), blender::nodes::node_geo_string_to_curves_cc::create_curve_instances(), and ~Instances().

◆ add_reference() [2/2]

int blender::bke::Instances::add_reference ( InstanceReference && reference)

Definition at line 276 of file instances.cc.

References add_new_reference(), and find_reference_handle().

◆ attribute_storage() [1/2]

AttributeStorage & blender::bke::Instances::attribute_storage ( )
inline

◆ attribute_storage() [2/2]

const AttributeStorage & blender::bke::Instances::attribute_storage ( ) const
inline

Definition at line 312 of file BKE_instances.hh.

◆ attributes()

◆ attributes_for_write()

◆ count_memory()

void blender::bke::Instances::count_memory ( MemoryCounter & memory) const

Definition at line 438 of file instances.cc.

Referenced by ~Instances().

◆ ensure_geometry_instances()

void blender::bke::Instances::ensure_geometry_instances ( )

If references have a collection or object type, convert them into geometry instances recursively. After that, the geometry sets can be edited. There may still be instances of other types of they can't be converted to geometry sets.

Definition at line 111 of file geometry_set_instances.cc.

References blender::Vector< T, InlineBufferCapacity, Allocator >::append(), blender::BKE_id_name(), blender::bke::InstanceReference::Collection, ELEM, ensure_geometry_instances(), FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN, FOREACH_COLLECTION_OBJECT_RECURSIVE_END, blender::bke::GeometrySet::from_instances(), blender::bke::InstanceReference::GeometrySet, blender::bke::GeometrySet::get_instances_for_write(), blender::bke::GeometrySet::has_instances(), blender::Collection::id, blender::Vector< T, InlineBufferCapacity, Allocator >::index_range(), blender::Collection::instance_offset, blender::bke::InstanceReference::InstanceReference(), blender::bke::InstanceReference::None, blender::OB_ARMATURE, blender::OB_CAMERA, blender::OB_LAMP, blender::OB_SPEAKER, blender::bke::InstanceReference::Object, blender::bke::object_get_evaluated_geometry_set(), blender::Vector< T, InlineBufferCapacity, Allocator >::reserve(), blender::bke::GeometrySet::set_name(), blender::Vector< T, InlineBufferCapacity, Allocator >::size(), and transforms().

Referenced by ensure_geometry_instances(), blender::geometry::extract_real_geometries_recursive(), blender::geometry::remove_id_attribute_from_instances(), and ~Instances().

◆ ensure_owns_direct_data()

void blender::bke::Instances::ensure_owns_direct_data ( )

Definition at line 428 of file instances.cc.

References blender::bke::InstanceReference::ensure_owns_direct_data().

Referenced by ~Instances().

◆ find_reference_handle()

std::optional< int > blender::bke::Instances::find_reference_handle ( const InstanceReference & query)

Definition at line 257 of file instances.cc.

Referenced by add_reference(), add_reference(), and ~Instances().

◆ foreach_referenced_geometry()

◆ geometry_set_from_reference()

GeometrySet & blender::bke::Instances::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 248 of file instances.cc.

References blender::BLI_assert(), and blender::bke::InstanceReference::GeometrySet.

Referenced by ~Instances().

◆ instances_num()

int blender::bke::Instances::instances_num ( ) const

Definition at line 408 of file instances.cc.

Referenced by blender::BPy_GeometrySet_get_instances_pointcloud(), blender::BPy_GeometrySet_static_from_evaluated_object(), blender::nodes::node_geo_instances_to_points_cc::convert_instances_to_points(), blender::geometry::copy_and_reorder_instaces(), blender::nodes::node_geo_curves_to_grease_pencil_cc::curve_instances_to_grease_pencil_layers(), blender::geometry::debug_randomize_instance_order(), blender::geometry::delete_selected_instances(), blender::io::usd::USDPointInstancerWriter::do_write(), blender::nodes::node_geo_duplicate_elements_cc::duplicate_instances(), blender::geometry::execute_instances_tasks(), blender::geometry::extract_instances(), blender::geometry::gather_realize_tasks_for_instances(), blender::geometry::gather_realize_tasks_recursive(), blender::bke::get_instances_accessor_functions(), blender::bke::GeometrySet::has_instances(), blender::nodes::node_geo_store_named_attribute_cc::node_geo_exec(), blender::bke::GeometrySet::operator<<, blender::geometry::prepare_attribute_fallbacks(), blender::geometry::propagate_instances_to_keep(), blender::geometry::realize_instances(), blender::nodes::node_geo_rotate_instances_cc::rotate_instances(), blender::nodes::node_geo_scale_instances_cc::scale_instances(), blender::geometry::seed_from_instances(), blender::bke::bake::serialize_geometry_set(), blender::nodes::node_geo_set_position_cc::set_instances_position(), blender::nodes::node_geo_translate_instances_cc::translate_instances(), and ~Instances().

◆ operator=() [1/2]

Instances & blender::bke::Instances::operator= ( const Instances & other)

Definition at line 196 of file instances.cc.

References Instances().

Referenced by ~Instances().

◆ operator=() [2/2]

Instances & blender::bke::Instances::operator= ( Instances && other)

Definition at line 206 of file instances.cc.

References Instances().

◆ owns_direct_data()

bool blender::bke::Instances::owns_direct_data ( ) const

Definition at line 418 of file instances.cc.

Referenced by ~Instances().

◆ reference_handles()

◆ reference_handles_for_write()

◆ reference_user_counts()

◆ references()

◆ references_for_write()

◆ references_num()

int blender::bke::Instances::references_num ( ) const

◆ remove()

void blender::bke::Instances::remove ( const IndexMask & mask,
const AttributeFilter & attribute_filter )

Remove the indices that are not contained in the mask input, and remove unused instance references afterwards.

Definition at line 300 of file instances.cc.

References attributes(), attributes_for_write(), blender::bke::gather_attributes(), blender::bke::Instance, Instances(), remove_unused_references(), and resize().

Referenced by blender::geometry::delete_selected_instances(), and ~Instances().

◆ remove_unused_references()

◆ resize()

void blender::bke::Instances::resize ( int size)

Resize the transform, handles, and attributes to the specified capacity.

Warning
Attribute values for newly added elements must be initialized by the caller.

Definition at line 216 of file instances.cc.

References blender::bke::Instance.

Referenced by blender::nodes::node_geo_string_to_curves_cc::add_instances_from_handles(), blender::geometry::copy_and_reorder_instaces(), blender::ed::curves::join_objects_exec(), blender::ed::pointcloud::join_objects_exec(), blender::object_duplilist_legacy_instances(), remove(), and ~Instances().

◆ tag_reference_handles_changed()

void blender::bke::Instances::tag_reference_handles_changed ( )
inline

◆ transforms()

◆ transforms_for_write()

◆ unique_ids()


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