Blender V4.3
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< intcalc_face_vert_indices (const int face_index) const
 
void store_uv_coords_and_indices ()
 
const Span< float2get_uv_coords () const
 
Span< intget_face_uv_indices (const int face_index) const
 
void store_normal_coords_and_indices ()
 
Span< float3get_normal_coords () const
 
Span< intget_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 31 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 81 of file obj_export_mesh.cc.

References clear().

Member Function Documentation

◆ 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 129 of file obj_export_mesh.hh.

References blender::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 206 of file obj_export_mesh.cc.

References Geometry::attributes, BKE_mesh_calc_smoothgroups(), blender::bke::Edge, blender::bke::Face, and blender::Span< T >::size().

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

◆ clear()

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

Definition at line 100 of file obj_export_mesh.cc.

References BKE_id_free(), and MEM_freeN().

Referenced by blender::io::obj::write_mesh_objects(), and ~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 377 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(), blender::Span< T >::is_empty(), NOT_FOUND, blender::MutableSpan< T >::size(), MDeformVert::totweight, and MDeformWeight::weight.

Referenced by 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 409 of file obj_export_mesh.cc.

References BLI_findlink(), and bDeformGroup::name.

Referenced by 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 168 of file obj_export_mesh.hh.

References blender::Array< T, InlineBufferCapacity, Allocator >::as_span(), and blender::Array< T, InlineBufferCapacity, Allocator >::is_empty().

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

◆ get_face_uv_indices()

◆ 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

◆ get_object_mesh_name()

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

Get Object's Mesh's name.

Definition at line 253 of file obj_export_mesh.cc.

Referenced by 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 248 of file obj_export_mesh.cc.

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

◆ get_uv_coords()

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

Definition at line 140 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 243 of file obj_export_mesh.cc.

◆ is_mirrored_transform()

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

Definition at line 91 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 198 of file obj_export_mesh.cc.

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

◆ 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 204 of file obj_export_mesh.hh.

References blender::Array< T, InlineBufferCapacity, Allocator >::size().

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 188 of file obj_export_mesh.cc.

References Mesh::edges_num.

◆ 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 193 of file obj_export_mesh.cc.

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

Definition at line 74 of file obj_export_mesh.hh.

Referenced by blender::io::obj::MTLWriter::add_materials().


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