Blender V5.3
blender::io::stl Namespace Reference

Classes

class  FileWriter
struct  PackedTriangle
class  STLExportTest
class  STLMeshHelper
class  StringBuffer
class  Triangle

Functions

void export_frame (Depsgraph *depsgraph, float scene_unit_scale, const STLExportParams &export_params)
void exporter_main (const bContext *C, const STLExportParams &export_params)
void stl_import_report_error (FILE *file)
Mesh * read_stl_file (const STLImportParams &import_params)
void importer_main (const bContext *C, const STLImportParams &import_params)
void importer_main (Main *bmain, Scene *scene, ViewLayer *view_layer, const STLImportParams &import_params)
static void parse_float3 (StringBuffer &buf, float3 &out)
Mesh * read_stl_ascii (const char *filepath, const bool use_custom_normals)
Mesh * read_stl_binary (FILE *file, const bool use_custom_normals)
static std::string read_temp_file_in_string (const std::string &file_path)
 TEST_F (STLExportTest, all_tris)
 TEST_F (STLExportTest, all_quads)
 TEST_F (STLExportTest, non_uniform_scale)
 TEST_F (STLExportTest, cubes_positioned)

Variables

static CLG_LogRef LOG = {"io.stl"}
constexpr size_t BINARY_HEADER_SIZE = 80
constexpr size_t BINARY_STRIDE = sizeof(PackedTriangle)
constexpr bool save_failing_test_output = false

Detailed Description

ASCII STL spec:

solid name
  facet normal ni nj nk
    outer loop
      vertex v1x v1y v1z
      vertex v2x v2y v2z
      vertex v3x v3y v3z
    endloop
  endfacet
  ...
endsolid name

Function Documentation

◆ export_frame()

void blender::io::stl::export_frame ( Depsgraph * depsgraph,
float scene_unit_scale,
const STLExportParams & export_params )

Definition at line 49 of file stl_export.cc.

References blender::STLExportParams::apply_modifiers, blender::STLExportParams::ascii_format, blender::BASE_SELECTED, blender::BKE_mesh_wrapper_ensure_mdata(), blender::BKE_reportf(), blender::BLI_path_basename(), blender::BLI_path_extension_check(), blender::BLI_path_extension_ensure(), blender::BLI_path_make_safe_filename(), blender::BLI_path_suffix(), blender::BLI_strcasecmp(), blender::BLI_string_replace_char(), CLOG_ERROR, blender::data, blender::DEG_get_evaluated(), blender::DEG_ITER_OBJECT_FLAG_DUPLI, blender::DEG_ITER_OBJECT_FLAG_LINKED_DIRECTLY, blender::DEG_ITER_OBJECT_FLAG_LINKED_VIA_SET, blender::DEG_ITER_OBJECT_FLAG_VISIBLE, DEG_OBJECT_ITER_BEGIN, DEG_OBJECT_ITER_END, blender::DEGObjectIterSettings::depsgraph, export_frame(), blender::STLExportParams::export_selected_objects, FILE_MAX, blender::STLExportParams::filepath, blender::DEGObjectIterSettings::flags, blender::STLExportParams::forward_axis, blender::STLExportParams::global_scale, blender::IO_AXIS_Y, blender::IO_AXIS_Z, blender::is_negative_m4(), blender::LOG, blender::mat3_from_axis_conversion(), blender::io::mesh_coerce_for_export_setup(), blender::mul_m4_m3m4(), blender::mul_m4_v3(), blender::mul_v3_m3v3(), blender::math::normal_tri(), blender::OB_MESH, blender::STLExportParams::reports, blender::RPT_ERROR, blender::STRNCPY(), blender::unit_m3(), blender::STLExportParams::up_axis, and blender::STLExportParams::use_batch.

Referenced by blender::io::stl::STLExportTest::compare_to_golden(), export_frame(), and exporter_main().

◆ exporter_main()

◆ importer_main() [1/2]

void blender::io::stl::importer_main ( const bContext * C,
const STLImportParams & import_params )

◆ importer_main() [2/2]

void blender::io::stl::importer_main ( Main * bmain,
Scene * scene,
ViewLayer * view_layer,
const STLImportParams & import_params )

Definition at line 119 of file stl_import.cc.

References blender::BKE_collection_object_add(), blender::BKE_layer_collection_get_active_editable(), blender::BKE_mesh_add(), blender::BKE_mesh_nomain_to_mesh(), blender::BKE_object_add_only_object(), blender::BKE_object_apply_mat4(), blender::BKE_report(), blender::BKE_view_layer_base_deselect_all(), blender::BKE_view_layer_base_find(), blender::BKE_view_layer_base_select_and_set_active(), blender::BKE_view_layer_synced_ensure(), blender::BLI_path_basename(), blender::BLI_path_extension_strip(), blender::LayerCollection::collection, blender::copy_m4_m3(), blender::DEG_id_tag_update(), blender::DEG_id_tag_update_ex(), blender::DEG_relations_tag_update(), FILE_MAX, blender::STLImportParams::filepath, blender::STLImportParams::forward_axis, blender::STLImportParams::global_scale, blender::Collection::id, blender::Scene::id, ID_IS_EDITABLE, blender::ID_RECALC_ANIMATION, blender::ID_RECALC_BASE_FLAGS, blender::ID_RECALC_GEOMETRY, blender::ID_RECALC_SYNC_TO_EVAL, blender::ID_RECALC_TRANSFORM, importer_main(), blender::IO_AXIS_Y, blender::IO_AXIS_Z, blender::mat3_from_axis_conversion(), blender::OB_MESH, read_stl_file(), blender::STLImportParams::reports, blender::rescale_m4(), blender::RPT_WARNING, blender::UnitSettings::scale_length, blender::STRNCPY(), blender::UnitSettings::system, blender::Scene::unit, blender::unit_m3(), blender::unit_m4(), blender::STLImportParams::up_axis, blender::STLImportParams::use_scene_unit, and blender::USER_UNIT_NONE.

◆ parse_float3()

void blender::io::stl::parse_float3 ( StringBuffer & buf,
float3 & out )
inlinestatic

◆ read_stl_ascii()

◆ read_stl_binary()

◆ read_stl_file()

◆ read_temp_file_in_string()

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

◆ stl_import_report_error()

void blender::io::stl::stl_import_report_error ( FILE * file)

◆ TEST_F() [1/4]

blender::io::stl::TEST_F ( STLExportTest ,
all_quads  )

Definition at line 107 of file stl_exporter_tests.cc.

References SEP_STR, and TEST_F().

◆ TEST_F() [2/4]

blender::io::stl::TEST_F ( STLExportTest ,
all_tris  )

Definition at line 101 of file stl_exporter_tests.cc.

References SEP_STR, and TEST_F().

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

◆ TEST_F() [3/4]

blender::io::stl::TEST_F ( STLExportTest ,
cubes_positioned  )

Definition at line 119 of file stl_exporter_tests.cc.

References SEP_STR, and TEST_F().

◆ TEST_F() [4/4]

blender::io::stl::TEST_F ( STLExportTest ,
non_uniform_scale  )

Definition at line 113 of file stl_exporter_tests.cc.

References SEP_STR, and TEST_F().

Variable Documentation

◆ BINARY_HEADER_SIZE

size_t blender::io::stl::BINARY_HEADER_SIZE = 80
inlineconstexpr

◆ BINARY_STRIDE

size_t blender::io::stl::BINARY_STRIDE = sizeof(PackedTriangle)
inlineconstexpr

Definition at line 22 of file stl_data.hh.

Referenced by read_stl_file().

◆ LOG

CLG_LogRef blender::io::stl::LOG = {"io.stl"}
static

Definition at line 29 of file stl_import_binary_reader.cc.

◆ save_failing_test_output

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