Blender V4.3
blender::bke::MeshComponent Class Reference

#include <BKE_geometry_set.hh>

Inherits blender::bke::GeometryComponent.

Public Member Functions

std::optional< AttributeAccessorattributes () const final
 
std::optional< MutableAttributeAccessorattributes_for_write () final
 
Geometry Component Implementation
 MeshComponent ()
 
 MeshComponent (Mesh *mesh, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
 
 ~MeshComponent ()
 
GeometryComponentPtr copy () const override
 
void clear () override
 
bool has_mesh () const
 
void replace (Mesh *mesh, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
 
Meshrelease ()
 
const Meshget () const
 
Meshget_for_write ()
 
bool is_empty () const final
 
bool owns_direct_data () const override
 
void ensure_owns_direct_data () override
 
void count_memory (MemoryCounter &memory) const override
 
- Public Member Functions inherited from blender::bke::GeometryComponent
virtual ~GeometryComponent ()=default
 
 GeometryComponent (Type type)
 
int attribute_domain_size (AttrDomain domain) const
 
Type type () const
 
- Public Member Functions inherited from blender::ImplicitSharingInfo
virtual ~ImplicitSharingInfo ()
 
bool is_mutable () const
 
bool is_expired () const
 
void add_user () const
 
void add_weak_user () const
 
void tag_ensured_mutable () const
 
int64_t version () const
 
int strong_users () const
 
void remove_user_and_delete_if_last () const
 
void remove_weak_user_and_delete_if_last () const
 

Static Public Attributes

static constexpr GeometryComponent::Type static_type = Type::Mesh
 

Additional Inherited Members

- Public Types inherited from blender::bke::GeometryComponent
enum class  Type {
  Mesh = 0 , PointCloud = 1 , Instance = 2 , Volume = 3 ,
  Curve = 4 , Edit = 5 , GreasePencil = 6
}
 
- Static Public Member Functions inherited from blender::bke::GeometryComponent
static GeometryComponentPtr create (Type component_type)
 

Detailed Description

A geometry component that can store a mesh, using the Mesh data-block. Attributes are stored on any of the four attribute domains.

Definition at line 474 of file BKE_geometry_set.hh.

Constructor & Destructor Documentation

◆ MeshComponent() [1/2]

blender::bke::MeshComponent::MeshComponent ( )

Definition at line 29 of file geometry_component_mesh.cc.

Referenced by copy().

◆ MeshComponent() [2/2]

blender::bke::MeshComponent::MeshComponent ( Mesh * mesh,
GeometryOwnershipType ownership = GeometryOwnershipType::Owned )

Definition at line 31 of file geometry_component_mesh.cc.

◆ ~MeshComponent()

blender::bke::MeshComponent::~MeshComponent ( )

Definition at line 36 of file geometry_component_mesh.cc.

References clear().

Member Function Documentation

◆ attributes()

std::optional< AttributeAccessor > blender::bke::MeshComponent::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 blender::bke::GeometryComponent.

Definition at line 1188 of file geometry_component_mesh.cc.

References blender::bke::get_mesh_accessor_functions_ref().

◆ attributes_for_write()

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

◆ clear()

void blender::bke::MeshComponent::clear ( )
overridevirtual

Remove referenced data from the geometry component.

Implements blender::bke::GeometryComponent.

Definition at line 51 of file geometry_component_mesh.cc.

References BKE_id_free(), BLI_assert, blender::ImplicitSharingInfo::is_expired(), blender::ImplicitSharingInfo::is_mutable(), and blender::bke::Owned.

Referenced by replace(), and ~MeshComponent().

◆ copy()

GeometryComponentPtr blender::bke::MeshComponent::copy ( ) const
overridevirtual

Copies the component. The returned component only has a single user and is therefor mutable.

Implements blender::bke::GeometryComponent.

Definition at line 41 of file geometry_component_mesh.cc.

References BKE_mesh_copy_for_eval(), MeshComponent(), and blender::bke::Owned.

◆ count_memory()

void blender::bke::MeshComponent::count_memory ( MemoryCounter & memory) const
overridevirtual

Reimplemented from blender::bke::GeometryComponent.

Definition at line 119 of file geometry_component_mesh.cc.

◆ ensure_owns_direct_data()

void blender::bke::MeshComponent::ensure_owns_direct_data ( )
overridevirtual

◆ get()

const Mesh * blender::bke::MeshComponent::get ( ) const

◆ get_for_write()

Mesh * blender::bke::MeshComponent::get_for_write ( )

Get the mesh from this component. This method can only be used when the component is mutable, i.e. it is not shared. The returned mesh can be modified. No ownership is transferred.

Definition at line 88 of file geometry_component_mesh.cc.

References BKE_mesh_copy_for_eval(), BLI_assert, blender::ImplicitSharingInfo::is_mutable(), blender::bke::Owned, and blender::bke::ReadOnly.

Referenced by blender::bke::GeometrySet::get_mesh_for_write().

◆ has_mesh()

bool blender::bke::MeshComponent::has_mesh ( ) const

Definition at line 62 of file geometry_component_mesh.cc.

Referenced by blender::bke::GeometrySet::has_mesh().

◆ is_empty()

bool blender::bke::MeshComponent::is_empty ( ) const
finalvirtual

Reimplemented from blender::bke::GeometryComponent.

Definition at line 98 of file geometry_component_mesh.cc.

◆ owns_direct_data()

bool blender::bke::MeshComponent::owns_direct_data ( ) const
overridevirtual

Implements blender::bke::GeometryComponent.

Definition at line 103 of file geometry_component_mesh.cc.

References blender::bke::Owned.

◆ release()

Mesh * blender::bke::MeshComponent::release ( )

Return the mesh and clear the component. The caller takes over responsibility for freeing the mesh (if the component was responsible before).

Definition at line 75 of file geometry_component_mesh.cc.

References BLI_assert, and blender::ImplicitSharingInfo::is_mutable().

Referenced by blender::bke::modifier_modify_mesh_and_geometry_set().

◆ replace()

void blender::bke::MeshComponent::replace ( Mesh * mesh,
GeometryOwnershipType ownership = GeometryOwnershipType::Owned )

Clear the component and replace it with the new mesh.

Definition at line 67 of file geometry_component_mesh.cc.

References BLI_assert, clear(), and blender::ImplicitSharingInfo::is_mutable().

Referenced by blender::bke::mesh_build_data(), and blender::bke::GeometrySet::replace_mesh().

Member Data Documentation

◆ static_type

GeometryComponent::Type blender::bke::MeshComponent::static_type = Type::Mesh
inlinestaticconstexpr

Definition at line 515 of file BKE_geometry_set.hh.


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