Blender  V3.3
List of all members
blender::io::obj::MTLWriter Class Reference

#include <obj_export_file_writer.hh>

Inheritance diagram for blender::io::obj::MTLWriter:
blender::NonMovable blender::NonCopyable

.MTL writers.

 MTLWriter (const char *obj_filepath) noexcept(false)
 
 ~MTLWriter ()
 
void write_header (const char *blen_filepath)
 
void write_materials (const char *blen_filepath, ePathReferenceMode path_mode, const char *dest_dir)
 
StringRefNull mtl_file_path () const
 
Vector< int > add_materials (const OBJMesh &mesh_to_export)
 
const char * mtlmaterial_name (int index)
 

Detailed Description

Responsible for writing a .MTL file.

Definition at line 165 of file obj_export_file_writer.hh.

Constructor & Destructor Documentation

◆ MTLWriter()

blender::io::obj::MTLWriter::MTLWriter ( const char *  obj_filepath)
noexcept

Definition at line 511 of file obj_export_file_writer.cc.

References BLI_fopen(), BLI_path_extension_replace(), and FILE_MAX.

◆ ~MTLWriter()

blender::io::obj::MTLWriter::~MTLWriter ( )

Definition at line 523 of file obj_export_file_writer.cc.

Member Function Documentation

◆ add_materials()

Vector< int > blender::io::obj::MTLWriter::add_materials ( const OBJMesh mesh_to_export)

Add the materials of the given object to MTLWriter, de-duplicating against ones that are already there. Return a Vector of indices into mtlmaterials_ that hold the #MTLMaterial that corresponds to each material slot, in order, of the given Object. Indexes are returned rather than pointers to the MTLMaterials themselves because the mtlmaterials_ Vector may move around when resized.

Definition at line 649 of file obj_export_file_writer.cc.

References blender::Vector< T, InlineBufferCapacity, Allocator >::append(), blender::io::obj::OBJMesh::get_object_material(), material, blender::io::obj::mtlmaterial_for_material(), blender::Vector< T, InlineBufferCapacity, Allocator >::resize(), blender::Vector< T, InlineBufferCapacity, Allocator >::size(), and blender::io::obj::OBJMesh::tot_materials().

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

◆ mtl_file_path()

StringRefNull blender::io::obj::MTLWriter::mtl_file_path ( ) const

Definition at line 545 of file obj_export_file_writer.cc.

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

◆ mtlmaterial_name()

const char * blender::io::obj::MTLWriter::mtlmaterial_name ( int  index)

Definition at line 672 of file obj_export_file_writer.cc.

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

◆ write_header()

void blender::io::obj::MTLWriter::write_header ( const char *  blen_filepath)

◆ write_materials()

void blender::io::obj::MTLWriter::write_materials ( const char *  blen_filepath,
ePathReferenceMode  path_mode,
const char *  dest_dir 
)

Write all of the material specifications to the MTL file. For consistency of output from run to run (useful for testing), the materials are sorted by name before writing.

Definition at line 618 of file obj_export_file_writer.cc.

References Freestyle::a, usdtokens::b(), BLI_path_normalize(), BLI_path_slash_native(), BLI_split_dir_part(), blender::io::obj::newmtl, PATH_MAX, blender::io::path_reference_copy(), sort(), blender::io::obj::string, and tex.


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