Blender
V3.3
|
#include <obj_export_mesh.hh>
Definition at line 45 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 32 of file obj_export_mesh.cc.
References OBJExportParams::apply_modifiers, BKE_mesh_new_from_object(), BKE_object_get_evaluated_mesh(), BKE_object_get_pre_modified_mesh(), DEG_get_evaluated_object(), depsgraph, ELEM, OBJExportParams::export_triangulated_mesh, OBJExportParams::forward_axis, OB_MESH, OB_SURF, 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 59 of file obj_export_mesh.cc.
References clear().
std::optional< std::array< int, 2 > > blender::io::obj::OBJMesh::calc_loose_edge_vert_indices | ( | int | edge_index | ) | const |
Calculate vertex indices of an edge's corners if it is a loose edge.
Definition at line 490 of file obj_export_mesh.cc.
References blender::io::obj::edge, and ME_LOOSEEDGE.
Referenced by blender::io::obj::OBJWriter::write_edges_indices().
float3 blender::io::obj::OBJMesh::calc_poly_normal | ( | int | poly_index | ) | const |
Calculate polygon normal of a polygon at given index.
Should be used for flat-shaded polygons.
Definition at line 340 of file obj_export_mesh.cc.
References BKE_mesh_calc_poly_normal(), MPoly::loopstart, mul_m3_v3(), and normalize_v3().
Vector< int > blender::io::obj::OBJMesh::calc_poly_normal_indices | ( | int | poly_index | ) | const |
Calculate a polygon's polygon/loop normal indices.
poly_index | Index of the polygon to calculate indices for. |
Definition at line 424 of file obj_export_mesh.cc.
References MPoly::loopstart, and MPoly::totloop.
Referenced by blender::io::obj::OBJWriter::write_poly_elements().
void blender::io::obj::OBJMesh::calc_poly_order | ( | ) |
Calculate the order in which the polygons should be written into the file (sorted by material index).
Definition at line 200 of file obj_export_mesh.cc.
References Freestyle::a, usdtokens::b(), blender::Vector< T, InlineBufferCapacity, Allocator >::begin(), blender::Vector< T, InlineBufferCapacity, Allocator >::end(), Mesh::mpoly, blender::parallel_sort(), blender::Vector< T, InlineBufferCapacity, Allocator >::resize(), and tot_polygons().
Span< int > blender::io::obj::OBJMesh::calc_poly_uv_indices | ( | int | poly_index | ) | const |
Definition at line 330 of file obj_export_mesh.cc.
References BLI_assert.
Referenced by blender::io::obj::OBJWriter::write_poly_elements().
Vector< int > blender::io::obj::OBJMesh::calc_poly_vertex_indices | ( | int | poly_index | ) | const |
Calculate vertex indices of all vertices of the polygon at the given index.
Definition at line 272 of file obj_export_mesh.cc.
References MPoly::loopstart, MPoly::totloop, and MLoop::v.
Referenced by blender::io::obj::OBJWriter::write_poly_elements().
Calculate smooth groups of a smooth-shaded object.
Definition at line 188 of file obj_export_mesh.cc.
References BKE_mesh_calc_smoothgroups(), Mesh::medge, Mesh::mloop, Mesh::mpoly, Mesh::totedge, Mesh::totloop, and Mesh::totpoly.
Calculate coordinates of the vertex at the given index.
Definition at line 263 of file obj_export_mesh.cc.
References copy_v3_v3(), mul_m4_v3(), and mul_v3_fl().
Referenced by blender::io::obj::OBJWriter::write_vertex_coords().
void blender::io::obj::OBJMesh::clear | ( | ) |
Definition at line 73 of file obj_export_mesh.cc.
References blender::Vector< T, InlineBufferCapacity, Allocator >::clear_and_make_inline(), and MEM_freeN.
Referenced by ~OBJMesh().
void blender::io::obj::OBJMesh::ensure_mesh_edges | ( | ) | const |
Definition at line 182 of file obj_export_mesh.cc.
References BKE_mesh_calc_edges(), and BKE_mesh_calc_edges_loose().
Referenced by blender::io::obj::write_mesh_objects().
void blender::io::obj::OBJMesh::ensure_mesh_normals | ( | ) | const |
Definition at line 177 of file obj_export_mesh.cc.
References BKE_mesh_calc_normals_split().
Referenced by blender::io::obj::write_mesh_objects().
|
inline |
Definition at line 244 of file obj_export_mesh.hh.
Referenced by blender::io::obj::OBJWriter::write_vertex_coords().
Definition at line 197 of file obj_export_mesh.hh.
Referenced by blender::io::obj::OBJWriter::write_poly_normals().
Return mat_nr-th material of the object. The given index should be zero-based.
The const_cast is safe here because BKE_object_material_get_eval won't change the object but it is a big can of worms to fix the declaration of that function right now.
The call uses "+ 1" as material getter needs one-based indices.
Definition at line 219 of file obj_export_mesh.cc.
References BKE_object_material_get_eval().
Referenced by blender::io::obj::MTLWriter::add_materials().
const char * blender::io::obj::OBJMesh::get_object_material_name | ( | int16_t | mat_nr | ) | const |
Get object's material (at the given index) name. The given index should be zero-based.
Definition at line 254 of file obj_export_mesh.cc.
References Material::id, and ID::name.
const char * blender::io::obj::OBJMesh::get_object_mesh_name | ( | ) | const |
Definition at line 249 of file obj_export_mesh.cc.
Referenced by blender::io::obj::OBJWriter::write_object_name().
const char * blender::io::obj::OBJMesh::get_object_name | ( | ) | const |
Get object name as it appears in the outliner.
Definition at line 244 of file obj_export_mesh.cc.
Referenced by blender::io::obj::OBJWriter::write_object_name(), and blender::io::obj::OBJWriter::write_poly_elements().
int16_t blender::io::obj::OBJMesh::get_poly_deform_group_index | ( | int | poly_index, |
MutableSpan< float > | group_weights | ||
) | const |
Find the most representative vertex group of a polygon.
This adds up vertex group weights, and the group with the largest weight sum across the polygon 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 447 of file obj_export_mesh.cc.
References blender::MutableSpan< T >::begin(), BKE_object_defgroup_count(), BLI_assert, CD_MDEFORMVERT, CustomData_get_layer(), MDeformWeight::def_nr, MDeformVert::dw, blender::MutableSpan< T >::end(), blender::MutableSpan< T >::fill(), MPoly::loopstart, NOT_FOUND, blender::MutableSpan< T >::size(), MPoly::totloop, MDeformVert::totweight, MLoop::v, and MDeformWeight::weight.
Referenced by blender::io::obj::OBJWriter::write_poly_elements().
const char * blender::io::obj::OBJMesh::get_poly_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 483 of file obj_export_mesh.cc.
References BKE_object_defgroup_list(), BLI_findlink(), and bDeformGroup::name.
Referenced by blender::io::obj::OBJWriter::write_poly_elements().
Definition at line 180 of file obj_export_mesh.hh.
Referenced by blender::io::obj::OBJWriter::write_uv_coords().
bool blender::io::obj::OBJMesh::is_ith_poly_smooth | ( | int | poly_index | ) | const |
Definition at line 232 of file obj_export_mesh.cc.
References Material::flag, and ME_SMOOTH.
|
inline |
Definition at line 120 of file obj_export_mesh.hh.
Referenced by blender::io::obj::OBJWriter::write_poly_elements().
int16_t blender::io::obj::OBJMesh::ith_poly_matnr | ( | int | poly_index | ) | const |
Returns a zero-based index of a polygon's material indexing into the Object's material slots.
Definition at line 237 of file obj_export_mesh.cc.
References BLI_assert, and NOT_FOUND.
Referenced by blender::io::obj::OBJWriter::write_poly_elements().
int blender::io::obj::OBJMesh::ith_smooth_group | ( | int | poly_index | ) | const |
Definition at line 169 of file obj_export_mesh.cc.
References BLI_assert, and blender::io::obj::NEGATIVE_INIT.
|
inline |
Remap polygon index according to polygon writing order. When materials are not being written, the polygon order array might be empty, in which case remap is a no-op.
Definition at line 239 of file obj_export_mesh.hh.
References blender::Vector< T, InlineBufferCapacity, Allocator >::size().
Referenced by blender::io::obj::OBJWriter::write_poly_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 loop.
Definition at line 368 of file obj_export_mesh.cc.
References blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::add(), BLI_assert, CD_NORMAL, copy_v3_v3(), CustomData_get_layer(), MPoly::flag, float(), blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::lookup_default(), MPoly::loopstart, ME_SMOOTH, mul_m3_v3(), normalize_v3(), blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::reserve(), blender::io::obj::round_float3_to_n_digits(), and MPoly::totloop.
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 284 of file obj_export_mesh.cc.
References BKE_mesh_uv_vert_map_create(), BKE_mesh_uv_vert_map_free(), BKE_mesh_uv_vert_map_get_vert(), CD_MLOOPUV, CustomData_get_layer(), UvMapVert::loop_of_poly_index, MPoly::loopstart, UvMapVert::next, UvMapVert::poly_index, UvMapVert::separate, STD_UV_CONNECT_LIMIT, MPoly::totloop, and MLoopUV::uv.
int blender::io::obj::OBJMesh::tot_deform_groups | ( | ) | const |
Definition at line 439 of file obj_export_mesh.cc.
References BKE_object_defgroup_count(), and BKE_object_supports_vertex_groups().
Referenced by blender::io::obj::OBJWriter::write_poly_elements().
int blender::io::obj::OBJMesh::tot_edges | ( | ) | const |
Definition at line 154 of file obj_export_mesh.cc.
References Mesh::totedge.
Referenced by blender::io::obj::OBJWriter::write_edges_indices().
int16_t blender::io::obj::OBJMesh::tot_materials | ( | ) | const |
Definition at line 159 of file obj_export_mesh.cc.
References Mesh::totcol.
Referenced by blender::io::obj::MTLWriter::add_materials(), and blender::io::obj::OBJWriter::write_poly_elements().
int blender::io::obj::OBJMesh::tot_normal_indices | ( | ) | const |
Definition at line 164 of file obj_export_mesh.cc.
Referenced by blender::io::obj::write_mesh_objects().
int blender::io::obj::OBJMesh::tot_polygons | ( | ) | const |
Definition at line 144 of file obj_export_mesh.cc.
References Mesh::totpoly.
Referenced by calc_poly_order(), blender::io::obj::write_mesh_objects(), and blender::io::obj::OBJWriter::write_poly_elements().
int blender::io::obj::OBJMesh::tot_uv_vertices | ( | ) | const |
Definition at line 149 of file obj_export_mesh.cc.
Referenced by blender::io::obj::write_mesh_objects(), and blender::io::obj::OBJWriter::write_poly_elements().
int blender::io::obj::OBJMesh::tot_vertices | ( | ) | const |
Definition at line 139 of file obj_export_mesh.cc.
References Mesh::totvert.
Referenced by blender::io::obj::write_mesh_objects(), and blender::io::obj::OBJWriter::write_vertex_coords().