Skip to content

Commit

Permalink
Add Set/Get SerializeDefaultValues method(W.I.P.)
Browse files Browse the repository at this point in the history
  • Loading branch information
syoyo committed Aug 21, 2019
1 parent 1f160d5 commit a472a3f
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions tiny_gltf.h
Original file line number Diff line number Diff line change
Expand Up @@ -1078,6 +1078,9 @@ bool WriteWholeFile(std::string *err, const std::string &filepath,
const std::vector<unsigned char> &contents, void *);
#endif

///
/// glTF Parser/Serialier context.
///
class TinyGLTF {
public:
#ifdef __clang__
Expand Down Expand Up @@ -1162,6 +1165,22 @@ class TinyGLTF {
///
void SetFsCallbacks(FsCallbacks callbacks);


///
/// Set serializing default values(default = false).
/// When true, default values are force serialized to .glTF.
/// This may be helpfull if you want to serialize a full description of glTF data.
///
/// TODO(LTE): Supply parsing option as function arguments to `LoadASCIIFromFile()` and others, not by a class method
///
void SetSerializeDefaultValues(const bool enabled) {
serialize_default_values_ = enabled;
}

bool GetSerializeDefaultValues() const {
return serialize_default_values_;
}

private:
///
/// Loads glTF asset from string(memory).
Expand All @@ -1173,9 +1192,11 @@ class TinyGLTF {
const char *str, const unsigned int length,
const std::string &base_dir, unsigned int check_sections);

const unsigned char *bin_data_;
size_t bin_size_;
bool is_binary_;
const unsigned char *bin_data_ = nullptr;
size_t bin_size_ = 0;
bool is_binary_ = false;

bool serialize_default_values_ = false; ///< Serialize default values?

FsCallbacks fs = {
#ifndef TINYGLTF_NO_FS
Expand Down

0 comments on commit a472a3f

Please # to comment.