Blender V5.0
blender::io::obj Namespace Reference

Classes

struct  IndexOffsets
class  OBJWriter
class  MTLWriter
class  FormatHandler
class  OBJMesh
struct  MTLTexMap
struct  MTLMaterial
class  IOBJCurve
class  OBJCurves
class  OBJLegacyCurve
class  OBJDepsgraph
class  OBJParser
class  MTLParser
class  MeshFromGeometry
class  CurveFromGeometry
struct  GlobalVertices
struct  FaceCorner
struct  FaceElem
struct  NurbsElement
struct  Geometry
class  OBJExportTest
class  ObjExporterWriterTest
class  OBJExportRegressionTest
class  OBJMTLParserTest
class  OBJCurvesTest

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 float4x4 compute_world_axes_transform (const OBJExportParams &export_params, const blender::float4x4 &object_to_world)
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< IOBJCurve > > > 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< IOBJCurve > > exportable_as_nurbs, const OBJWriter &obj_writer)
static bool open_stream_writers (const OBJExportParams &export_params, const char *filepath, std::unique_ptr< OBJWriter > &r_frame_writer, std::unique_ptr< MTLWriter > &r_mtl_writer)
static void write_materials (MTLWriter *mtl_writer, const OBJExportParams &export_params)
void export_objects (const OBJExportParams &export_params, const Span< std::unique_ptr< OBJMesh > > meshes, const Span< std::unique_ptr< IOBJCurve > > curves, const char *filepath)
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, 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, 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, eOBJMtlNameCollisionMode mtl_name_collision_mode)
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)
static int8_t get_valid_nurbs_degree (const NurbsElement &element)
static int repeating_cyclic_point_num (const int8_t order, const Span< float > knots)
static bool detect_clamped_endpoint (const int8_t degree, const Span< int > multiplicity)
static bool almost_equal_relative (const float a, const float b, const float epsilon)
static bool detect_knot_mode_cyclic (const int8_t degree, const Span< int > indices, const Span< float > knots, const Span< int > multiplicity, const bool is_clamped)
static bool detect_knot_mode_bezier_clamped (const int8_t degree, const int num_points, const Span< int > multiplicity)
static bool detect_knot_mode_uniform (const int8_t degree, const Span< float > knots, const Span< int > multiplicity, const bool clamped)
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, BufferRefillTest)
 TEST_F (OBJMTLParserTest, string_newlines_whitespace)
 TEST_F (OBJMTLParserTest, materials)
 TEST_F (OBJMTLParserTest, materials_pbr)
static OBJExportParams default_export_params (const std::string &filepath)
static OBJImportParams default_import_params (const std::string &filepath)
Utility
static int find_leftmost_span (const int8_t order, const Span< int > multiplicity)
static int find_rightmost_span (const int8_t order, const Span< int > multiplicity)
Span< floatvalid_nurb_control_point_range (const int8_t order, const Span< float > knots, IndexRange &point_range)
Knot vector: KnotMode::NURBS_KNOT_MODE_NORMAL
 TEST_F (OBJCurvesTest, nurbs_io_uniform_polyline)
 TEST_F (OBJCurvesTest, nurbs_io_uniform_deg5)
 TEST_F (OBJCurvesTest, nurbs_io_uniform_clamped_polyline)
 TEST_F (OBJCurvesTest, nurbs_io_uniform_endpoint_clamped_deg3)
 TEST_F (OBJCurvesTest, nurbs_io_uniform_endpoint_clamped_deg5)
 TEST_F (OBJCurvesTest, nurbs_io_uniform_cyclic_polyline)
 TEST_F (OBJCurvesTest, nurbs_io_uniform_cyclic_deg4)
 TEST_F (OBJCurvesTest, nurbs_io_uniform_cyclic_clamped_deg4)
Knot vector: KnotMode::NURBS_KNOT_MODE_ENDPOINT_BEZIER
 TEST_F (OBJCurvesTest, nurbs_io_bezier_clamped_single_segment_deg2)
 TEST_F (OBJCurvesTest, nurbs_io_bezier_clamped_single_segment_deg4)
 TEST_F (OBJCurvesTest, nurbs_io_bezier_clamped_deg2)
 TEST_F (OBJCurvesTest, nurbs_io_bezier_clamped_uneven_deg2)
 TEST_F (OBJCurvesTest, nurbs_io_bezier_clamped_deg4)
 TEST_F (OBJCurvesTest, nurbs_io_bezier_clamped_cyclic_deg4_looped_12)
 TEST_F (OBJCurvesTest, nurbs_io_bezier_clamped_cyclic_deg4_looped_8)
 TEST_F (OBJCurvesTest, nurbs_io_bezier_clamped_cyclic_deg4_discontinous_13)
 TEST_F (OBJCurvesTest, nurbs_io_bezier_clamped_cyclic_deg4_discontinous_11)
 TEST_F (OBJCurvesTest, nurbs_io_bezier_clamped_cyclic_deg4_discontinous_10)
 TEST_F (OBJCurvesTest, nurbs_io_bezier_clamped_cyclic_deg4_discontinous_9)
Knot vector: KnotMode::NURBS_KNOT_MODE_BEZIER
 TEST_F (OBJCurvesTest, nurbs_io_bezier_cyclic_deg4_looped_12)
 TEST_F (OBJCurvesTest, nurbs_io_bezier_cyclic_deg4_looped_discontinous_13)
 TEST_F (OBJCurvesTest, nurbs_io_bezier_cyclic_deg4_looped_discontinous_11)
 TEST_F (OBJCurvesTest, nurbs_io_bezier_cyclic_deg4_looped_discontinous_10)
 TEST_F (OBJCurvesTest, nurbs_io_bezier_cyclic_deg4_looped_discontinous_9)
 TEST_F (OBJCurvesTest, nurbs_io_bezier_cyclic_deg4_looped_8)

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, int > unsupported_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"
const std::array< float3, 13 > position_array
const Span< float3position_data = Span<float3>(position_array)

<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 127 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()

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

◆ almost_equal_relative()

bool blender::io::obj::almost_equal_relative ( const float a,
const float b,
const float epsilon )
static

Definition at line 210 of file obj_import_nurbs.cc.

References b.

Referenced by detect_knot_mode_cyclic(), and detect_knot_mode_uniform().

◆ 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 361 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"  )

References Count, and tex_map_type_to_socket_id.

◆ BLI_STATIC_ASSERT() [2/2]

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

References Count, and tex_map_type_to_string.

◆ calc_chunk_count()

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

Definition at line 234 of file obj_export_file_writer.cc.

References chunk_size, and count.

Referenced by obj_parallel_chunked_output().

◆ compute_world_axes_transform()

◆ copy_property_from_node()

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()

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()

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

◆ default_export_params()

OBJExportParams blender::io::obj::default_export_params ( const std::string & filepath)
static

Definition at line 22 of file obj_nurbs_io_tests.cc.

References IO_AXIS_Y, IO_AXIS_Z, params, and STRNCPY().

Referenced by blender::io::obj::OBJCurvesTest::run_nurbs_test().

◆ default_import_params()

OBJImportParams blender::io::obj::default_import_params ( const std::string & filepath)
static

Definition at line 31 of file obj_nurbs_io_tests.cc.

References IO_AXIS_Y, IO_AXIS_Z, params, and STRNCPY().

Referenced by blender::io::obj::OBJCurvesTest::run_nurbs_test().

◆ detect_clamped_endpoint()

bool blender::io::obj::detect_clamped_endpoint ( const int8_t degree,
const Span< int > multiplicity )
static

Definition at line 195 of file obj_import_nurbs.cc.

References blender::Span< T >::first(), and blender::Span< T >::last().

◆ detect_knot_mode_bezier_clamped()

bool blender::io::obj::detect_knot_mode_bezier_clamped ( const int8_t degree,
const int num_points,
const Span< int > multiplicity )
static

◆ detect_knot_mode_cyclic()

bool blender::io::obj::detect_knot_mode_cyclic ( const int8_t degree,
const Span< int > indices,
const Span< float > knots,
const Span< int > multiplicity,
const bool is_clamped )
static

◆ detect_knot_mode_uniform()

bool blender::io::obj::detect_knot_mode_uniform ( const int8_t degree,
const Span< float > knots,
const Span< int > multiplicity,
const bool clamped )
static

◆ 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 348 of file obj_exporter.cc.

References BKE_reportf(), depsgraph, export_objects(), filter_supported_objects(), OBJExportParams::reports, and RPT_WARNING.

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

◆ export_objects()

void blender::io::obj::export_objects ( const OBJExportParams & export_params,
const Span< std::unique_ptr< OBJMesh > > meshes,
const Span< std::unique_ptr< IOBJCurve > > curves,
const char * filepath )

◆ 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 371 of file obj_exporter.cc.

References append_frame_to_filename(), BKE_libblock_find_name(), BKE_reportf(), C, RenderData::cfra, CLOG_ERROR, 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, LOG, blender::ed::object::mode_set(), OB_MODE_OBJECT, Scene::r, 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< IOBJCurve > > > 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 110 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, ListBase::first, DEGObjectIterSettings::flags, is_curve_nurbs_compatible(), Curve::nurb, OB_CURVES_LEGACY, OB_MESH, and OB_SURF.

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

◆ find_bsdf_node()

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 175 of file obj_export_mtl.cc.

References SH_NODE_BSDF_PRINCIPLED, and bNode::typeinfo.

Referenced by mtlmaterial_for_material().

◆ find_leftmost_span()

int blender::io::obj::find_leftmost_span ( const int8_t order,
const Span< int > multiplicity )
static

Definition at line 31 of file obj_export_nurbs.cc.

References BLI_assert.

Referenced by valid_nurb_control_point_range().

◆ find_or_create_collection()

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

◆ find_rightmost_span()

int blender::io::obj::find_rightmost_span ( const int8_t order,
const Span< int > multiplicity )
static

Definition at line 44 of file obj_export_nurbs.cc.

References BLI_assert, and blender::Span< T >::size().

Referenced by valid_nurb_control_point_range().

◆ fixup_invalid_face()

Vector< Vector< int > > blender::io::obj::fixup_invalid_face ( Span< float3 > vert_positions,
Span< int > face_verts )

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, blender::meshintersect::delaunay_2d_calc(), blender::meshintersect::CDT_result< T >::face, blender::bke::mesh::face_normal_calc(), faces, blender::Array< T, InlineBufferCapacity, Allocator >::first(), i, blender::Span< T >::index_range(), input, mul_v2_m3v3(), blender::Vector< T, InlineBufferCapacity, Allocator >::reserve(), blender::Array< T, InlineBufferCapacity, Allocator >::size(), blender::Span< T >::size(), and blender::meshintersect::CDT_result< T >::vert_orig.

◆ float3_to_string()

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 583 of file obj_export_file_writer.cc.

◆ geom_add_curve_parameters()

◆ geom_add_curve_vertex_indices()

◆ geom_add_mrgb_colors()

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()

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 175 of file obj_import_file_reader.cc.

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

◆ geom_add_uv_vertex()

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

◆ geom_add_vertex()

◆ geom_add_vertex_normal()

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

◆ geom_new_object()

void blender::io::obj::geom_new_object ( const char * p,
const char * end,
bool & r_state_shaded_smooth,
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 410 of file obj_import_file_reader.cc.

References create_geometry(), and GEOM_MESH.

◆ geom_set_curve_degree()

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

◆ geom_set_curve_type()

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()

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

Definition at line 383 of file obj_import_file_reader.cc.

References blender::StringRefBase::find().

◆ geom_update_smooth_group()

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

◆ geometry_to_blender_geometry_set()

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()

void blender::io::obj::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 )
static

◆ get_geometry_name()

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

◆ get_image_filepath()

◆ get_node_of_type()

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 121 of file obj_export_mtl.cc.

References bNode::typeinfo.

Referenced by store_image_textures().

◆ get_or_create_material()

◆ get_smooth_group()

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

◆ get_valid_nurbs_degree()

int8_t blender::io::obj::get_valid_nurbs_degree ( const NurbsElement & element)
static

Definition at line 70 of file obj_import_nurbs.cc.

References element.

◆ importer_geometry()

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

◆ importer_main() [1/2]

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

Definition at line 205 of file obj_importer.cc.

References C, CTX_data_main(), CTX_data_scene(), CTX_data_view_layer(), and importer_main().

Referenced by importer_main(), and OBJ_import().

◆ importer_main() [2/2]

◆ is_curve_nurbs_compatible()

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

Definition at line 93 of file obj_exporter.cc.

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

Referenced by filter_supported_objects().

◆ is_non_pbr_map()

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

◆ is_pbr_map()

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

Definition at line 723 of file obj_export_file_writer.cc.

References Metallic, Roughness, and Sheen.

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

◆ link_sockets()

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()

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

Collect all the source sockets linked to the destination socket in a destination node.

Definition at line 93 of file obj_export_mtl.cc.

References blender::Vector< T, InlineBufferCapacity, Allocator >::clear(), blender::Span< T >::first(), bNode::idname, blender::Vector< T, InlineBufferCapacity, Allocator >::resize(), blender::Span< T >::size(), and STREQ.

Referenced by store_image_textures().

◆ load_image_at_path()

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

◆ load_texture_image()

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

◆ mtl_line_start_to_texture_type()

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

◆ mtlmaterial_for_material()

◆ obj_parallel_chunked_output()

◆ open_stream_writers()

bool blender::io::obj::open_stream_writers ( const OBJExportParams & export_params,
const char * filepath,
std::unique_ptr< OBJWriter > & r_frame_writer,
std::unique_ptr< MTLWriter > & r_mtl_writer )
static

◆ parse_keyword()

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

◆ parse_texture_map()

◆ parse_texture_option()

◆ parse_vertex_index()

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 153 of file obj_import_file_reader.cc.

References CLOG_WARN, INT32_MAX, LOG, and blender::io::parse_int().

Referenced by geom_add_polyline().

◆ print_exception_error()

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

Definition at line 88 of file obj_exporter.cc.

References CLOG_ERROR, and LOG.

Referenced by open_stream_writers().

◆ read_temp_file_in_string()

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

◆ repeating_cyclic_point_num()

int blender::io::obj::repeating_cyclic_point_num ( const int8_t order,
const Span< float > knots )
static

Get the number of control points repeated for a cyclic curve given the multiplicity found at the endpoints (assumes cyclic curve).

Definition at line 82 of file obj_import_nurbs.cc.

References BLI_assert, blender::bke::curves::nurbs::calculate_multiplicity_sequence(), blender::Vector< T, InlineBufferCapacity, Allocator >::first(), and blender::Span< T >::slice().

Referenced by detect_knot_mode_cyclic().

◆ round_float3_to_n_digits()

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

◆ round_float_to_n_digits()

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 309 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()

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

◆ spaces_to_underscores()

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

◆ store_bsdf_properties()

◆ store_image_textures()

◆ strings_equal_after_first_lines()

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

◆ TEST() [1/5]

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

Definition at line 112 of file obj_exporter_tests.cc.

References append_frame_to_filename(), FILE_MAX, and SEP_STR.

◆ TEST() [2/5]

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

Definition at line 90 of file obj_exporter_tests.cc.

References append_frame_to_filename(), FILE_MAX, and SEP_STR.

◆ TEST() [3/5]

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

Definition at line 101 of file obj_exporter_tests.cc.

References append_frame_to_filename(), FILE_MAX, and SEP_STR.

◆ TEST() [4/5]

◆ TEST() [5/5]

◆ TEST_F() [1/57]

blender::io::obj::TEST_F ( OBJCurvesTest ,
nurbs_io_bezier_clamped_cyclic_deg4_discontinous_10  )

◆ TEST_F() [2/57]

blender::io::obj::TEST_F ( OBJCurvesTest ,
nurbs_io_bezier_clamped_cyclic_deg4_discontinous_11  )

◆ TEST_F() [3/57]

blender::io::obj::TEST_F ( OBJCurvesTest ,
nurbs_io_bezier_clamped_cyclic_deg4_discontinous_13  )

◆ TEST_F() [4/57]

blender::io::obj::TEST_F ( OBJCurvesTest ,
nurbs_io_bezier_clamped_cyclic_deg4_discontinous_9  )

◆ TEST_F() [5/57]

blender::io::obj::TEST_F ( OBJCurvesTest ,
nurbs_io_bezier_clamped_cyclic_deg4_looped_12  )

Definition at line 370 of file obj_nurbs_io_tests.cc.

References position_data, result, and blender::Span< T >::slice().

◆ TEST_F() [6/57]

blender::io::obj::TEST_F ( OBJCurvesTest ,
nurbs_io_bezier_clamped_cyclic_deg4_looped_8  )

Definition at line 381 of file obj_nurbs_io_tests.cc.

References position_data, and result.

◆ TEST_F() [7/57]

blender::io::obj::TEST_F ( OBJCurvesTest ,
nurbs_io_bezier_clamped_deg2  )

Definition at line 308 of file obj_nurbs_io_tests.cc.

References position_data, and result.

◆ TEST_F() [8/57]

blender::io::obj::TEST_F ( OBJCurvesTest ,
nurbs_io_bezier_clamped_deg4  )

Definition at line 330 of file obj_nurbs_io_tests.cc.

References position_data, result, and blender::Span< T >::slice().

◆ TEST_F() [9/57]

blender::io::obj::TEST_F ( OBJCurvesTest ,
nurbs_io_bezier_clamped_single_segment_deg2  )

Definition at line 286 of file obj_nurbs_io_tests.cc.

References position_data, and result.

◆ TEST_F() [10/57]

blender::io::obj::TEST_F ( OBJCurvesTest ,
nurbs_io_bezier_clamped_single_segment_deg4  )

Definition at line 297 of file obj_nurbs_io_tests.cc.

References position_data, and result.

◆ TEST_F() [11/57]

blender::io::obj::TEST_F ( OBJCurvesTest ,
nurbs_io_bezier_clamped_uneven_deg2  )

Definition at line 319 of file obj_nurbs_io_tests.cc.

References position_data, result, and blender::Span< T >::slice().

◆ TEST_F() [12/57]

◆ TEST_F() [13/57]

◆ TEST_F() [14/57]

◆ TEST_F() [15/57]

◆ TEST_F() [16/57]

◆ TEST_F() [17/57]

◆ TEST_F() [18/57]

blender::io::obj::TEST_F ( OBJCurvesTest ,
nurbs_io_uniform_clamped_polyline  )

Definition at line 212 of file obj_nurbs_io_tests.cc.

References position_data, and result.

◆ TEST_F() [19/57]

blender::io::obj::TEST_F ( OBJCurvesTest ,
nurbs_io_uniform_cyclic_clamped_deg4  )

Definition at line 269 of file obj_nurbs_io_tests.cc.

References position_data, and result.

◆ TEST_F() [20/57]

blender::io::obj::TEST_F ( OBJCurvesTest ,
nurbs_io_uniform_cyclic_deg4  )

Definition at line 258 of file obj_nurbs_io_tests.cc.

References position_data, and result.

◆ TEST_F() [21/57]

blender::io::obj::TEST_F ( OBJCurvesTest ,
nurbs_io_uniform_cyclic_polyline  )

Definition at line 245 of file obj_nurbs_io_tests.cc.

References position_data, and result.

◆ TEST_F() [22/57]

blender::io::obj::TEST_F ( OBJCurvesTest ,
nurbs_io_uniform_deg5  )

Definition at line 201 of file obj_nurbs_io_tests.cc.

References position_data, and result.

◆ TEST_F() [23/57]

blender::io::obj::TEST_F ( OBJCurvesTest ,
nurbs_io_uniform_endpoint_clamped_deg3  )

Definition at line 223 of file obj_nurbs_io_tests.cc.

References position_data, and result.

◆ TEST_F() [24/57]

blender::io::obj::TEST_F ( OBJCurvesTest ,
nurbs_io_uniform_endpoint_clamped_deg5  )

Definition at line 234 of file obj_nurbs_io_tests.cc.

References position_data, and result.

◆ TEST_F() [25/57]

◆ TEST_F() [26/57]

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

◆ TEST_F() [27/57]

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

Definition at line 189 of file obj_exporter_tests.cc.

References params, read_temp_file_in_string(), and result.

◆ TEST_F() [28/57]

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

Definition at line 551 of file obj_exporter_tests.cc.

References params, and SEP_STR.

◆ TEST_F() [29/57]

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

Definition at line 561 of file obj_exporter_tests.cc.

References params, and SEP_STR.

◆ TEST_F() [30/57]

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

Definition at line 572 of file obj_exporter_tests.cc.

References params, and SEP_STR.

◆ TEST_F() [31/57]

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

Definition at line 585 of file obj_exporter_tests.cc.

References params, and SEP_STR.

◆ TEST_F() [32/57]

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

Definition at line 339 of file obj_exporter_tests.cc.

References params, and SEP_STR.

◆ TEST_F() [33/57]

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

Definition at line 330 of file obj_exporter_tests.cc.

References save_failing_test_output.

◆ TEST_F() [34/57]

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

Definition at line 449 of file obj_exporter_tests.cc.

References params, and SEP_STR.

◆ TEST_F() [35/57]

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

Definition at line 387 of file obj_exporter_tests.cc.

References params, and SEP_STR.

◆ TEST_F() [36/57]

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

Definition at line 462 of file obj_exporter_tests.cc.

References params, and SEP_STR.

◆ TEST_F() [37/57]

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

Definition at line 475 of file obj_exporter_tests.cc.

References params, and SEP_STR.

◆ TEST_F() [38/57]

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

Definition at line 489 of file obj_exporter_tests.cc.

References params, and SEP_STR.

◆ TEST_F() [39/57]

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

Definition at line 501 of file obj_exporter_tests.cc.

References params, and SEP_STR.

◆ TEST_F() [40/57]

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

Definition at line 526 of file obj_exporter_tests.cc.

References params, PATH_REFERENCE_STRIP, and SEP_STR.

◆ TEST_F() [41/57]

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

Definition at line 515 of file obj_exporter_tests.cc.

References params, and SEP_STR.

◆ TEST_F() [42/57]

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

Definition at line 362 of file obj_exporter_tests.cc.

References IO_AXIS_Z, params, and SEP_STR.

◆ TEST_F() [43/57]

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

Definition at line 350 of file obj_exporter_tests.cc.

References params, and SEP_STR.

◆ TEST_F() [44/57]

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

Definition at line 609 of file obj_exporter_tests.cc.

References params, PATH_REFERENCE_RELATIVE, and SEP_STR.

◆ TEST_F() [45/57]

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

Definition at line 598 of file obj_exporter_tests.cc.

References params, and SEP_STR.

◆ TEST_F() [46/57]

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

Definition at line 399 of file obj_exporter_tests.cc.

References IO_AXIS_Z, params, and SEP_STR.

◆ TEST_F() [47/57]

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

Definition at line 436 of file obj_exporter_tests.cc.

References params, and SEP_STR.

◆ TEST_F() [48/57]

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

Definition at line 410 of file obj_exporter_tests.cc.

References params, and SEP_STR.

◆ TEST_F() [49/57]

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

Definition at line 423 of file obj_exporter_tests.cc.

References params, and SEP_STR.

◆ TEST_F() [50/57]

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

Definition at line 537 of file obj_exporter_tests.cc.

References params, PATH_REFERENCE_RELATIVE, and SEP_STR.

◆ TEST_F() [51/57]

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

Definition at line 374 of file obj_exporter_tests.cc.

References IO_AXIS_Z, params, and SEP_STR.

◆ TEST_F() [52/57]

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

◆ TEST_F() [53/57]

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

◆ TEST_F() [54/57]

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

◆ TEST_F() [55/57]

◆ TEST_F() [56/57]

◆ TEST_F() [57/57]

◆ transform_object()

void blender::io::obj::transform_object ( Object * object,
const OBJImportParams & import_params )

◆ use_all_vertices_if_no_faces()

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

◆ valid_nurb_control_point_range()

Span< float > blender::io::obj::valid_nurb_control_point_range ( int8_t order,
Span< float > knots,
IndexRange & point_range )

Finds the range within the control points that represents the sequence of valid spans or 'segments'.

For example, if a NURBS curve of order 2 has following 5 knots: [0, 0, 0, 1, 1] associated to three control points. Valid control point range would be the interval [1, 2] and the knot sequence [0, 0, 1, 1] since the first knot/point does not contribute to any span/segment.

Definition at line 55 of file obj_export_nurbs.cc.

References blender::Vector< T, InlineBufferCapacity, Allocator >::begin(), BLI_assert, blender::bke::curves::nurbs::calculate_multiplicity_sequence(), blender::IndexRange::drop_back(), blender::Span< T >::drop_back(), blender::IndexRange::drop_front(), blender::Span< T >::drop_front(), blender::Vector< T, InlineBufferCapacity, Allocator >::end(), find_leftmost_span(), find_rightmost_span(), blender::bke::curves::nurbs::knots_num(), blender::IndexRange::size(), blender::Span< T >::size(), and blender::Span< T >::slice().

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

◆ write_materials()

◆ write_mesh_objects()

◆ write_nurbs_curve_objects()

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

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

Definition at line 264 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_objects().

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 49 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 233 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 57 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 27 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 151 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 149 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 148 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 150 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 152 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 147 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 156 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 155 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 25 of file obj_export_mesh.hh.

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

◆ position_array

const std::array<float3, 13> blender::io::obj::position_array
Initial value:
{float3{1.0f, -1.0f, 2.0f},
float3{2.0f, -2.0f, 4.0f},
float3{3.0f, -3.0f, 6.0f},
float3{4.0f, -4.0f, 8.0f},
float3{5.0f, -5.0f, 10.0f},
float3{6.0f, -6.0f, 12.0f},
float3{7.0f, -7.0f, 14.0f},
float3{1.0f / 4.0f, -2.0f, 3.0f / 6.0f},
float3{1.0f / 6.0f, -3.0f, 3.0f / 9.0f},
float3{1.0f / 8.0f, -4.0f, 3.0f / 12.0f},
float3{1.0f / 5.0f, -5.0f, 3.0f / 11.0f},
float3{1.0f / 3.0f, -6.0f, 3.0f / 10.0f},
float3{1.0f / 2.0f, -7.0f, 3.0f / 9.0f}}
VecBase< float, 3 > float3

Definition at line 157 of file obj_nurbs_io_tests.cc.

◆ position_data

◆ 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 47 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 46 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 28 of file obj_export_mtl.cc.

Referenced by add_image_textures(), BLI_STATIC_ASSERT(), 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 564 of file obj_export_file_writer.cc.

Referenced by BLI_STATIC_ASSERT().

◆ 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 751 of file obj_import_file_reader.cc.

Referenced by parse_texture_option().