Blender V4.3
blender::io::obj Namespace Reference

Classes

class  CurveFromGeometry
 
struct  Expectation
 
struct  FaceCorner
 
struct  FaceElem
 
class  FormatHandler
 
struct  Geometry
 
struct  GlobalVertices
 
struct  IndexOffsets
 
class  MeshFromGeometry
 
struct  MTLMaterial
 
class  MTLParser
 
struct  MTLTexMap
 
class  MTLWriter
 
struct  NurbsElement
 
class  OBJCurve
 
class  OBJDepsgraph
 
class  ObjExporterWriterTest
 
struct  OBJExportParamsDefault
 
class  OBJExportRegressionTest
 
class  OBJExportTest
 
class  OBJImportTest
 
class  OBJMesh
 
class  OBJMTLParserTest
 
class  OBJParser
 
class  OBJWriter
 

Enumerations

enum class  MTLTexMapType {
  Color = 0 , Metallic , Specular , SpecularExponent ,
  Roughness , Sheen , Reflection , Emission ,
  Alpha , Normal , Count
}
 
enum  eGeometryType { GEOM_MESH = OB_MESH , GEOM_CURVE = OB_CURVES_LEGACY }
 

Functions

static void spaces_to_underscores (std::string &r_name)
 
static int calc_chunk_count (int count)
 
template<typename Function >
void obj_parallel_chunked_output (FormatHandler &fh, int tot_count, const Function &function)
 
static int get_smooth_group (const OBJMesh &mesh, const OBJExportParams &params, int face_idx)
 
static float round_float_to_n_digits (const float f, int round_digits)
 
static float3 round_float3_to_n_digits (const float3 &v, int round_digits)
 
 BLI_STATIC_ASSERT (ARRAY_SIZE(tex_map_type_to_socket_id)==int(MTLTexMapType::Count), "array size mismatch")
 
static void copy_property_from_node (const eNodeSocketDatatype property_type, const bNode *node, const char *identifier, MutableSpan< float > r_property)
 
static void linked_sockets_to_dest_id (const bNode *dest_node, const bNodeTree &node_tree, const char *dest_socket_id, Vector< const bNodeSocket * > &r_linked_sockets)
 
static const bNodeget_node_of_type (Span< const bNodeSocket * > sockets_list, const int node_type)
 
static std::string get_image_filepath (const bNode *tex_node)
 
static const bNodefind_bsdf_node (const bNodeTree *nodetree)
 
static void store_bsdf_properties (const bNode *bsdf_node, const Material *material, MTLMaterial &r_mtl_mat)
 
static void store_image_textures (const bNode *bsdf_node, const bNodeTree *node_tree, const Material *material, MTLMaterial &r_mtl_mat)
 
MTLMaterial mtlmaterial_for_material (const Material *material)
 
static void print_exception_error (const std::system_error &ex)
 
static bool is_curve_nurbs_compatible (const Nurb *nurb)
 
std::pair< Vector< std::unique_ptr< OBJMesh > >, Vector< std::unique_ptr< OBJCurve > > > filter_supported_objects (Depsgraph *depsgraph, const OBJExportParams &export_params)
 
static void write_mesh_objects (const Span< std::unique_ptr< OBJMesh > > exportable_as_mesh, OBJWriter &obj_writer, MTLWriter *mtl_writer, const OBJExportParams &export_params)
 
static void write_nurbs_curve_objects (const Span< std::unique_ptr< OBJCurve > > exportable_as_nurbs, const OBJWriter &obj_writer)
 
void export_frame (Depsgraph *depsgraph, const OBJExportParams &export_params, const char *filepath)
 
bool append_frame_to_filename (const char *filepath, const int frame, char r_filepath_with_frames[1024])
 
void exporter_main (bContext *C, const OBJExportParams &export_params)
 
Vector< Vector< int > > fixup_invalid_face (Span< float3 > vert_positions, Span< int > face_verts)
 
void transform_object (Object *object, const OBJImportParams &import_params)
 
std::string get_geometry_name (const std::string &full_name, char separator)
 
static Geometrycreate_geometry (Geometry *const prev_geometry, const eGeometryType new_type, StringRef name, Vector< std::unique_ptr< Geometry > > &r_all_geometries)
 
static void geom_add_vertex (const char *p, const char *end, GlobalVertices &r_global_vertices)
 
static void geom_add_mrgb_colors (const char *p, const char *end, GlobalVertices &r_global_vertices)
 
static void geom_add_vertex_normal (const char *p, const char *end, GlobalVertices &r_global_vertices)
 
static void geom_add_uv_vertex (const char *p, const char *end, GlobalVertices &r_global_vertices)
 
static const char * parse_vertex_index (const char *p, const char *end, size_t n_elems, int &r_index)
 
static void geom_add_polyline (Geometry *geom, const char *p, const char *end, GlobalVertices &r_global_vertices)
 
static void geom_add_polygon (Geometry *geom, const char *p, const char *end, const GlobalVertices &global_vertices, const int material_index, const int group_index, const bool shaded_smooth)
 
static Geometrygeom_set_curve_type (Geometry *geom, const char *p, const char *end, const StringRef group_name, Vector< std::unique_ptr< Geometry > > &r_all_geometries)
 
static void geom_set_curve_degree (Geometry *geom, const char *p, const char *end)
 
static void geom_add_curve_vertex_indices (Geometry *geom, const char *p, const char *end, const GlobalVertices &global_vertices)
 
static void geom_add_curve_parameters (Geometry *geom, const char *p, const char *end)
 
static void geom_update_group (const StringRef rest_line, std::string &r_group_name)
 
static void geom_update_smooth_group (const char *p, const char *end, bool &r_state_shaded_smooth)
 
static void geom_new_object (const char *p, const char *end, bool &r_state_shaded_smooth, std::string &r_state_group_name, int &r_state_material_index, Geometry *&r_curr_geom, Vector< std::unique_ptr< Geometry > > &r_all_geometries)
 
static bool parse_keyword (const char *&p, const char *end, StringRef keyword)
 
static void use_all_vertices_if_no_faces (Geometry *geom, const Span< std::unique_ptr< Geometry > > all_geometries, const GlobalVertices &global_vertices)
 
static MTLTexMapType mtl_line_start_to_texture_type (const char *&p, const char *end)
 
static bool parse_texture_option (const char *&p, const char *end, MTLMaterial *material, MTLTexMap &tex_map)
 
static void parse_texture_map (const char *p, const char *end, MTLMaterial *material, const char *mtl_dir_path)
 
static Materialget_or_create_material (Main *bmain, const std::string &name, Map< std::string, std::unique_ptr< MTLMaterial > > &materials, Map< std::string, Material * > &created_materials, bool relative_paths)
 
static void set_property_of_socket (eNodeSocketDatatype property_type, const char *socket_id, Span< float > value, bNode *r_node)
 
static Imageload_image_at_path (Main *bmain, const std::string &path, bool relative_paths)
 
static Imagecreate_placeholder_image (Main *bmain, const std::string &path)
 
static Imageload_texture_image (Main *bmain, const MTLTexMap &tex_map, bool relative_paths)
 
static bNodeadd_node (bNodeTree *ntree, int type, float x, float y)
 
static void link_sockets (bNodeTree *ntree, bNode *from_node, const char *from_node_id, bNode *to_node, const char *to_node_id)
 
static void set_bsdf_socket_values (bNode *bsdf, Material *mat, const MTLMaterial &mtl_mat)
 
static void add_image_textures (Main *bmain, bNodeTree *ntree, bNode *bsdf, Material *mat, const MTLMaterial &mtl_mat, bool relative_paths)
 
bNodeTreecreate_mtl_node_tree (Main *bmain, const MTLMaterial &mtl_mat, Material *mat, bool relative_paths)
 
StringRef read_next_line (StringRef &buffer)
 
static bool is_whitespace (char c)
 
void fixup_line_continuations (char *p, char *end)
 
const char * drop_whitespace (const char *p, const char *end)
 
const char * drop_non_whitespace (const char *p, const char *end)
 
static const char * drop_plus (const char *p, const char *end)
 
const char * parse_float (const char *p, const char *end, float fallback, float &dst, bool skip_space, bool require_trailing_space)
 
const char * parse_floats (const char *p, const char *end, float fallback, float *dst, int count, bool require_trailing_space)
 
const char * parse_int (const char *p, const char *end, int fallback, int &dst, bool skip_space)
 
static Collectionfind_or_create_collection (Main *bmain, Collection *target, const std::string &geom_name, const OBJImportParams &import_params)
 
static void geometry_to_blender_geometry_set (const OBJImportParams &import_params, const Span< std::unique_ptr< Geometry > > all_geometries, const GlobalVertices &global_vertices, Vector< bke::GeometrySet > &geometries)
 
static void geometry_to_blender_objects (Main *bmain, Scene *scene, ViewLayer *view_layer, const OBJImportParams &import_params, MutableSpan< std::unique_ptr< Geometry > > all_geometries, const GlobalVertices &global_vertices, Map< std::string, std::unique_ptr< MTLMaterial > > &materials, Map< std::string, Material * > &created_materials)
 
void importer_geometry (const OBJImportParams &import_params, Vector< bke::GeometrySet > &geometries, size_t read_buffer_size)
 
void importer_main (bContext *C, const OBJImportParams &import_params)
 
void importer_main (Main *bmain, Scene *scene, ViewLayer *view_layer, const OBJImportParams &import_params, size_t read_buffer_size)
 
 TEST_F (OBJExportTest, filter_objects_curves_as_mesh)
 
 TEST_F (OBJExportTest, filter_objects_curves_as_nurbs)
 
 TEST_F (OBJExportTest, filter_objects_selected)
 
 TEST (obj_exporter_utils, append_negative_frame_to_filename)
 
 TEST (obj_exporter_utils, append_positive_frame_to_filename)
 
 TEST (obj_exporter_utils, append_large_positive_frame_to_filename)
 
static std::string read_temp_file_in_string (const std::string &file_path)
 
 TEST_F (ObjExporterWriterTest, header)
 
 TEST_F (ObjExporterWriterTest, mtllib)
 
 TEST (obj_exporter_writer, format_handler_buffer_chunking)
 
static bool strings_equal_after_first_lines (const std::string &a, const std::string &b)
 
 TEST_F (OBJExportRegressionTest, all_tris)
 
 TEST_F (OBJExportRegressionTest, all_quads)
 
 TEST_F (OBJExportRegressionTest, fgons)
 
 TEST_F (OBJExportRegressionTest, edges)
 
 TEST_F (OBJExportRegressionTest, vertices)
 
 TEST_F (OBJExportRegressionTest, cube_loose_edges)
 
 TEST_F (OBJExportRegressionTest, non_uniform_scale)
 
 TEST_F (OBJExportRegressionTest, nurbs_as_nurbs)
 
 TEST_F (OBJExportRegressionTest, nurbs_curves_as_nurbs)
 
 TEST_F (OBJExportRegressionTest, nurbs_as_mesh)
 
 TEST_F (OBJExportRegressionTest, cube_all_data_triangulated)
 
 TEST_F (OBJExportRegressionTest, cube_normal_edit)
 
 TEST_F (OBJExportRegressionTest, cube_vertex_groups)
 
 TEST_F (OBJExportRegressionTest, cubes_positioned)
 
 TEST_F (OBJExportRegressionTest, cubes_vertex_colors)
 
 TEST_F (OBJExportRegressionTest, cubes_with_textures_strip)
 
 TEST_F (OBJExportRegressionTest, cubes_with_textures_relative)
 
 TEST_F (OBJExportRegressionTest, suzanne_all_data)
 
 TEST_F (OBJExportRegressionTest, all_curves)
 
 TEST_F (OBJExportRegressionTest, all_curves_as_nurbs)
 
 TEST_F (OBJExportRegressionTest, all_objects)
 
 TEST_F (OBJExportRegressionTest, all_objects_mat_groups)
 
 TEST_F (OBJExportRegressionTest, materials_without_pbr)
 
 TEST_F (OBJExportRegressionTest, materials_pbr)
 
 TEST (obj_import_string_utils, read_next_line)
 
 TEST (obj_import_string_utils, fixup_line_continuations)
 
static StringRef drop_whitespace (StringRef s)
 
static StringRef parse_int (StringRef s, int fallback, int &dst, bool skip_space=true)
 
static StringRef parse_float (StringRef s, float fallback, float &dst, bool skip_space=true, bool require_trailing_space=false)
 
 TEST (obj_import_string_utils, drop_whitespace)
 
 TEST (obj_import_string_utils, parse_int_valid)
 
 TEST (obj_import_string_utils, parse_int_invalid)
 
 TEST (obj_import_string_utils, parse_float_valid)
 
 TEST (obj_import_string_utils, parse_float_invalid)
 
 TEST_F (OBJImportTest, import_cube)
 
 TEST_F (OBJImportTest, import_cube_o_after_verts)
 
 TEST_F (OBJImportTest, import_suzanne_all_data)
 
 TEST_F (OBJImportTest, import_nurbs)
 
 TEST_F (OBJImportTest, import_nurbs_curves)
 
 TEST_F (OBJImportTest, import_nurbs_cyclic)
 
 TEST_F (OBJImportTest, import_nurbs_endpoint)
 
 TEST_F (OBJImportTest, import_nurbs_manual)
 
 TEST_F (OBJImportTest, import_nurbs_mesh)
 
 TEST_F (OBJImportTest, import_materials)
 
 TEST_F (OBJImportTest, import_cubes_with_textures_rel)
 
 TEST_F (OBJImportTest, import_faces_invalid_or_with_holes)
 
 TEST_F (OBJImportTest, import_invalid_faces)
 
 TEST_F (OBJImportTest, import_invalid_indices)
 
 TEST_F (OBJImportTest, import_invalid_syntax)
 
 TEST_F (OBJImportTest, import_all_objects)
 
 TEST_F (OBJImportTest, import_cubes_vertex_colors)
 
 TEST_F (OBJImportTest, import_cubes_vertex_colors_mrgb)
 
 TEST_F (OBJImportTest, import_vertex_colors_non_contiguous)
 
 TEST_F (OBJImportTest, import_vertices)
 
 TEST_F (OBJImportTest, import_split_options_by_object)
 
 TEST_F (OBJImportTest, import_split_options_by_group)
 
 TEST_F (OBJImportTest, import_split_options_by_object_and_group)
 
 TEST_F (OBJImportTest, import_split_options_none)
 
 TEST_F (OBJImportTest, import_polylines)
 
 TEST_F (OBJMTLParserTest, string_newlines_whitespace)
 
 TEST_F (OBJMTLParserTest, cube)
 
 TEST_F (OBJMTLParserTest, all_objects)
 
 TEST_F (OBJMTLParserTest, materials)
 
 TEST_F (OBJMTLParserTest, materials_without_pbr)
 
 TEST_F (OBJMTLParserTest, materials_pbr)
 

Variables

const int SMOOTH_GROUP_DISABLED = 0
 
const int SMOOTH_GROUP_DEFAULT = 1
 
static const char * DEFORM_GROUP_DISABLED = "off"
 
static const char * MATERIAL_GROUP_DISABLED = ""
 
static const int chunk_size = 32768
 
const int NOT_FOUND = -1
 
const int NEGATIVE_INIT = -10
 
const char * tex_map_type_to_socket_id []
 
static const std::pair< StringRef, intunsupported_texture_options []
 
const float node_locx_texcoord = -880.0f
 
const float node_locx_mapping = -680.0f
 
const float node_locx_image = -480.0f
 
const float node_locx_normalmap = -200.0f
 
const float node_locx_bsdf = 0.0f
 
const float node_locx_output = 280.0f
 
const float node_locy_top = 300.0f
 
const float node_locy_step = 300.0f
 
constexpr bool save_failing_test_output = false
 
const std::string all_objects_file = "io_tests" SEP_STR "blend_scene" SEP_STR "all_objects.blend"
 

<tt>.MTL</tt> writers.

static const char * tex_map_type_to_string []
 
 BLI_STATIC_ASSERT (ARRAY_SIZE(tex_map_type_to_string)==int(MTLTexMapType::Count), "array size mismatch")
 
static std::string float3_to_string (const float3 &numbers)
 
static bool is_pbr_map (MTLTexMapType type)
 
static bool is_non_pbr_map (MTLTexMapType type)
 

Enumeration Type Documentation

◆ eGeometryType

Enumerator
GEOM_MESH 
GEOM_CURVE 

Definition at line 112 of file obj_import_objects.hh.

◆ MTLTexMapType

Enumerator
Color 
Metallic 
Specular 
SpecularExponent 
Roughness 
Sheen 
Reflection 
Emission 
Alpha 
Normal 
Count 

Definition at line 18 of file obj_export_mtl.hh.

Function Documentation

◆ add_image_textures()

◆ add_node()

static bNode * blender::io::obj::add_node ( bNodeTree * ntree,
int type,
float x,
float y )
static

Definition at line 156 of file obj_import_mtl.cc.

References node, blender::bke::node_add_static_node(), x, and y.

Referenced by add_image_textures(), and create_mtl_node_tree().

◆ append_frame_to_filename()

bool blender::io::obj::append_frame_to_filename ( const char * filepath,
int frame,
char r_filepath_with_frames[1024] )

Append the current frame number in the .OBJ file name.

Parameters
r_filepath_with_framesThe result of the filepath with its "#" characters replaced by the number representing frame, and with an .obj extension.
Returns
Whether the filepath is in FILE_MAX limits.

Definition at line 324 of file obj_exporter.cc.

References BLI_path_extension_replace(), BLI_path_extension_strip(), BLI_path_frame(), BLI_strncpy(), and FILE_MAX.

Referenced by exporter_main(), TEST(), TEST(), and TEST().

◆ BLI_STATIC_ASSERT() [1/2]

blender::io::obj::BLI_STATIC_ASSERT ( ARRAY_SIZE(tex_map_type_to_socket_id) = =int(MTLTexMapType::Count),
"array size mismatch"  )

◆ BLI_STATIC_ASSERT() [2/2]

blender::io::obj::BLI_STATIC_ASSERT ( ARRAY_SIZE(tex_map_type_to_string) = =int(MTLTexMapType::Count),
"array size mismatch"  )

◆ calc_chunk_count()

static int blender::io::obj::calc_chunk_count ( int count)
static

Definition at line 210 of file obj_export_file_writer.cc.

References chunk_size, and count.

Referenced by obj_parallel_chunked_output().

◆ copy_property_from_node()

static void blender::io::obj::copy_property_from_node ( const eNodeSocketDatatype property_type,
const bNode * node,
const char * identifier,
MutableSpan< float > r_property )
static

◆ create_geometry()

static Geometry * blender::io::obj::create_geometry ( Geometry *const prev_geometry,
const eGeometryType new_type,
StringRef name,
Vector< std::unique_ptr< Geometry > > & r_all_geometries )
static

◆ create_mtl_node_tree()

◆ create_placeholder_image()

static Image * blender::io::obj::create_placeholder_image ( Main * bmain,
const std::string & path )
static

◆ drop_non_whitespace()

const char * blender::io::obj::drop_non_whitespace ( const char * p,
const char * end )

Drop leading non-white-space from a string part.

Definition at line 71 of file obj_import_string_utils.cc.

References is_whitespace().

Referenced by geom_add_polygon(), geom_add_polyline(), and parse_texture_option().

◆ drop_plus()

static const char * blender::io::obj::drop_plus ( const char * p,
const char * end )
static

Definition at line 79 of file obj_import_string_utils.cc.

Referenced by parse_float(), and parse_int().

◆ drop_whitespace() [1/2]

const char * blender::io::obj::drop_whitespace ( const char * p,
const char * end )

◆ drop_whitespace() [2/2]

static StringRef blender::io::obj::drop_whitespace ( StringRef s)
static

Definition at line 43 of file obj_import_string_utils_tests.cc.

References drop_whitespace().

◆ export_frame()

void blender::io::obj::export_frame ( Depsgraph * depsgraph,
const OBJExportParams & export_params,
const char * filepath )

Export a single frame of a .obj file, according to the given export_parameters. The frame state is given in depsgraph. The output file name is given by filepath. This function is normally called from exporter_main, but is exposed here for testing purposes. Export a single frame to a .OBJ file.

Conditionally write a .MTL file also.

Definition at line 270 of file obj_exporter.cc.

References BKE_reportf(), OBJExportParams::blen_filepath, BLI_assert_msg, BLI_path_normalize(), BLI_path_slash_native(), BLI_path_split_dir_part(), depsgraph, OBJExportParams::export_material_groups, OBJExportParams::export_materials, OBJExportParams::export_pbr_extensions, OBJExportParams::file_base_for_tests, FILE_MAX, OBJExportParams::filepath, filter_supported_objects(), OBJExportParams::path_mode, print_exception_error(), OBJExportParams::reports, RPT_ERROR, RPT_WARNING, STRNCPY, write_mesh_objects(), and write_nurbs_curve_objects().

Referenced by blender::io::obj::OBJExportRegressionTest::compare_obj_export_to_golden(), and exporter_main().

◆ exporter_main()

void blender::io::obj::exporter_main ( bContext * C,
const OBJExportParams & export_params )

The main function for exporting a .obj file according to the given export_parameters. It uses the context C to get the dependency graph, and from that, the Scene. Depending on whether or not export_params.export_animation is set, it writes either one file per animation frame, or just one file. Central internal function to call Scene update & writer functions.

Definition at line 334 of file obj_exporter.cc.

References append_frame_to_filename(), BKE_libblock_find_name(), BKE_reportf(), OBJExportParams::collection, CTX_data_main(), DEG_get_input_scene(), OBJExportParams::end_frame, OBJExportParams::export_animation, OBJExportParams::export_eval_mode, export_frame(), FILE_MAX, OBJExportParams::filepath, blender::io::obj::OBJDepsgraph::get(), ID_GR, blender::ed::object::mode_set(), OB_MODE_OBJECT, OBJExportParams::reports, RPT_ERROR, OBJExportParams::start_frame, and blender::io::obj::OBJDepsgraph::update_for_newframe().

Referenced by OBJ_export().

◆ filter_supported_objects()

std::pair< Vector< std::unique_ptr< OBJMesh > >, Vector< std::unique_ptr< OBJCurve > > > blender::io::obj::filter_supported_objects ( Depsgraph * depsgraph,
const OBJExportParams & export_params )

Filter supported objects from the Scene.

Note
Curves are also stored with Meshes if export settings specify so.

Find the objects to be exported in the view_layer of the dependency graphdepsgraph, and return them in vectors unique_ptrs of OBJMesh and OBJCurve. If export_params.export_selected_objects is set, then only selected objects are to be exported, else all objects are to be exported. But only objects of type OB_MESH, OB_CURVES_LEGACY, and OB_SURF are supported; the rest will be ignored. If export_params.export_curves_as_nurbs is set, then curves of type CU_NURBS are exported in curve form in the .obj file, otherwise they are converted to mesh and returned in the OBJMesh vector. All other exportable types are always converted to mesh and returned in the OBJMesh vector.

Definition at line 105 of file obj_exporter.cc.

References blender::Vector< T, InlineBufferCapacity, Allocator >::append(), BASE_SELECTED, DEG_ITER_OBJECT_FLAG_DUPLI, DEG_ITER_OBJECT_FLAG_LINKED_DIRECTLY, DEG_ITER_OBJECT_FLAG_LINKED_VIA_SET, DEG_ITER_OBJECT_FLAG_VISIBLE, DEG_OBJECT_ITER_BEGIN, DEG_OBJECT_ITER_END, DEGObjectIterSettings::depsgraph, depsgraph, OBJExportParams::export_curves_as_nurbs, OBJExportParams::export_selected_objects, is_curve_nurbs_compatible(), OB_CURVES_LEGACY, OB_MESH, and OB_SURF.

Referenced by export_frame(), TEST_F(), TEST_F(), and TEST_F().

◆ find_bsdf_node()

static const bNode * blender::io::obj::find_bsdf_node ( const bNodeTree * nodetree)
static

Find the Principled-BSDF Node in nodetree. We only want one that feeds directly into a Material Output node (that is the behavior of the legacy Python exporter).

Definition at line 174 of file obj_export_mtl.cc.

References bNode::typeinfo.

Referenced by mtlmaterial_for_material().

◆ find_or_create_collection()

static Collection * blender::io::obj::find_or_create_collection ( Main * bmain,
Collection * target,
const std::string & geom_name,
const OBJImportParams & import_params )
static

◆ fixup_invalid_face()

Vector< Vector< int > > blender::io::obj::fixup_invalid_face ( Span< float3 > vert_coords,
Span< int > face_vert_indices )

Given an invalid face (with holes or duplicated vertex indices), turn it into possibly multiple faces that are valid.

Parameters
vert_coordsPolygon's vertex coordinate list.
face_vert_indicesA face's indices that index into the given vertex coordinate list.
Returns
List of faces with each element containing indices of one face. The indices are into face_vert_indices array.

Definition at line 28 of file importer_mesh_utils.cc.

References blender::Vector< T, InlineBufferCapacity, Allocator >::append(), axis_dominant_v3_to_m3(), BLI_assert, CDT_CONSTRAINTS_VALID_BMESH_WITH_HOLES, delaunay_2d_calc(), blender::meshintersect::CDT_result< T >::face, blender::bke::mesh::face_normal_calc(), faces, blender::Array< T, InlineBufferCapacity, Allocator >::first(), blender::Span< T >::index_range(), mul_v2_m3v3(), blender::Vector< T, InlineBufferCapacity, Allocator >::reserve(), blender::Array< T, InlineBufferCapacity, Allocator >::size(), blender::Span< T >::size(), blender::meshintersect::CDT_input< T >::vert, and blender::meshintersect::CDT_result< T >::vert_orig.

◆ fixup_line_continuations()

void blender::io::obj::fixup_line_continuations ( char * p,
char * end )

Fix up OBJ line continuations by replacing backslash () and the following newline with spaces.

Definition at line 41 of file obj_import_string_utils.cc.

References is_whitespace().

Referenced by blender::io::obj::OBJParser::parse(), and TEST().

◆ float3_to_string()

static std::string blender::io::obj::float3_to_string ( const float3 & numbers)
static

Convert float3 to string of space-separated numbers, with no leading or trailing space. Only to be used in NON-performance-critical code.

Definition at line 528 of file obj_export_file_writer.cc.

◆ geom_add_curve_parameters()

static void blender::io::obj::geom_add_curve_parameters ( Geometry * geom,
const char * p,
const char * end )
static

◆ geom_add_curve_vertex_indices()

◆ geom_add_mrgb_colors()

static void blender::io::obj::geom_add_mrgb_colors ( const char * p,
const char * end,
GlobalVertices & r_global_vertices )
static

◆ geom_add_polygon()

◆ geom_add_polyline()

static void blender::io::obj::geom_add_polyline ( Geometry * geom,
const char * p,
const char * end,
GlobalVertices & r_global_vertices )
static

Parse a polyline and add its line segments as loose edges. We support the following polyline specifications:

  • "l v1/vt1 v2/vt2 ..."
  • "l v1 v2 ..." If a line only has one vertex (technically not allowed by the spec), no line is created, but the vertex will be added to the mesh even if it is unconnected.

Definition at line 171 of file obj_import_file_reader.cc.

References drop_non_whitespace(), drop_whitespace(), blender::io::obj::Geometry::edges_, INT32_MAX, parse_vertex_index(), blender::io::obj::Geometry::track_vertex_index(), and blender::io::obj::GlobalVertices::vertices.

Referenced by blender::io::obj::OBJParser::parse().

◆ geom_add_uv_vertex()

static void blender::io::obj::geom_add_uv_vertex ( const char * p,
const char * end,
GlobalVertices & r_global_vertices )
static

◆ geom_add_vertex()

static void blender::io::obj::geom_add_vertex ( const char * p,
const char * end,
GlobalVertices & r_global_vertices )
static

◆ geom_add_vertex_normal()

static void blender::io::obj::geom_add_vertex_normal ( const char * p,
const char * end,
GlobalVertices & r_global_vertices )
static

◆ geom_new_object()

static void blender::io::obj::geom_new_object ( const char * p,
const char * end,
bool & r_state_shaded_smooth,
std::string & r_state_group_name,
int & r_state_material_index,
Geometry *& r_curr_geom,
Vector< std::unique_ptr< Geometry > > & r_all_geometries )
static

Definition at line 406 of file obj_import_file_reader.cc.

References create_geometry(), and GEOM_MESH.

Referenced by blender::io::obj::OBJParser::parse().

◆ geom_set_curve_degree()

static void blender::io::obj::geom_set_curve_degree ( Geometry * geom,
const char * p,
const char * end )
static

◆ geom_set_curve_type()

static Geometry * blender::io::obj::geom_set_curve_type ( Geometry * geom,
const char * p,
const char * end,
const StringRef group_name,
Vector< std::unique_ptr< Geometry > > & r_all_geometries )
static

◆ geom_update_group()

static void blender::io::obj::geom_update_group ( const StringRef rest_line,
std::string & r_group_name )
static

◆ geom_update_smooth_group()

static void blender::io::obj::geom_update_smooth_group ( const char * p,
const char * end,
bool & r_state_shaded_smooth )
static

Definition at line 391 of file obj_import_file_reader.cc.

References drop_whitespace(), and parse_int().

Referenced by blender::io::obj::OBJParser::parse().

◆ geometry_to_blender_geometry_set()

static void blender::io::obj::geometry_to_blender_geometry_set ( const OBJImportParams & import_params,
const Span< std::unique_ptr< Geometry > > all_geometries,
const GlobalVertices & global_vertices,
Vector< bke::GeometrySet > & geometries )
static

◆ geometry_to_blender_objects()

◆ get_geometry_name()

std::string blender::io::obj::get_geometry_name ( const std::string & full_name,
char separator )

◆ get_image_filepath()

static std::string blender::io::obj::get_image_filepath ( const bNode * tex_node)
static

◆ get_node_of_type()

static const bNode * blender::io::obj::get_node_of_type ( Span< const bNodeSocket * > sockets_list,
const int node_type )
static

From a list of sockets, get the parent node which is of the given node type.

Definition at line 120 of file obj_export_mtl.cc.

References bNode::typeinfo.

Referenced by store_image_textures().

◆ get_or_create_material()

static Material * blender::io::obj::get_or_create_material ( Main * bmain,
const std::string & name,
Map< std::string, std::unique_ptr< MTLMaterial > > & materials,
Map< std::string, Material * > & created_materials,
bool relative_paths )
static

◆ get_smooth_group()

static int blender::io::obj::get_smooth_group ( const OBJMesh & mesh,
const OBJExportParams & params,
int face_idx )
static

◆ importer_geometry()

void blender::io::obj::importer_geometry ( const OBJImportParams & import_params,
Vector< bke::GeometrySet > & geometries,
size_t read_buffer_size )

Definition at line 168 of file obj_importer.cc.

References geometry_to_blender_geometry_set().

Referenced by OBJ_import_geometries().

◆ importer_main() [1/2]

void blender::io::obj::importer_main ( bContext * C,
const OBJImportParams & import_params )

◆ importer_main() [2/2]

void blender::io::obj::importer_main ( Main * bmain,
Scene * scene,
ViewLayer * view_layer,
const OBJImportParams & import_params,
size_t read_buffer_size )

◆ is_curve_nurbs_compatible()

static bool blender::io::obj::is_curve_nurbs_compatible ( const Nurb * nurb)
static

Definition at line 88 of file obj_exporter.cc.

References CU_BEZIER, Nurb::next, Nurb::pntsv, and Nurb::type.

Referenced by filter_supported_objects().

◆ is_non_pbr_map()

static bool blender::io::obj::is_non_pbr_map ( MTLTexMapType type)
static

◆ is_pbr_map()

static bool blender::io::obj::is_pbr_map ( MTLTexMapType type)
static

Definition at line 669 of file obj_export_file_writer.cc.

References Metallic, Roughness, and Sheen.

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

◆ is_whitespace()

static bool blender::io::obj::is_whitespace ( char c)
static

◆ link_sockets()

static void blender::io::obj::link_sockets ( bNodeTree * ntree,
bNode * from_node,
const char * from_node_id,
bNode * to_node,
const char * to_node_id )
static

◆ linked_sockets_to_dest_id()

static void blender::io::obj::linked_sockets_to_dest_id ( const bNode * dest_node,
const bNodeTree & node_tree,
const char * dest_socket_id,
Vector< const bNodeSocket * > & r_linked_sockets )
static

◆ load_image_at_path()

static Image * blender::io::obj::load_image_at_path ( Main * bmain,
const std::string & path,
bool relative_paths )
static

◆ load_texture_image()

static Image * blender::io::obj::load_texture_image ( Main * bmain,
const MTLTexMap & tex_map,
bool relative_paths )
static

◆ mtl_line_start_to_texture_type()

static MTLTexMapType blender::io::obj::mtl_line_start_to_texture_type ( const char *& p,
const char * end )
static

◆ mtlmaterial_for_material()

MTLMaterial blender::io::obj::mtlmaterial_for_material ( const Material * material)

◆ obj_parallel_chunked_output()

◆ parse_float() [1/2]

const char * blender::io::obj::parse_float ( const char * p,
const char * end,
float fallback,
float & dst,
bool skip_space = true,
bool require_trailing_space = false )

Parse a float from an input string. The parsed result is stored in dst. The function skips leading white-space unless skip_space=false. If the number can't be parsed (invalid syntax, out of range), fallback value is stored instead. If require_trailing_space is true, the character after the number has to be whitespace.

Returns the start of remainder of the input string after parsing.

Definition at line 87 of file obj_import_string_utils.cc.

References drop_plus(), drop_whitespace(), ELEM, and is_whitespace().

Referenced by geom_add_curve_parameters(), blender::io::obj::MTLParser::parse_and_store(), parse_float(), parse_floats(), parse_texture_option(), TEST(), and TEST().

◆ parse_float() [2/2]

static StringRef blender::io::obj::parse_float ( StringRef s,
float fallback,
float & dst,
bool skip_space = true,
bool require_trailing_space = false )
static

Definition at line 51 of file obj_import_string_utils_tests.cc.

References parse_float().

◆ parse_floats()

const char * blender::io::obj::parse_floats ( const char * p,
const char * end,
float fallback,
float * dst,
int count,
bool require_trailing_space = false )

Parse a number of white-space separated floats from an input string. The parsed count numbers are stored in dst. If a number can't be parsed (invalid syntax, out of range), fallback value is stored instead.

Returns the start of remainder of the input string after parsing.

Definition at line 110 of file obj_import_string_utils.cc.

References count, and parse_float().

Referenced by geom_add_curve_vertex_indices(), geom_add_uv_vertex(), geom_add_vertex(), geom_add_vertex_normal(), blender::io::obj::MTLParser::parse_and_store(), and parse_texture_option().

◆ parse_int() [1/2]

const char * blender::io::obj::parse_int ( const char * p,
const char * end,
int fallback,
int & dst,
bool skip_space = true )

Parse an integer from an input string. The parsed result is stored in dst. The function skips leading white-space unless skip_space=false. If the number can't be parsed (invalid syntax, out of range), fallback value is stored instead.

Returns the start of remainder of the input string after parsing.

Definition at line 123 of file obj_import_string_utils.cc.

References drop_plus(), drop_whitespace(), and ELEM.

Referenced by geom_add_curve_vertex_indices(), geom_add_polygon(), geom_set_curve_degree(), geom_update_smooth_group(), parse_int(), parse_vertex_index(), TEST(), and TEST().

◆ parse_int() [2/2]

static StringRef blender::io::obj::parse_int ( StringRef s,
int fallback,
int & dst,
bool skip_space = true )
static

Definition at line 47 of file obj_import_string_utils_tests.cc.

References parse_int().

◆ parse_keyword()

static bool blender::io::obj::parse_keyword ( const char *& p,
const char * end,
StringRef keyword )
static

◆ parse_texture_map()

static void blender::io::obj::parse_texture_map ( const char * p,
const char * end,
MTLMaterial * material,
const char * mtl_dir_path )
static

◆ parse_texture_option()

◆ parse_vertex_index()

static const char * blender::io::obj::parse_vertex_index ( const char * p,
const char * end,
size_t n_elems,
int & r_index )
static

Parse vertex index and transform to non-negative, zero-based. Sets r_index to the index or INT32_MAX on error. Index is transformed and bounds-checked using n_vertices, which specifies the number of vertices that have been read before. Returns updated p.

Definition at line 149 of file obj_import_file_reader.cc.

References INT32_MAX, and parse_int().

Referenced by geom_add_polyline().

◆ print_exception_error()

static void blender::io::obj::print_exception_error ( const std::system_error & ex)
static

Definition at line 82 of file obj_exporter.cc.

Referenced by export_frame().

◆ read_next_line()

StringRef blender::io::obj::read_next_line ( StringRef & buffer)

Fetches next line from an input string buffer.

The returned line will not have '
' characters at the end; the buffer is modified to contain remaining text without the input line.

Definition at line 18 of file obj_import_string_utils.cc.

References blender::StringRefBase::begin(), blender::StringRefBase::end(), len, and ptr.

Referenced by blender::io::obj::OBJParser::parse(), blender::io::obj::MTLParser::parse_and_store(), and TEST().

◆ read_temp_file_in_string()

static std::string blender::io::obj::read_temp_file_in_string ( const std::string & file_path)
static

◆ round_float3_to_n_digits()

static float3 blender::io::obj::round_float3_to_n_digits ( const float3 & v,
int round_digits )
static

◆ round_float_to_n_digits()

static float blender::io::obj::round_float_to_n_digits ( const float f,
int round_digits )
static

Round f to round_digits decimal digits.

Definition at line 294 of file obj_export_mesh.cc.

References ceilf, powf, and round_float_to_n_digits().

Referenced by round_float3_to_n_digits(), and round_float_to_n_digits().

◆ set_bsdf_socket_values()

◆ set_property_of_socket()

static void blender::io::obj::set_property_of_socket ( eNodeSocketDatatype property_type,
const char * socket_id,
Span< float > value,
bNode * r_node )
static

Set the socket's (of given ID) value to the given number(s). Only float value(s) can be set using this method.

Definition at line 33 of file obj_import_mtl.cc.

References BLI_assert, copy_v3_v3(), copy_v4_v4(), blender::bke::node_find_socket(), SOCK_FLOAT, SOCK_IN, SOCK_RGBA, SOCK_VECTOR, bNodeSocketValueRGBA::value, and bNodeSocketValueVector::value.

Referenced by add_image_textures(), and set_bsdf_socket_values().

◆ spaces_to_underscores()

static void blender::io::obj::spaces_to_underscores ( std::string & r_name)
static

◆ store_bsdf_properties()

◆ store_image_textures()

static void blender::io::obj::store_image_textures ( const bNode * bsdf_node,
const bNodeTree * node_tree,
const Material * material,
MTLMaterial & r_mtl_mat )
static

◆ strings_equal_after_first_lines()

static bool blender::io::obj::strings_equal_after_first_lines ( const std::string & a,
const std::string & b )
static

◆ TEST() [1/11]

blender::io::obj::TEST ( obj_exporter_utils ,
append_large_positive_frame_to_filename  )

Definition at line 119 of file obj_exporter_tests.cc.

References append_frame_to_filename(), FILE_MAX, and SEP_STR.

◆ TEST() [2/11]

blender::io::obj::TEST ( obj_exporter_utils ,
append_negative_frame_to_filename  )

Definition at line 97 of file obj_exporter_tests.cc.

References append_frame_to_filename(), FILE_MAX, and SEP_STR.

◆ TEST() [3/11]

blender::io::obj::TEST ( obj_exporter_utils ,
append_positive_frame_to_filename  )

Definition at line 108 of file obj_exporter_tests.cc.

References append_frame_to_filename(), FILE_MAX, and SEP_STR.

◆ TEST() [4/11]

◆ TEST() [5/11]

blender::io::obj::TEST ( obj_import_string_utils ,
drop_whitespace  )

Definition at line 61 of file obj_import_string_utils_tests.cc.

References drop_whitespace(), and EXPECT_STRREF_EQ.

◆ TEST() [6/11]

blender::io::obj::TEST ( obj_import_string_utils ,
fixup_line_continuations  )

◆ TEST() [7/11]

blender::io::obj::TEST ( obj_import_string_utils ,
parse_float_invalid  )

Definition at line 137 of file obj_import_string_utils_tests.cc.

References EXPECT_EQ(), EXPECT_STRREF_EQ, and parse_float().

◆ TEST() [8/11]

blender::io::obj::TEST ( obj_import_string_utils ,
parse_float_valid  )

Definition at line 115 of file obj_import_string_utils_tests.cc.

References EXPECT_EQ(), parse_float(), and str.

◆ TEST() [9/11]

blender::io::obj::TEST ( obj_import_string_utils ,
parse_int_invalid  )

Definition at line 99 of file obj_import_string_utils_tests.cc.

References EXPECT_EQ(), EXPECT_STRREF_EQ, and parse_int().

◆ TEST() [10/11]

blender::io::obj::TEST ( obj_import_string_utils ,
parse_int_valid  )

Definition at line 79 of file obj_import_string_utils_tests.cc.

References EXPECT_EQ(), EXPECT_STRREF_EQ, parse_int(), and str.

◆ TEST() [11/11]

blender::io::obj::TEST ( obj_import_string_utils ,
read_next_line  )

Definition at line 13 of file obj_import_string_utils_tests.cc.

References EXPECT_STRREF_EQ, read_next_line(), and str.

◆ TEST_F() [1/60]

◆ TEST_F() [2/60]

blender::io::obj::TEST_F ( ObjExporterWriterTest ,
mtllib  )

◆ TEST_F() [3/60]

blender::io::obj::TEST_F ( OBJExportRegressionTest ,
all_curves  )

◆ TEST_F() [4/60]

◆ TEST_F() [5/60]

◆ TEST_F() [6/60]

◆ TEST_F() [7/60]

◆ TEST_F() [8/60]

blender::io::obj::TEST_F ( OBJExportRegressionTest ,
all_tris  )

◆ TEST_F() [9/60]

◆ TEST_F() [10/60]

◆ TEST_F() [11/60]

◆ TEST_F() [12/60]

◆ TEST_F() [13/60]

◆ TEST_F() [14/60]

◆ TEST_F() [15/60]

blender::io::obj::TEST_F ( OBJExportRegressionTest ,
cubes_with_textures_relative  )

◆ TEST_F() [16/60]

blender::io::obj::TEST_F ( OBJExportRegressionTest ,
cubes_with_textures_strip  )

◆ TEST_F() [17/60]

◆ TEST_F() [18/60]

◆ TEST_F() [19/60]

◆ TEST_F() [20/60]

◆ TEST_F() [21/60]

blender::io::obj::TEST_F ( OBJExportRegressionTest ,
non_uniform_scale  )

◆ TEST_F() [22/60]

◆ TEST_F() [23/60]

◆ TEST_F() [24/60]

◆ TEST_F() [25/60]

◆ TEST_F() [26/60]

◆ TEST_F() [27/60]

blender::io::obj::TEST_F ( OBJExportTest ,
filter_objects_curves_as_mesh  )

◆ TEST_F() [28/60]

◆ TEST_F() [29/60]

◆ TEST_F() [30/60]

blender::io::obj::TEST_F ( OBJImportTest ,
import_all_objects  )

Definition at line 573 of file obj_importer_tests.cc.

References OB_MESH.

◆ TEST_F() [31/60]

blender::io::obj::TEST_F ( OBJImportTest ,
import_cube  )

Definition at line 195 of file obj_importer_tests.cc.

References OB_MESH.

◆ TEST_F() [32/60]

blender::io::obj::TEST_F ( OBJImportTest ,
import_cube_o_after_verts  )

Definition at line 212 of file obj_importer_tests.cc.

References OB_MESH.

◆ TEST_F() [33/60]

blender::io::obj::TEST_F ( OBJImportTest ,
import_cubes_vertex_colors  )

Definition at line 734 of file obj_importer_tests.cc.

References OB_MESH.

◆ TEST_F() [34/60]

blender::io::obj::TEST_F ( OBJImportTest ,
import_cubes_vertex_colors_mrgb  )

Definition at line 805 of file obj_importer_tests.cc.

References OB_MESH.

◆ TEST_F() [35/60]

blender::io::obj::TEST_F ( OBJImportTest ,
import_cubes_with_textures_rel  )

Definition at line 430 of file obj_importer_tests.cc.

References OB_MESH.

◆ TEST_F() [36/60]

blender::io::obj::TEST_F ( OBJImportTest ,
import_faces_invalid_or_with_holes  )

Definition at line 486 of file obj_importer_tests.cc.

References OB_MESH.

◆ TEST_F() [37/60]

blender::io::obj::TEST_F ( OBJImportTest ,
import_invalid_faces  )

Definition at line 528 of file obj_importer_tests.cc.

References OB_MESH.

◆ TEST_F() [38/60]

blender::io::obj::TEST_F ( OBJImportTest ,
import_invalid_indices  )

Definition at line 537 of file obj_importer_tests.cc.

References OB_MESH.

◆ TEST_F() [39/60]

blender::io::obj::TEST_F ( OBJImportTest ,
import_invalid_syntax  )

Definition at line 555 of file obj_importer_tests.cc.

References OB_MESH.

◆ TEST_F() [40/60]

blender::io::obj::TEST_F ( OBJImportTest ,
import_materials  )

Definition at line 386 of file obj_importer_tests.cc.

References OB_MESH.

◆ TEST_F() [41/60]

blender::io::obj::TEST_F ( OBJImportTest ,
import_nurbs  )

Definition at line 260 of file obj_importer_tests.cc.

References OB_CURVES_LEGACY, and OB_MESH.

◆ TEST_F() [42/60]

blender::io::obj::TEST_F ( OBJImportTest ,
import_nurbs_curves  )

Definition at line 276 of file obj_importer_tests.cc.

References OB_CURVES_LEGACY, and OB_MESH.

◆ TEST_F() [43/60]

blender::io::obj::TEST_F ( OBJImportTest ,
import_nurbs_cyclic  )

Definition at line 303 of file obj_importer_tests.cc.

References OB_CURVES_LEGACY, and OB_MESH.

◆ TEST_F() [44/60]

blender::io::obj::TEST_F ( OBJImportTest ,
import_nurbs_endpoint  )

Definition at line 319 of file obj_importer_tests.cc.

References OB_CURVES_LEGACY, and OB_MESH.

◆ TEST_F() [45/60]

blender::io::obj::TEST_F ( OBJImportTest ,
import_nurbs_manual  )

Definition at line 351 of file obj_importer_tests.cc.

References OB_CURVES_LEGACY, and OB_MESH.

◆ TEST_F() [46/60]

blender::io::obj::TEST_F ( OBJImportTest ,
import_nurbs_mesh  )

Definition at line 370 of file obj_importer_tests.cc.

References OB_MESH.

◆ TEST_F() [47/60]

blender::io::obj::TEST_F ( OBJImportTest ,
import_polylines  )

Definition at line 950 of file obj_importer_tests.cc.

References OB_MESH.

◆ TEST_F() [48/60]

blender::io::obj::TEST_F ( OBJImportTest ,
import_split_options_by_group  )

Definition at line 907 of file obj_importer_tests.cc.

References OB_MESH, and params.

◆ TEST_F() [49/60]

blender::io::obj::TEST_F ( OBJImportTest ,
import_split_options_by_object  )

Definition at line 896 of file obj_importer_tests.cc.

References OB_MESH.

◆ TEST_F() [50/60]

blender::io::obj::TEST_F ( OBJImportTest ,
import_split_options_by_object_and_group  )

Definition at line 923 of file obj_importer_tests.cc.

References OB_MESH, and params.

◆ TEST_F() [51/60]

blender::io::obj::TEST_F ( OBJImportTest ,
import_split_options_none  )

Definition at line 939 of file obj_importer_tests.cc.

References OB_MESH, and params.

◆ TEST_F() [52/60]

blender::io::obj::TEST_F ( OBJImportTest ,
import_suzanne_all_data  )

Definition at line 242 of file obj_importer_tests.cc.

References OB_MESH.

◆ TEST_F() [53/60]

blender::io::obj::TEST_F ( OBJImportTest ,
import_vertex_colors_non_contiguous  )

Definition at line 856 of file obj_importer_tests.cc.

References OB_MESH.

◆ TEST_F() [54/60]

blender::io::obj::TEST_F ( OBJImportTest ,
import_vertices  )

Definition at line 886 of file obj_importer_tests.cc.

References OB_MESH.

◆ TEST_F() [55/60]

◆ TEST_F() [56/60]

◆ TEST_F() [57/60]

◆ TEST_F() [58/60]

◆ TEST_F() [59/60]

◆ TEST_F() [60/60]

◆ transform_object()

◆ use_all_vertices_if_no_faces()

static void blender::io::obj::use_all_vertices_if_no_faces ( Geometry * geom,
const Span< std::unique_ptr< Geometry > > all_geometries,
const GlobalVertices & global_vertices )
static

◆ write_mesh_objects()

static void blender::io::obj::write_mesh_objects ( const Span< std::unique_ptr< OBJMesh > > exportable_as_mesh,
OBJWriter & obj_writer,
MTLWriter * mtl_writer,
const OBJExportParams & export_params )
static

Definition at line 155 of file obj_exporter.cc.

References blender::io::obj::MTLWriter::add_materials(), blender::Vector< T, InlineBufferCapacity, Allocator >::append(), b, buffers, blender::io::obj::OBJMesh::calc_face_order(), blender::io::obj::OBJMesh::calc_smooth_groups(), blender::io::obj::OBJMesh::clear(), count, OBJExportParams::export_colors, OBJExportParams::export_materials, OBJExportParams::export_normals, OBJExportParams::export_smooth_groups, OBJExportParams::export_uv, blender::io::obj::OBJMesh::get_normal_coords(), blender::io::obj::OBJWriter::get_outfile(), blender::Vector< T, InlineBufferCapacity, Allocator >::is_empty(), blender::io::obj::MTLWriter::mtl_file_path(), blender::io::obj::MTLWriter::mtlmaterial_name(), blender::threading::parallel_for(), range, blender::Vector< T, InlineBufferCapacity, Allocator >::reserve(), blender::Span< T >::size(), OBJExportParams::smooth_groups_bitflags, blender::io::obj::OBJMesh::store_normal_coords_and_indices(), blender::io::obj::OBJMesh::store_uv_coords_and_indices(), blender::io::obj::OBJMesh::tot_faces(), blender::io::obj::OBJMesh::tot_uv_vertices(), blender::io::obj::OBJMesh::tot_vertices(), blender::io::obj::OBJWriter::write_edges_indices(), blender::io::obj::OBJWriter::write_face_elements(), blender::io::obj::OBJWriter::write_mtllib_name(), blender::io::obj::OBJWriter::write_normals(), blender::io::obj::OBJWriter::write_object_name(), blender::io::obj::OBJWriter::write_uv_coords(), and blender::io::obj::OBJWriter::write_vertex_coords().

Referenced by export_frame().

◆ write_nurbs_curve_objects()

static void blender::io::obj::write_nurbs_curve_objects ( const Span< std::unique_ptr< OBJCurve > > exportable_as_nurbs,
const OBJWriter & obj_writer )
static

Export NURBS Curves in parameter form, not as vertices and edges.

Definition at line 258 of file obj_exporter.cc.

References blender::io::obj::OBJWriter::get_outfile(), blender::io::obj::OBJWriter::write_nurbs_curve(), and blender::io::obj::FormatHandler::write_to_file().

Referenced by export_frame().

Variable Documentation

◆ all_objects_file

const std::string blender::io::obj::all_objects_file = "io_tests" SEP_STR "blend_scene" SEP_STR "all_objects.blend"

Definition at line 56 of file obj_exporter_tests.cc.

Referenced by TEST_F(), TEST_F(), and TEST_F().

◆ chunk_size

const int blender::io::obj::chunk_size = 32768
static

Definition at line 209 of file obj_export_file_writer.cc.

Referenced by calc_chunk_count(), and obj_parallel_chunked_output().

◆ DEFORM_GROUP_DISABLED

const char* blender::io::obj::DEFORM_GROUP_DISABLED = "off"
static

◆ MATERIAL_GROUP_DISABLED

const char* blender::io::obj::MATERIAL_GROUP_DISABLED = ""
static

Per reference http://www.martinreddy.net/gfx/3d/OBJ.spec: Once a material is assigned, it cannot be turned off; it can only be changed. If a material name is not specified, a white material is used. So an empty material name is written.

Definition at line 50 of file obj_export_file_writer.cc.

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

◆ NEGATIVE_INIT

const int blender::io::obj::NEGATIVE_INIT = -10

Any negative number other than NOT_FOUND to initialize usually non-negative numbers.

Definition at line 29 of file obj_export_mesh.hh.

Referenced by get_smooth_group(), blender::io::obj::OBJMesh::ith_smooth_group(), and blender::io::obj::OBJWriter::write_face_elements().

◆ node_locx_bsdf

const float blender::io::obj::node_locx_bsdf = 0.0f

Definition at line 148 of file obj_import_mtl.cc.

Referenced by create_mtl_node_tree().

◆ node_locx_image

const float blender::io::obj::node_locx_image = -480.0f

Definition at line 146 of file obj_import_mtl.cc.

Referenced by add_image_textures().

◆ node_locx_mapping

const float blender::io::obj::node_locx_mapping = -680.0f

Definition at line 145 of file obj_import_mtl.cc.

Referenced by add_image_textures().

◆ node_locx_normalmap

const float blender::io::obj::node_locx_normalmap = -200.0f

Definition at line 147 of file obj_import_mtl.cc.

Referenced by add_image_textures().

◆ node_locx_output

const float blender::io::obj::node_locx_output = 280.0f

Definition at line 149 of file obj_import_mtl.cc.

Referenced by create_mtl_node_tree().

◆ node_locx_texcoord

const float blender::io::obj::node_locx_texcoord = -880.0f

Definition at line 144 of file obj_import_mtl.cc.

Referenced by add_image_textures().

◆ node_locy_step

const float blender::io::obj::node_locy_step = 300.0f

Definition at line 153 of file obj_import_mtl.cc.

Referenced by add_image_textures().

◆ node_locy_top

const float blender::io::obj::node_locy_top = 300.0f

Definition at line 152 of file obj_import_mtl.cc.

Referenced by add_image_textures(), and create_mtl_node_tree().

◆ NOT_FOUND

const int blender::io::obj::NOT_FOUND = -1

Denote absence for usually non-negative numbers.

Definition at line 27 of file obj_export_mesh.hh.

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

◆ save_failing_test_output

bool blender::io::obj::save_failing_test_output = false
constexpr

◆ SMOOTH_GROUP_DEFAULT

const int blender::io::obj::SMOOTH_GROUP_DEFAULT = 1

Definition at line 40 of file obj_export_file_writer.cc.

Referenced by get_smooth_group().

◆ SMOOTH_GROUP_DISABLED

const int blender::io::obj::SMOOTH_GROUP_DISABLED = 0

Per reference http://www.martinreddy.net/gfx/3d/OBJ.spec: To turn off smoothing groups, use a value of 0 or off. Polygonal elements use group numbers to put elements in different smoothing groups. For free-form surfaces, smoothing groups are either turned on or off; there is no difference between values greater than 0.

Definition at line 39 of file obj_export_file_writer.cc.

Referenced by get_smooth_group().

◆ tex_map_type_to_socket_id

const char * blender::io::obj::tex_map_type_to_socket_id
Initial value:
= {
"Base Color",
"Metallic",
"Specular IOR Level",
"Roughness",
"Roughness",
"Sheen Weight",
"Metallic",
"Emission Color",
"Alpha",
"Normal",
}

Definition at line 27 of file obj_export_mtl.cc.

Referenced by add_image_textures(), and store_image_textures().

◆ tex_map_type_to_string

const char* blender::io::obj::tex_map_type_to_string[]
static
Initial value:
= {
"map_Kd",
"map_Pm",
"map_Ks",
"map_Ns",
"map_Pr",
"map_Ps",
"map_refl",
"map_Ke",
"map_d",
"map_Bump",
}

Definition at line 509 of file obj_export_file_writer.cc.

◆ unsupported_texture_options

const std::pair<StringRef, int> blender::io::obj::unsupported_texture_options[]
static
Initial value:
= {
{"-blendu", 1},
{"-blendv", 1},
{"-boost", 1},
{"-cc", 1},
{"-clamp", 1},
{"-imfchan", 1},
{"-mm", 2},
{"-t", 3},
{"-texres", 1},
}

Definition at line 724 of file obj_import_file_reader.cc.

Referenced by parse_texture_option().