|
Blender V5.0
|
#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 float4x4 & | get_world_axes_transform () const |
| Span< int > | calc_face_vert_indices (const int face_index) const |
| void | store_uv_coords_and_indices () |
| Span< float2 > | get_uv_coords () const |
| Span< int > | get_face_uv_indices (const int face_index) const |
| void | store_normal_coords_and_indices () |
| Span< float3 > | get_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 Mesh * | get_mesh () const |
Public Attributes | |
| Array< const Material * > | materials |
Definition at line 29 of file obj_export_mesh.hh.
| blender::io::obj::OBJMesh::OBJMesh | ( | Depsgraph * | depsgraph, |
| const OBJExportParams & | export_params, | ||
| Object * | mesh_object ) |
Store evaluated Object and Mesh pointers. Conditionally triangulate a mesh, or create a new Mesh from a Curve.
Definition at line 38 of file obj_export_mesh.cc.
References OBJExportParams::apply_modifiers, OBJExportParams::apply_transform, BKE_mesh_new_from_object(), BKE_object_get_evaluated_mesh(), BKE_object_get_pre_modified_mesh(), BKE_object_material_get_eval(), DEG_get_evaluated(), depsgraph, OBJExportParams::export_triangulated_mesh, blender::bke::Face, OBJExportParams::forward_axis, OBJExportParams::global_scale, i, Object::id, materials, ID::name, OB_MESH, Object::type, and OBJExportParams::up_axis.
| 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().
| void blender::io::obj::OBJMesh::calc_face_order | ( | ) |
Calculate the order in which the faces should be written into the file (sorted by material index).
Definition at line 235 of file obj_export_mesh.cc.
References b, blender::bke::Face, blender::array_utils::fill_index_range(), blender::VArrayCommon< T >::get_internal_single(), blender::VArrayCommon< T >::is_single(), blender::bke::AttributeAccessor::lookup_or_default(), blender::parallel_sort(), and blender::Span< T >::size().
|
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().
| void blender::io::obj::OBJMesh::calc_smooth_groups | ( | bool | use_bitflags | ) |
Calculate smooth groups of a smooth-shaded object.
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().
| 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().
| 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().
| 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().
|
inline |
Calculate a face's face/corner normal indices.
| face_index | Index of the face to calculate indices for. |
Definition at line 166 of file obj_export_mesh.hh.
References blender::IndexRange::slice().
Referenced by blender::io::obj::OBJWriter::write_face_elements().
|
inline |
Definition at line 142 of file obj_export_mesh.hh.
References BLI_assert.
Referenced by blender::io::obj::OBJWriter::write_face_elements().
|
inline |
Definition at line 207 of file obj_export_mesh.hh.
Referenced by blender::io::obj::OBJWriter::write_edges_indices(), blender::io::obj::OBJWriter::write_face_elements(), and blender::io::obj::OBJWriter::write_vertex_coords().
Definition at line 157 of file obj_export_mesh.hh.
Referenced by blender::io::obj::OBJWriter::write_normals().
| StringRef blender::io::obj::OBJMesh::get_object_mesh_name | ( | ) | const |
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().
| 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().
Definition at line 138 of file obj_export_mesh.hh.
Referenced by blender::io::obj::OBJWriter::write_uv_coords().
|
inline |
Definition at line 119 of file obj_export_mesh.hh.
Referenced by blender::io::obj::OBJWriter::write_vertex_coords().
| 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().
|
inline |
Definition at line 89 of file obj_export_mesh.hh.
Referenced by blender::io::obj::OBJWriter::write_face_elements().
| int blender::io::obj::OBJMesh::ith_smooth_group | ( | int | face_index | ) | const |
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().
|
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().
| void blender::io::obj::OBJMesh::store_normal_coords_and_indices | ( | ) |
Find the unique normals of the mesh and stores them in a member variable. Also stores the indices into that vector with for each corner.
Definition at line 324 of file obj_export_mesh.cc.
References blender::Array< T, InlineBufferCapacity, Allocator >::as_span(), blender::VectorSet< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::as_span(), blender::bke::Corner, blender::bke::LooseGeomCache::count, blender::bke::Face, blender::array_utils::gather(), blender::VectorSet< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::index_of_or_add(), blender::Span< T >::index_range(), blender::bke::LooseGeomCache::is_loose_bits, blender::math::normalize(), blender::bke::Point, blender::VectorSet< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::reserve(), blender::io::obj::round_float3_to_n_digits(), blender::Span< T >::size(), store_normal_coords_and_indices(), and transform().
Referenced by store_normal_coords_and_indices().
| void blender::io::obj::OBJMesh::store_uv_coords_and_indices | ( | ) |
Calculate UV vertex coordinates of an Object. Stores the coordinates and UV vertex indices in the member variables.
Definition at line 273 of file obj_export_mesh.cc.
References blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::add(), CD_PROP_FLOAT2, blender::bke::Corner, CustomData_get_active_layer_name(), blender::Span< T >::is_empty(), blender::StringRefBase::is_empty(), blender::bke::AttributeAccessor::lookup(), blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::lookup_default(), blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::reserve(), blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::size(), blender::Span< T >::size(), and store_uv_coords_and_indices().
Referenced by store_uv_coords_and_indices().
| int blender::io::obj::OBJMesh::tot_deform_groups | ( | ) | const |
Definition at line 387 of file obj_export_mesh.cc.
References BLI_listbase_count(), and tot_deform_groups().
Referenced by tot_deform_groups(), and blender::io::obj::OBJWriter::write_face_elements().
| int blender::io::obj::OBJMesh::tot_edges | ( | ) | const |
Definition at line 191 of file obj_export_mesh.cc.
| int blender::io::obj::OBJMesh::tot_faces | ( | ) | const |
Definition at line 181 of file obj_export_mesh.cc.
Referenced by blender::io::obj::OBJWriter::write_face_elements().
| int16_t blender::io::obj::OBJMesh::tot_materials | ( | ) | const |
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().
| int blender::io::obj::OBJMesh::tot_uv_vertices | ( | ) | const |
Definition at line 186 of file obj_export_mesh.cc.
Referenced by blender::io::obj::OBJWriter::write_face_elements().
| int blender::io::obj::OBJMesh::tot_vertices | ( | ) | const |
Definition at line 176 of file obj_export_mesh.cc.
Referenced by blender::io::obj::OBJWriter::write_vertex_coords().
Definition at line 72 of file obj_export_mesh.hh.
Referenced by blender::io::obj::MTLWriter::add_materials(), OBJMesh(), and tot_materials().