Blender V5.0
blender::io::obj::OBJMesh Class Reference

#include <obj_export_mesh.hh>

Inherits blender::NonCopyable.

Public Member Functions

 OBJMesh (Depsgraph *depsgraph, const OBJExportParams &export_params, Object *mesh_object)
 ~OBJMesh ()
void clear ()
int tot_vertices () const
int tot_faces () const
int tot_uv_vertices () const
int tot_edges () const
int tot_deform_groups () const
bool is_mirrored_transform () const
int16_t tot_materials () const
void calc_smooth_groups (bool use_bitflags)
int ith_smooth_group (int face_index) const
bool is_ith_face_smooth (int face_index) const
StringRef get_object_name () const
StringRef get_object_mesh_name () const
const float4x4get_world_axes_transform () const
Span< int > calc_face_vert_indices (const int face_index) const
void store_uv_coords_and_indices ()
Span< float2get_uv_coords () const
Span< int > get_face_uv_indices (const int face_index) const
void store_normal_coords_and_indices ()
Span< float3get_normal_coords () const
Span< int > get_face_normal_indices (const int face_index) const
int16_t get_face_deform_group_index (int face_index, MutableSpan< float > group_weights) const
const char * get_face_deform_group_name (int16_t def_group_index) const
void calc_face_order ()
int remap_face_index (int i) const
const Meshget_mesh () const

Public Attributes

Array< const Material * > materials

Detailed Description

Definition at line 29 of file obj_export_mesh.hh.

Constructor & Destructor Documentation

◆ OBJMesh()

◆ ~OBJMesh()

blender::io::obj::OBJMesh::~OBJMesh ( )

Free new meshes allocated for triangulated meshes, or Curve converted to Mesh.

Definition at line 82 of file obj_export_mesh.cc.

References clear().

Member Function Documentation

◆ calc_face_order()

void blender::io::obj::OBJMesh::calc_face_order ( )

◆ calc_face_vert_indices()

Span< int > blender::io::obj::OBJMesh::calc_face_vert_indices ( const int face_index) const
inline

Calculate vertex indices of all vertices of the face at the given index.

Definition at line 127 of file obj_export_mesh.hh.

References Span< T >::slice().

Referenced by blender::io::obj::OBJWriter::write_face_elements().

◆ calc_smooth_groups()

void blender::io::obj::OBJMesh::calc_smooth_groups ( bool use_bitflags)

Calculate smooth groups of a smooth-shaded object.

Returns
A face aligned array of smooth group numbers.

Definition at line 209 of file obj_export_mesh.cc.

References BKE_mesh_calc_smoothgroups(), BKE_mesh_calc_smoothgroups_bitflags(), blender::bke::Edge, blender::bke::Face, and blender::bke::AttributeAccessor::lookup().

◆ clear()

void blender::io::obj::OBJMesh::clear ( )

Definition at line 101 of file obj_export_mesh.cc.

References BKE_id_free(), and MEM_freeN().

Referenced by ~OBJMesh().

◆ get_face_deform_group_index()

int16_t blender::io::obj::OBJMesh::get_face_deform_group_index ( int face_index,
MutableSpan< float > group_weights ) const

Find the most representative vertex group of a face.

This adds up vertex group weights, and the group with the largest weight sum across the face is the one returned.

group_weights is temporary storage to avoid reallocations, it must be the size of amount of vertex groups in the object.

Definition at line 392 of file obj_export_mesh.cc.

References blender::MutableSpan< T >::begin(), BLI_assert, BLI_listbase_count(), MDeformWeight::def_nr, MDeformVert::dw, blender::MutableSpan< T >::end(), blender::MutableSpan< T >::fill(), get_face_deform_group_index(), blender::Span< T >::is_empty(), blender::io::obj::NOT_FOUND, blender::MutableSpan< T >::size(), MDeformVert::totweight, and MDeformWeight::weight.

Referenced by get_face_deform_group_index(), and blender::io::obj::OBJWriter::write_face_elements().

◆ get_face_deform_group_name()

const char * blender::io::obj::OBJMesh::get_face_deform_group_name ( int16_t def_group_index) const

Find the name of the vertex deform group at the given index. The index indices into the #Object.defbase.

Definition at line 424 of file obj_export_mesh.cc.

References BLI_findlink(), get_face_deform_group_name(), and bDeformGroup::name.

Referenced by get_face_deform_group_name(), and blender::io::obj::OBJWriter::write_face_elements().

◆ get_face_normal_indices()

Span< int > blender::io::obj::OBJMesh::get_face_normal_indices ( const int face_index) const
inline

Calculate a face's face/corner normal indices.

Parameters
face_indexIndex of the face to calculate indices for.
Returns
Span of normal indices, aligned with vertices of face.

Definition at line 166 of file obj_export_mesh.hh.

References blender::IndexRange::slice().

Referenced by blender::io::obj::OBJWriter::write_face_elements().

◆ get_face_uv_indices()

Span< int > blender::io::obj::OBJMesh::get_face_uv_indices ( const int face_index) const
inline

Definition at line 142 of file obj_export_mesh.hh.

References BLI_assert.

Referenced by blender::io::obj::OBJWriter::write_face_elements().

◆ get_mesh()

const Mesh * blender::io::obj::OBJMesh::get_mesh ( ) const
inline

◆ get_normal_coords()

Span< float3 > blender::io::obj::OBJMesh::get_normal_coords ( ) const
inline

Definition at line 157 of file obj_export_mesh.hh.

Referenced by blender::io::obj::OBJWriter::write_normals().

◆ get_object_mesh_name()

StringRef blender::io::obj::OBJMesh::get_object_mesh_name ( ) const

Get Object's Mesh's name.

Definition at line 268 of file obj_export_mesh.cc.

References get_object_mesh_name().

Referenced by get_object_mesh_name(), and blender::io::obj::OBJWriter::write_object_name().

◆ get_object_name()

StringRef blender::io::obj::OBJMesh::get_object_name ( ) const

Get object name as it appears in the outliner.

Definition at line 263 of file obj_export_mesh.cc.

References get_object_name().

Referenced by get_object_name(), blender::io::obj::OBJWriter::write_face_elements(), and blender::io::obj::OBJWriter::write_object_name().

◆ get_uv_coords()

Span< float2 > blender::io::obj::OBJMesh::get_uv_coords ( ) const
inline

Definition at line 138 of file obj_export_mesh.hh.

Referenced by blender::io::obj::OBJWriter::write_uv_coords().

◆ get_world_axes_transform()

const float4x4 & blender::io::obj::OBJMesh::get_world_axes_transform ( ) const
inline

◆ is_ith_face_smooth()

bool blender::io::obj::OBJMesh::is_ith_face_smooth ( int face_index) const

Definition at line 258 of file obj_export_mesh.cc.

References is_ith_face_smooth().

Referenced by blender::io::obj::get_smooth_group(), and is_ith_face_smooth().

◆ is_mirrored_transform()

bool blender::io::obj::OBJMesh::is_mirrored_transform ( ) const
inline

Definition at line 89 of file obj_export_mesh.hh.

Referenced by blender::io::obj::OBJWriter::write_face_elements().

◆ ith_smooth_group()

int blender::io::obj::OBJMesh::ith_smooth_group ( int face_index) const
Returns
Smooth group of the face at the given index.

Definition at line 201 of file obj_export_mesh.cc.

References BLI_assert, and blender::io::obj::NEGATIVE_INIT.

Referenced by blender::io::obj::get_smooth_group().

◆ remap_face_index()

int blender::io::obj::OBJMesh::remap_face_index ( int i) const
inline

Remap face index according to face writing order. When materials are not being written, the face order array might be empty, in which case remap is a no-op.

Definition at line 202 of file obj_export_mesh.hh.

References i.

Referenced by blender::io::obj::OBJWriter::write_face_elements().

◆ store_normal_coords_and_indices()

◆ store_uv_coords_and_indices()

◆ tot_deform_groups()

int blender::io::obj::OBJMesh::tot_deform_groups ( ) const

◆ tot_edges()

int blender::io::obj::OBJMesh::tot_edges ( ) const

Definition at line 191 of file obj_export_mesh.cc.

◆ tot_faces()

int blender::io::obj::OBJMesh::tot_faces ( ) const

◆ tot_materials()

int16_t blender::io::obj::OBJMesh::tot_materials ( ) const
Returns
Total materials in the object.

Definition at line 196 of file obj_export_mesh.cc.

References materials.

Referenced by blender::io::obj::MTLWriter::add_materials(), and blender::io::obj::OBJWriter::write_face_elements().

◆ tot_uv_vertices()

int blender::io::obj::OBJMesh::tot_uv_vertices ( ) const

◆ tot_vertices()

int blender::io::obj::OBJMesh::tot_vertices ( ) const

Member Data Documentation

◆ materials

Array<const Material *> blender::io::obj::OBJMesh::materials

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