|
Blender V5.0
|
#include <obj_export_file_writer.hh>
Inherits blender::NonMovable, and blender::NonCopyable.
Public Member Functions | |
| OBJWriter (const char *filepath, const OBJExportParams &export_params) noexcept(false) | |
| ~OBJWriter () | |
| FILE * | get_outfile () const |
| void | write_header () const |
| void | write_object_name (FormatHandler &fh, const OBJMesh &obj_mesh_data) const |
| void | write_mtllib_name (StringRefNull mtl_filepath) const |
| void | write_vertex_coords (FormatHandler &fh, const OBJMesh &obj_mesh_data, bool write_colors) const |
| void | write_uv_coords (FormatHandler &fh, OBJMesh &obj_mesh_data) const |
| void | write_normals (FormatHandler &fh, OBJMesh &obj_mesh_data) |
| void | write_face_elements (FormatHandler &fh, const IndexOffsets &offsets, const OBJMesh &obj_mesh_data, FunctionRef< const char *(int)> matname_fn) |
| void | write_edges_indices (FormatHandler &fh, const IndexOffsets &offsets, const OBJMesh &obj_mesh_data) const |
| void | write_nurbs_curve (FormatHandler &fh, const IOBJCurve &obj_nurbs_data) const |
Responsible for writing a .OBJ file.
Definition at line 37 of file obj_export_file_writer.hh.
| blender::io::obj::OBJWriter::OBJWriter | ( | const char * | filepath, |
| const OBJExportParams & | export_params ) |
Definition at line 59 of file obj_export_file_writer.cc.
References BLI_fopen(), and nullptr.
| blender::io::obj::OBJWriter::~OBJWriter | ( | ) |
Definition at line 67 of file obj_export_file_writer.cc.
References CLOG_ERROR, and LOG.
|
inline |
Definition at line 47 of file obj_export_file_writer.hh.
Referenced by blender::io::obj::write_mesh_objects(), and blender::io::obj::write_nurbs_curve_objects().
| void blender::io::obj::OBJWriter::write_edges_indices | ( | FormatHandler & | fh, |
| const IndexOffsets & | offsets, | ||
| const OBJMesh & | obj_mesh_data ) const |
Write loose edges of a mesh as "l v1 v2".
Definition at line 451 of file obj_export_file_writer.cc.
References blender::bke::LooseGeomCache::count, blender::io::obj::OBJMesh::get_mesh(), i, blender::Span< T >::index_range(), blender::bke::LooseGeomCache::is_loose_bits, blender::io::obj::IndexOffsets::vertex_offset, and blender::io::obj::FormatHandler::write_obj_edge().
Referenced by blender::io::obj::write_mesh_objects().
| void blender::io::obj::OBJWriter::write_face_elements | ( | FormatHandler & | fh, |
| const IndexOffsets & | offsets, | ||
| const OBJMesh & | obj_mesh_data, | ||
| FunctionRef< const char *(int)> | matname_fn ) |
Write face elements with at least vertex indices, and conditionally with UV vertex indices and face normal indices. Also write groups: smooth, vertex, material. The matname_fn turns a 0-indexed material slot number in an Object into the name used in the .obj file.
Definition at line 363 of file obj_export_file_writer.cc.
References Geometry::attributes, blender::io::obj::OBJMesh::calc_face_vert_indices(), blender::io::obj::DEFORM_GROUP_DISABLED, blender::bke::Face, blender::io::obj::OBJMesh::get_face_deform_group_index(), blender::io::obj::OBJMesh::get_face_deform_group_name(), blender::io::obj::OBJMesh::get_face_normal_indices(), blender::io::obj::OBJMesh::get_face_uv_indices(), blender::io::obj::OBJMesh::get_mesh(), blender::io::obj::OBJMesh::get_object_name(), blender::io::obj::get_smooth_group(), i, blender::io::obj::OBJMesh::is_mirrored_transform(), blender::threading::EnumerableThreadSpecific< T >::local(), blender::bke::AttributeAccessor::lookup_or_default(), blender::io::obj::MATERIAL_GROUP_DISABLED, blender::io::obj::NEGATIVE_INIT, blender::io::obj::NOT_FOUND, blender::io::obj::obj_parallel_chunked_output(), blender::io::obj::OBJMesh::remap_face_index(), blender::Vector< T, InlineBufferCapacity, Allocator >::resize(), blender::io::obj::spaces_to_underscores(), blender::io::obj::OBJMesh::tot_deform_groups(), blender::io::obj::OBJMesh::tot_faces(), blender::io::obj::OBJMesh::tot_materials(), blender::io::obj::OBJMesh::tot_uv_vertices(), blender::io::obj::FormatHandler::write_obj_group(), blender::io::obj::FormatHandler::write_obj_smooth(), and blender::io::obj::FormatHandler::write_obj_usemtl().
Referenced by blender::io::obj::write_mesh_objects().
| void blender::io::obj::OBJWriter::write_header | ( | ) | const |
Definition at line 189 of file obj_export_file_writer.cc.
References BKE_blender_version_string(), blender::io::obj::FormatHandler::write_string(), and blender::io::obj::FormatHandler::write_to_file().
| void blender::io::obj::OBJWriter::write_mtllib_name | ( | StringRefNull | mtl_filepath | ) | const |
Write file name of Material Library in .OBJ file.
Definition at line 198 of file obj_export_file_writer.cc.
References BLI_path_split_dir_file(), blender::StringRefBase::data(), FILE_MAXDIR, FILE_MAXFILE, blender::io::obj::FormatHandler::write_obj_mtllib(), and blender::io::obj::FormatHandler::write_to_file().
Referenced by blender::io::obj::write_mesh_objects().
| void blender::io::obj::OBJWriter::write_normals | ( | FormatHandler & | fh, |
| OBJMesh & | obj_mesh_data ) |
Write corner normals for smooth-shaded faces, and face normals otherwise, as "vn x y z".
Definition at line 322 of file obj_export_file_writer.cc.
References blender::io::obj::OBJMesh::get_normal_coords(), i, blender::io::obj::obj_parallel_chunked_output(), and blender::Span< T >::size().
Referenced by blender::io::obj::write_mesh_objects().
| void blender::io::obj::OBJWriter::write_nurbs_curve | ( | FormatHandler & | fh, |
| const IOBJCurve & | obj_nurbs_data ) const |
Write a NURBS curve to the .OBJ file in parameter form.
Definition at line 493 of file obj_export_file_writer.cc.
References BLI_assert, blender::io::obj::compute_world_axes_transform(), blender::IndexRange::drop_back(), blender::io::obj::IOBJCurve::get_curve_name(), blender::io::obj::IOBJCurve::get_knots_u(), blender::io::obj::IOBJCurve::get_nurbs_degree_u(), blender::IndexRange::index_range(), blender::Span< T >::last(), mul_m4_v3(), blender::io::obj::IOBJCurve::num_control_points_u(), blender::io::obj::IOBJCurve::num_control_points_v(), blender::io::obj::IOBJCurve::object_transform(), blender::MatBase< T, NumCol, NumRow, Alignment >::ptr(), blender::IndexRange::size(), blender::Span< T >::size(), blender::io::obj::IOBJCurve::total_splines(), blender::io::obj::valid_nurb_control_point_range(), blender::io::obj::IOBJCurve::vertex_coordinates(), blender::io::obj::FormatHandler::write_obj_cstype(), blender::io::obj::FormatHandler::write_obj_curve_begin(), blender::io::obj::FormatHandler::write_obj_curve_end(), blender::io::obj::FormatHandler::write_obj_face_v(), blender::io::obj::FormatHandler::write_obj_group(), blender::io::obj::FormatHandler::write_obj_nurbs_degree(), blender::io::obj::FormatHandler::write_obj_nurbs_group_end(), blender::io::obj::FormatHandler::write_obj_nurbs_parm(), blender::io::obj::FormatHandler::write_obj_nurbs_parm_begin(), blender::io::obj::FormatHandler::write_obj_nurbs_parm_end(), and blender::io::obj::FormatHandler::write_obj_vertex().
Referenced by blender::io::obj::write_nurbs_curve_objects().
| void blender::io::obj::OBJWriter::write_object_name | ( | FormatHandler & | fh, |
| const OBJMesh & | obj_mesh_data ) const |
Write object's name or group.
Definition at line 218 of file obj_export_file_writer.cc.
References blender::io::obj::OBJMesh::get_object_mesh_name(), blender::io::obj::OBJMesh::get_object_name(), blender::io::obj::spaces_to_underscores(), blender::io::obj::FormatHandler::write_obj_group(), and blender::io::obj::FormatHandler::write_obj_object().
Referenced by blender::io::obj::write_mesh_objects().
| void blender::io::obj::OBJWriter::write_uv_coords | ( | FormatHandler & | fh, |
| OBJMesh & | obj_mesh_data ) const |
Write UV vertex coordinates for all vertices as vt u v.
Definition at line 313 of file obj_export_file_writer.cc.
References blender::io::obj::OBJMesh::get_uv_coords(), i, blender::io::obj::obj_parallel_chunked_output(), and blender::Span< T >::size().
Referenced by blender::io::obj::write_mesh_objects().
| void blender::io::obj::OBJWriter::write_vertex_coords | ( | FormatHandler & | fh, |
| const OBJMesh & | obj_mesh_data, | ||
| bool | write_colors ) const |
Write vertex coordinates for all vertices as "v x y z" or "v x y z r g b".
Definition at line 279 of file obj_export_file_writer.cc.
References Mesh::active_color_attribute, Geometry::attributes, BLI_assert, blender::VArrayCommon< T >::get(), blender::io::obj::OBJMesh::get_mesh(), blender::io::obj::OBJMesh::get_world_axes_transform(), i, linearrgb_to_srgb_v3_v3(), blender::bke::AttributeAccessor::lookup_or_default(), name, blender::io::obj::obj_parallel_chunked_output(), blender::bke::Point, blender::VArrayCommon< T >::size(), blender::io::obj::OBJMesh::tot_vertices(), transform(), blender::math::transform_point(), blender::io::obj::FormatHandler::write_obj_vertex(), and blender::io::obj::FormatHandler::write_obj_vertex_color().
Referenced by blender::io::obj::write_mesh_objects().