Blender V5.0
blender::io Namespace Reference

Namespaces

namespace  serialize
namespace  alembic
namespace  csv
namespace  fbx
namespace  grease_pencil
namespace  ply
namespace  stl
namespace  hydra
namespace  usd
namespace  obj

Classes

class  TestingHierarchyIterator
class  AbstractHierarchyIteratorTest
class  AbstractHierarchyIteratorInvisibleTest
class  DupliParentFinder
class  ObjectIdentifierOrderTest
class  PersistentIDTest
struct  HierarchyContext
class  AbstractHierarchyWriter
struct  ExportSubset
class  EnsuredWriter
class  ObjectIdentifier
class  AbstractHierarchyIterator
class  PersistentID
class  SubdivModifierDisabler

Functions

static bool remove_weak_subtrees (const HierarchyContext *context, AbstractHierarchyIterator::ExportGraph &clean_graph, const AbstractHierarchyIterator::ExportGraph &input_graph)
 TEST_F (AbstractHierarchyIteratorTest, ExportHierarchyTest)
 TEST_F (AbstractHierarchyIteratorTest, ExportSubsetTest)
 TEST_F (AbstractHierarchyIteratorInvisibleTest, ExportInvisibleTest)
bool operator== (const PersistentID &persistent_id_a, const PersistentID &persistent_id_b)
bool operator== (const ObjectIdentifier &obj_ident_a, const ObjectIdentifier &obj_ident_b)
 TEST_F (ObjectIdentifierOrderTest, graph_root)
 TEST_F (ObjectIdentifierOrderTest, real_objects)
 TEST_F (ObjectIdentifierOrderTest, duplicated_objects)
 TEST_F (ObjectIdentifierOrderTest, behavior_as_map_keys)
 TEST_F (ObjectIdentifierOrderTest, map_copy_and_update)
 TEST_F (PersistentIDTest, is_from_same_instancer)
 TEST_F (PersistentIDTest, instancer_id)
 TEST_F (PersistentIDTest, as_object_name_suffix)
std::string path_reference (StringRefNull filepath, StringRefNull base_src, StringRefNull base_dst, ePathReferenceMode mode, Set< std::pair< std::string, std::string > > *copy_set)
void path_reference_copy (const Set< std::pair< std::string, std::string > > &copy_set)
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_sign (const char *p, const char *end, int &sign)
const char * try_parse_float (const char *p, const char *end, int fallback, bool &success, float &dst, bool skip_space)
const char * try_parse_int (const char *p, const char *end, int fallback, bool &success, int &dst, bool skip_space)
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)
 TEST (io_common_string_utils, read_next_line)
 TEST (io_common_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 (io_common_string_utils, drop_whitespace)
 TEST (io_common_string_utils, parse_int_valid)
 TEST (io_common_string_utils, parse_int_invalid)
 TEST (io_common_string_utils, parse_float_valid)
 TEST (io_common_string_utils, parse_float_invalid)

Function Documentation

◆ drop_non_whitespace()

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

◆ drop_plus()

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

Definition at line 134 of file io/common/intern/string_utils.cc.

Referenced by parse_float(), and parse_int().

◆ drop_sign()

const char * blender::io::drop_sign ( const char * p,
const char * end,
int & sign )
static

Definition at line 79 of file io/common/intern/string_utils.cc.

References sign().

Referenced by try_parse_float(), and try_parse_int().

◆ drop_whitespace() [1/2]

◆ drop_whitespace() [2/2]

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

◆ fixup_line_continuations()

void blender::io::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 io/common/intern/string_utils.cc.

References is_whitespace().

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

◆ is_whitespace()

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

◆ operator==() [1/2]

bool blender::io::operator== ( const ObjectIdentifier & obj_ident_a,
const ObjectIdentifier & obj_ident_b )

◆ operator==() [2/2]

bool blender::io::operator== ( const PersistentID & persistent_id_a,
const PersistentID & persistent_id_b )

Definition at line 106 of file dupli_persistent_id.cc.

◆ parse_float() [1/2]

const char * blender::io::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 142 of file io/common/intern/string_utils.cc.

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

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

◆ parse_float() [2/2]

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

◆ parse_floats()

const char * blender::io::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 165 of file io/common/intern/string_utils.cc.

References count, i, and parse_float().

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

◆ parse_int() [1/2]

const char * blender::io::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 178 of file io/common/intern/string_utils.cc.

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

Referenced by blender::io::obj::geom_add_curve_vertex_indices(), blender::io::obj::geom_add_polygon(), blender::io::obj::geom_set_curve_degree(), blender::io::obj::geom_update_smooth_group(), blender::io::ply::load_face_element(), blender::io::ply::load_tristrips_element(), parse_int(), blender::io::obj::parse_vertex_index(), TEST(), and TEST().

◆ parse_int() [2/2]

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

◆ path_reference()

std::string blender::io::path_reference ( StringRefNull filepath,
StringRefNull base_src,
StringRefNull base_dst,
ePathReferenceMode mode,
Set< std::pair< std::string, std::string > > * copy_set = nullptr )

Return a filepath relative to a destination directory, for use with exporters.

When PATH_REFERENCE_COPY mode is used, the file path pair (source path, destination path) is added to the copy_set.

Equivalent of bpy_extras.io_utils.path_reference.

Definition at line 15 of file path_util.cc.

References BLI_assert_msg, BLI_path_abs(), BLI_path_basename(), BLI_path_contains(), BLI_path_is_rel(), BLI_path_join, BLI_path_normalize(), BLI_path_rel(), blender::StringRefNull::c_str(), PATH_MAX, PATH_REFERENCE_ABSOLUTE, PATH_REFERENCE_AUTO, PATH_REFERENCE_COPY, PATH_REFERENCE_MATCH, PATH_REFERENCE_RELATIVE, PATH_REFERENCE_STRIP, and STRNCPY().

◆ path_reference_copy()

void blender::io::path_reference_copy ( const Set< std::pair< std::string, std::string > > & copy_set)

Execute copying files of path_reference.

Definition at line 64 of file path_util.cc.

References BLI_copy(), BLI_exists(), BLI_file_ensure_parent_dir_exists(), BLI_path_cmp_normalized(), CLOG_WARN, copy(), and LOG.

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

◆ read_next_line()

StringRef blender::io::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 io/common/intern/string_utils.cc.

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

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

◆ remove_weak_subtrees()

◆ TEST() [1/7]

blender::io::TEST ( io_common_string_utils ,
drop_whitespace  )

Definition at line 61 of file string_utils_tests.cc.

References drop_whitespace(), and EXPECT_STRREF_EQ.

◆ TEST() [2/7]

blender::io::TEST ( io_common_string_utils ,
fixup_line_continuations  )

Definition at line 26 of file string_utils_tests.cc.

References exp, EXPECT_STRREF_EQ, fixup_line_continuations(), and str.

◆ TEST() [3/7]

blender::io::TEST ( io_common_string_utils ,
parse_float_invalid  )

Definition at line 137 of file string_utils_tests.cc.

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

◆ TEST() [4/7]

blender::io::TEST ( io_common_string_utils ,
parse_float_valid  )

◆ TEST() [5/7]

blender::io::TEST ( io_common_string_utils ,
parse_int_invalid  )

Definition at line 99 of file string_utils_tests.cc.

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

◆ TEST() [6/7]

blender::io::TEST ( io_common_string_utils ,
parse_int_valid  )

Definition at line 79 of file string_utils_tests.cc.

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

◆ TEST() [7/7]

blender::io::TEST ( io_common_string_utils ,
read_next_line  )

◆ TEST_F() [1/11]

blender::io::TEST_F ( AbstractHierarchyIteratorInvisibleTest ,
ExportInvisibleTest  )

Definition at line 321 of file abstract_hierarchy_iterator_test.cc.

References DAG_EVAL_RENDER, EXPECT_EQ(), and SEP_STR.

◆ TEST_F() [2/11]

blender::io::TEST_F ( AbstractHierarchyIteratorTest ,
ExportHierarchyTest  )

Definition at line 122 of file abstract_hierarchy_iterator_test.cc.

References DAG_EVAL_RENDER, EXPECT_EQ(), and SEP_STR.

◆ TEST_F() [3/11]

◆ TEST_F() [4/11]

◆ TEST_F() [5/11]

blender::io::TEST_F ( ObjectIdentifierOrderTest ,
duplicated_objects  )

◆ TEST_F() [6/11]

◆ TEST_F() [7/11]

◆ TEST_F() [8/11]

blender::io::TEST_F ( ObjectIdentifierOrderTest ,
real_objects  )

◆ TEST_F() [9/11]

blender::io::TEST_F ( PersistentIDTest ,
as_object_name_suffix  )

Definition at line 195 of file object_identifier_test.cc.

References EXPECT_EQ().

◆ TEST_F() [10/11]

blender::io::TEST_F ( PersistentIDTest ,
instancer_id  )

◆ TEST_F() [11/11]

blender::io::TEST_F ( PersistentIDTest ,
is_from_same_instancer  )

◆ try_parse_float()

const char * blender::io::try_parse_float ( const char * p,
const char * end,
int fallback,
bool & success,
float & dst,
bool skip_space = true )

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), success value is false.

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

Definition at line 94 of file io/common/intern/string_utils.cc.

References drop_sign(), drop_whitespace(), ELEM, and sign().

◆ try_parse_int()

const char * blender::io::try_parse_int ( const char * p,
const char * end,
int fallback,
bool & success,
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), success value is false.

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

Definition at line 114 of file io/common/intern/string_utils.cc.

References drop_sign(), drop_whitespace(), ELEM, and sign().