Scene Lab
An open source project by FPL.
 All Classes Namespaces Files Functions Pages
flatbuffer_editor.h
Go to the documentation of this file.
1 // Copyright 2015 Google Inc. All rights reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef SCENE_LAB_FLATBUFFER_EDITOR_H_
16 #define SCENE_LAB_FLATBUFFER_EDITOR_H_
17 
18 #include <set>
19 #include <string>
20 #include <unordered_map>
21 #include <vector>
22 #include "flatbuffer_editor_config_generated.h"
23 #include "flatbuffers/flatbuffers.h"
24 #include "flatbuffers/reflection.h"
25 #include "flatbuffers/util.h"
26 #include "flatui/flatui.h"
27 #include "fplbase/fpl_common.h"
28 #include "mathfu/glsl_mappings.h"
29 
30 namespace scene_lab {
31 
32 /// @file
33 /// An on-screen representation of a Flatbuffer, which can be edited by the
34 /// user. Instantiate FlatbufferEditor with a Flatbuffer you'd like it to
35 /// edit. It will create a copy of that Flatbuffer to manipulate, and you can
36 /// get the modified Flatbuffer data back out whenever you want.
37 ///
38 /// When you are ready to get the Flatbuffer data from the editor, you can call
39 /// one of the GetFlatbufferCopy() functions, which will return the data in
40 /// different formats. These functions will copy the data out of our internal
41 /// buffer using reflection (which also has the side effect of normalizing the
42 /// Flatbuffer if we have made changes to it).
44  public:
45  /// Construct a FlatbufferEditor for a given schema and table definition,
46  /// and optionally initialize it with flatbuffer data (or nullptr).
47  ///
48  /// When you create a FlatbufferEditor, we will use reflection to copy the
49  /// flatbuffer into our own internal buffer. If you want to change the
50  /// Flatbuffer externally, call SetNewFlatbuffer() and pass in the new
51  /// contents. If you don't have the data you want to edit yet, you can pass in
52  /// nullptr, which means HasFlatbufferData() will be false and can use
53  /// SetFlatbufferData later on. (And if you don't have a
54  /// FlatbufferEditorConfig, just pass in nullptr and we will use default UI
55  /// settings.)
56  FlatbufferEditor(const FlatbufferEditorConfig* config,
57  const reflection::Schema& schema,
58  const reflection::Object& table_def,
59  const void* flatbuffer_data);
60 
61  /// Override the current Flatbuffer data with this new one. Uses reflection to
62  /// copy into our own internal buffers. Will discard whatever is already in
63  /// our copy of the Flatbuffer and in the edit fields.
64  void SetFlatbufferData(const void* flatbuffer_data) {
65  ClearEditFields();
67  if (flatbuffer_data != nullptr) {
68  CopyTable(flatbuffer_data, &flatbuffer_);
69  } else {
70  flatbuffer_.clear();
71  }
72  }
73 
74  /// Does this FlatbufferEditor have any Flatbuffer data?
75  ///
76  /// If you passed in nullptr when setting the Flatbuffer data, this will be
77  /// false. Otherwise it will be true, and that means there is a Flatbuffer
78  /// that we are in the process of drawing / editing.
79  bool HasFlatbufferData() const { return flatbuffer_.size() > 0; }
80 
81  /// Update the internal state. Call each frame, OUTSIDE a gui::Run
82  /// context, before or after drawing.
83  void Update();
84 
85  /// Draw the Flatbuffer edit fields. Call this INSIDE a gui::Run context.
86  void Draw();
87 
88  /// Copy the modified Flatbuffer into a vector. Returns true if successful or
89  /// false if the Flatbuffer editor has no Flatbuffer to copy.
90  bool GetFlatbufferCopy(std::vector<uint8_t>* flatbuffer_output);
91  /// Copy the modified Flatbuffer into a string (requires an extra
92  /// copy). Returns true if successful or false if there is no Flatbuffer.
93  bool GetFlatbufferCopy(std::string* flatbuffer_output);
94  /// Copy the modified Flatbuffer into a generic buffer and get a pointer.
95  /// Requires an extra copy.
96  std::unique_ptr<uint8_t> GetFlatbufferCopy();
97 
98  /// Has the Flatbuffer data been modified? If so, you probably want to reload
99  /// whatever is using it.
100  bool flatbuffer_modified() const { return flatbuffer_modified_; }
101  /// Once you have reloaded the Flatbuffer into whatever you are using it for,
102  /// call this to reset the "modified" flag and the list of modified fields.
104 
105  /// Get a pointer to the Flatbuffer we are working with, in case you want to
106  /// manually copy it out.
107  const void* flatbuffer() { return flatbuffer_.data(); }
108 
109  /// Check if we are in Read-only mode: If true, draw the Flatbuffer using
110  /// FlatUI's Label fields instead of Edit fields, just showing the values and
111  /// not allowing them to be edited. Defaults to false.
112  bool config_read_only() const { return config_read_only_; }
113 
114  /// Set Read-only mode. See config_read_only() for more information.
115  void set_config_read_only(bool b) { config_read_only_ = b; }
116 
117  /// Get the Auto-commit mode: If true, then whenever the user edits the
118  /// Flatbuffer fields, automatically update the Flatbuffer contents after the
119  /// user finishes editing (presses Enter or clicks on another field). If
120  /// false, show an "Apply" button next to all edited fields which will update
121  /// the Flatbuffer when clicked.
122  bool config_auto_commit() const { return config_auto_commit_; }
123 
124  /// Set the Auto-commit mode. See config_auto_commit().
125  void set_config_auto_commit(bool b) { config_auto_commit_ = b; }
126 
127  /// Allow resizing of the Flatbuffer. If this is true, you can edit anything
128  /// inside the Flatbuffer, including vector sizes, strings, and union types.
129  /// Otherwise, you are only allowed to edit scalar values. The default for
130  /// this comes from FlatbufferEditorConfig.
131  bool config_allow_resize() const { return config_allow_resize_; }
132 
133  /// Set the "Allow resizing" config value. See config_allow_resize() for more
134  /// information.
135  void set_config_allow_resize(bool b) { config_allow_resize_ = b; }
136 
137  /// Allow adding fields to the Flatbuffer. If this is true, you can and add
138  /// sub-tables, strings, vectors, etc. to tables and vectors. Otherwise, you
139  /// are only allowed to change the size of existing fields. The default for
140  /// this comes from FlatbufferEditorConfig.
141  ///
142  /// Note: This will always require resizing the Flatbuffer, so you will need
143  /// to set config_allow_resize() to true as well.
144  ///
145  /// WARNING: This functionality in Flatbuffers is EXPERIMENTAL and is not yet
146  /// completely implemented here. Turn it on at your own risk.
148  return config_allow_adding_fields_;
149  }
150 
151  /// Set the "Allow adding fields" config value. See
152  /// config_allow_adding_fields() for more information.
154  config_allow_adding_fields_ = b;
155  }
156 
157  /// Get the size of all the UI elements passed to FlatUI. Defaults are set
158  /// in the FlatbufferEditorConfig.
159  float ui_size() const { return ui_size_; }
160 
161  /// Set the UI size. See ui_size().
162  void set_ui_size(float s) { ui_size_ = s; }
163 
164  /// Get the spacing of all the UI elements passed to FlatUI. Defaults are set
165  /// in the FlatbufferEditorConfig.
166  float ui_spacing() const { return ui_spacing_; }
167 
168  /// Set the UI spacing. See ui_spacing().
169  void set_ui_spacing(float s) { ui_spacing_ = s; }
170 
171  /// When an editable text field is blank, we force the width of the
172  /// gui Edit field to this value so that it can still be clicked on.
173  float blank_field_width() const { return blank_field_width_; }
174 
175  /// Set the blank field width. See blank_filed_width().
176  void set_blank_field_width(float w) { blank_field_width_ = w; }
177 
178  /// Show the type of each subtable / struct in the Flatbuffer table?
179  bool show_types() const { return show_types_; }
180 
181  /// See show_types().
182  void set_show_types(bool b) { show_types_ = b; }
183 
184  /// Expand all subtables in the Flatbuffer table?
185  bool expand_all() const { return expand_all_; }
186 
187  /// See expand_all().
188  void set_expand_all(bool b) { expand_all_ = b; }
189 
190  /// Is the keyboard in use? A field is being edited? You probably want
191  /// to check this to make sure you don't consume those keypresses yourself.
192  bool keyboard_in_use() const { return keyboard_in_use_; }
193 
194  /// Set a unique root ID for all edit fields, required by FlatUI. If you don't
195  /// set this, it will use a unique value based on our pointer address.
196  void set_root_id(const std::string& id) { root_id_ = id; }
197 
198  /// See set_root_id().
199  const std::string& root_id() const { return root_id_; }
200 
201  MATHFU_DEFINE_CLASS_SIMD_AWARE_NEW_DELETE
202 
203  private:
204  /// @cond SCENELAB_INTERNAL
205  FPL_DISALLOW_COPY_AND_ASSIGN(FlatbufferEditor);
206 
207  /// How VisitFlatbuffer* should traverse the table.
208  /// kCheckEdits: Traverse and check if fields have changed, but don't commit
209  /// any changes.
210  /// kDraw*: Draw the Flatbuffer. ReadOnly means use Labels instead of Edit
211  /// fields. Manual means use Edit fields, but require the user to explicitly
212  /// save them back out to the Flatbuffer. Auto means automatically commit the
213  /// values into the Flatbuffer as you edit them.
214  /// kCommitEdits: Traverse, and if fields have changed, commit them to the
215  /// Flatbuffer.
216  enum VisitMode {
217  kCheckEdits, // Only check if any fields have been modified.
218  kDrawEditAuto, // Draw using edit fields that auto-update the FB.
219  kDrawEditManual, // Draw using edit fields that manually update the FB.
220  kDrawReadOnly, // Draw using label fields, not editable
221  kCommitEdits // Write out edits to the Flatbuffer.
222  };
223 
224  enum Button { kNone, kCommit, kRevert };
225 
226  /// Copy the table using reflection and the existing schema and table def.
227  void CopyTable(const void* src, std::vector<uint8_t>* dest);
228 
229  /// Clear all edited fields, returning them to the value from the Flatbuffer.
230  void ClearEditFields() {
231  edit_fields_.clear();
232  edit_fields_modified_ = false;
233  error_fields_.clear();
234  }
235 
236  /// This function takes the edit_fields_ that the user has been working on,
237  /// and writes them all out to the Flatbuffer. This is an expensive operation
238  /// as it may require completely invalidating the existing Flatbuffer and
239  /// copying in a new one, so we only do this when the user chooses to commit
240  /// their edits.
241  void CommitEditsToFlatbuffer();
242 
243  // Functions for traversing the Flatbuffer and drawing or editing its fields.
244 
245  /// Visit a single field with the given name and value. The "id" should
246  /// uniquely identify it in the tree of data structures.
247  ///
248  /// If mode is kDrawEdit, the Flatbuffer field will be drawn using a FlatUI
249  /// Edit() control. kDrawReadOnly is similar, but it will use a Label()
250  /// control
251  /// and won't be editable.
252  ///
253  /// If mode is kEdit, it won't actually draw, but it apply any edits made from
254  /// the previously visited fields, hitting all of the previously calculated
255  /// IDs to apply the edits.
256  ///
257  /// Only returns true if mode = kEdit and if we applied any edits.
258  bool VisitField(VisitMode mode, const std::string& name,
259  const std::string& value, const std::string& type,
260  const std::string& comment, const std::string& id);
261 
262  /// Visit a subtable with the given name. The "id" should uniquely identify it
263  /// in the tree of data structures. If mode is kEdit, don't actually draw, but
264  /// do still propagate through the tree of data structures so we can apply
265  /// edits to the previously determined IDs. Returns true if kEdit and if we
266  /// applied any edits.
267  bool VisitSubtable(VisitMode mode, const std::string& field,
268  const std::string& type, const std::string& comment,
269  const std::string& id, const reflection::Schema& schema,
270  const reflection::Object& subobjdef,
271  flatbuffers::Table& subtable);
272 
273  /// Helper function for traversing elements of a Flatbuffer reflection. May
274  /// only return true if mode = kEdit and a field was edited in such a way as
275  /// to force the flatbuffer to be resized, which means you'll need to start
276  /// over and propagate edits again to catch the subsequent edits.
277  bool VisitFlatbufferField(VisitMode mode, const reflection::Schema& schema,
278  const reflection::Field& fielddef,
279  const reflection::Object& objectdef,
280  flatbuffers::Table& table, const std::string& id);
281  /// Helper function for traversing elements of a Flatbuffer reflection. May
282  /// only return true if mode = kEdit and a field was edited in such a way as
283  /// to force the flatbuffer to be resized, which means you'll need to start
284  /// over and propagate edits again to catch the subsequent edits.
285  bool VisitFlatbufferScalar(VisitMode mode, const reflection::Schema& schema,
286  const reflection::Field& fielddef,
287  flatbuffers::Table& table, const std::string& id);
288  /// Helper function for traversing elements of a Flatbuffer reflection. May
289  /// only return true if mode = kEdit and a field was edited in such a way as
290  /// to force the flatbuffer to be resized, which means you'll need to start
291  /// over and propagate edits again to catch the subsequent edits.
292  bool VisitFlatbufferTable(VisitMode mode, const reflection::Schema& schema,
293  const reflection::Object& objectdef,
294  flatbuffers::Table& table, const std::string& id);
295  /// Helper function for traversing elements of a Flatbuffer reflection. May
296  /// only return true if mode = kEdit and a field was edited in such a way as
297  /// to force the flatbuffer to be resized, which means you'll need to start
298  /// over and propagate edits again to catch the subsequent edits.
299  bool VisitFlatbufferVector(VisitMode mode, const reflection::Schema& schema,
300  const reflection::Field& fielddef,
301  flatbuffers::Table& table, const std::string& id);
302  /// Helper function for traversing elements of a Flatbuffer reflection. May
303  /// only return true if mode = kEdit and a field was edited in such a way as
304  /// to force the flatbuffer to be resized, which means you'll need to start
305  /// over and propagate edits again to catch the subsequent edits.
306  bool VisitFlatbufferUnion(VisitMode mode, const reflection::Schema& schema,
307  const reflection::Field& fielddef,
308  const reflection::Object& objectdef,
309  flatbuffers::Table& table, const std::string& id);
310  /// Helper function for traversing elements of a Flatbuffer reflection. May
311  /// only return true if mode = kEdit and a field was edited in such a way as
312  /// to force the flatbuffer to be resized, which means you'll need to start
313  /// over and propagate edits again to catch the subsequent edits.
314  bool VisitFlatbufferStruct(VisitMode mode, const reflection::Schema& schema,
315  const reflection::Field& fielddef,
316  const reflection::Object& objectdef,
317  flatbuffers::Struct& fbstruct,
318  const std::string& id);
319  /// Helper function for traversing elements of a Flatbuffer reflection. May
320  /// only return true if mode = kEdit and a field was edited in such a way as
321  /// to force the flatbuffer to be resized, which means you'll need to start
322  /// over and propagate edits again to catch the subsequent edits.
323  bool VisitFlatbufferString(VisitMode mode, const reflection::Schema& schema,
324  const reflection::Field& fielddef,
325  flatbuffers::Table& table, const std::string& id);
326 
327  // Utility functions for dealing with Flatbuffer data. All of them are static.
328 
329  /// Get the string representation of a Flatbuffers struct at a given pointer
330  /// location. For example a Vec3 with x = 1.2, y = 3.4, z = 5 would show up as
331  /// < 1.2, 3.4, 5 >. Set field_names_only = true to output the field names
332  /// instead.
333  static std::string StructToString(const reflection::Schema& schema,
334  const reflection::Object& objectdef,
335  const flatbuffers::Struct& struct_ptr,
336  bool field_names_only);
337 
338  /// Parse a string that specifies a FlatBuffers struct in the format outputted
339  /// above. The format is "< 1, 2, < 3.4, 5, 6.7 >, 8 >". Each number must have
340  /// some combination of whitespace, comma, or angle brackets around it.
341  /// If you call this with a null struct_ptr it will just check whether your
342  /// string parses correctly.
343  static bool ParseStringIntoStruct(const std::string& string,
344  const reflection::Schema& schema,
345  const reflection::Object& objectdef,
346  flatbuffers::Struct* struct_ptr);
347 
348  /// Extract an inline struct definition from a string containing a complex
349  /// struct definition that may contain nested struct definitions.
350  ///
351  /// str is a string that starts with '<'. Returns the string in between that
352  /// '<' and the matching '>' (exclusive), or empty string if there is a
353  /// mismatch.
354  static std::string ExtractInlineStructDef(const std::string& str);
355 
356  /// If this scalar value is an enum, get its type name and the name of its
357  /// value. Returns a string with the corrected integer value after parsing.
358  static std::string GetEnumTypeAndValue(const reflection::Schema& schema,
359  const reflection::Field& fielddef,
360  const std::string& value,
361  std::string* type,
362  std::string* value_name);
363 
364  // UI helper functions
365 
366  /// For a string for a field name, showing optional type.
367  std::string FormatFieldName(const std::string& name, const std::string& type);
368 
369  /// Draw a text button with the given text and the given ID.
370  /// Size is the vertical size of the button; the text will be smaller inside
371  /// that size.
372  flatui::Event TextButton(const char* text, const char* id, float size);
373 
374  /// If mode is a draw mode, draw a button to add the current field to the
375  /// FlatBuffer. If mode is CommitEdits, then return true if this is the
376  /// node we want to commit, so the calling code can actually add the
377  /// field.
378  bool AddFieldButton(VisitMode mode, const std::string& name,
379  const std::string& type_str, const std::string& id);
380 
381  /// If the user is editing a field, keyboard_in_use is set to true.
382  void set_keyboard_in_use(bool b) { keyboard_in_use_ = b; }
383 
384  /// Is the VisitMode one of the ones that draws the field?
385  static bool IsDraw(VisitMode mode) {
386  return (mode == kDrawEditAuto || mode == kDrawEditManual ||
387  mode == kDrawReadOnly);
388  }
389 
390  /// Is the VisitMode one of the ones that draws the field and allows it to be
391  /// modified by the user?
392  static bool IsDrawEdit(VisitMode mode) {
393  return (mode == kDrawEditAuto || mode == kDrawEditManual);
394  }
395 
396  /// @endcond
397 
398  const reflection::Schema& schema_;
399  const reflection::Object& table_def_;
400  std::unordered_map<std::string, std::string> edit_fields_;
401  // List of table names we have expanded the view for.
402  std::set<std::string> expanded_subtables_;
403  // List of modified fields that were committed into the Flatbuffer. This is
404  // cleared whenever ClearFlatbufferModifiedFlag() is called, as this assumes
405  // that your code is now using the new Flatbuffer data.
406  std::set<std::string> committed_fields_;
407  // List of fields that are currently causing errors. For example, badly
408  // parsing structs, etc.
409  std::set<std::string> error_fields_;
410  // The actual Flatbuffer data.
411  std::vector<uint8_t> flatbuffer_;
412  // The root ID for our UI controls.
413  std::string root_id_;
414  std::string currently_editing_field_; // What field has focus now?
415  std::string force_commit_field_; // If set, force this field to be committed
416  // to the Flatbuffer next Update.
417 
418  // What on-screen button was pressed?
419  Button button_pressed_;
420  // UI settings.
421  float ui_size_; // Set to kDefaultUISize by default.
422  float ui_spacing_; // Set to kDefaultUISpacing by default.
423  float blank_field_width_; // How wide an edit area for blank strings?
424  bool keyboard_in_use_; // Is the keyboard in use?
425  bool show_types_; // Show type names?
426  bool expand_all_; // Expand all subtables?
427  // Configuration settings, defaults taken from Flatbuffer.
428  bool config_read_only_; // If true, only draw and don't allow edits.
429  bool config_auto_commit_; // Auto-commit edited fields to the Flatbuffer.
430  bool config_allow_resize_; // If false, disallow edits that might change the
431  // size of the Flatbuffer.
432  bool config_allow_adding_fields_; // If false, disallow adding new fields to
433  // the Flatbuffer.
434  // Information about fields being edited.
435  bool edit_fields_modified_; // Have GUI edit fields been modified?
436  bool flatbuffer_modified_; // Has the Flatbuffer data been modified?
437 
438  // Temporary: Colors to use for rendering the Flatbuffer UI.
439  // TODO: Move these to a standalone config structure.
440  mathfu::vec4 bg_button_color_;
441  mathfu::vec4 bg_button_hover_color_;
442  mathfu::vec4 bg_button_click_color_;
443 
444  mathfu::vec4 text_button_color_;
445  mathfu::vec4 text_normal_color_;
446  mathfu::vec4 text_comment_color_;
447  mathfu::vec4 text_disabled_color_;
448  mathfu::vec4 text_editable_color_;
449  mathfu::vec4 text_editing_color_;
450  mathfu::vec4 text_modified_color_;
451  mathfu::vec4 text_committed_color_;
452  mathfu::vec4 text_error_color_;
453 };
454 
455 } // namespace scene_lab
456 
457 #endif // SCENE_LAB_FLATBUFFER_EDITOR_H_
bool expand_all() const
Expand all subtables in the Flatbuffer table?
Definition: flatbuffer_editor.h:185
void set_blank_field_width(float w)
Set the blank field width. See blank_filed_width().
Definition: flatbuffer_editor.h:176
void set_config_allow_adding_fields(bool b)
Set the "Allow adding fields" config value.
Definition: flatbuffer_editor.h:153
void set_show_types(bool b)
See show_types().
Definition: flatbuffer_editor.h:182
bool show_types() const
Show the type of each subtable / struct in the Flatbuffer table?
Definition: flatbuffer_editor.h:179
void set_root_id(const std::string &id)
Set a unique root ID for all edit fields, required by FlatUI.
Definition: flatbuffer_editor.h:196
void SetFlatbufferData(const void *flatbuffer_data)
Override the current Flatbuffer data with this new one.
Definition: flatbuffer_editor.h:64
FlatbufferEditor(const FlatbufferEditorConfig *config, const reflection::Schema &schema, const reflection::Object &table_def, const void *flatbuffer_data)
Construct a FlatbufferEditor for a given schema and table definition, and optionally initialize it wi...
void set_expand_all(bool b)
See expand_all().
Definition: flatbuffer_editor.h:188
void set_config_allow_resize(bool b)
Set the "Allow resizing" config value.
Definition: flatbuffer_editor.h:135
bool config_allow_resize() const
Allow resizing of the Flatbuffer.
Definition: flatbuffer_editor.h:131
bool config_allow_adding_fields() const
Allow adding fields to the Flatbuffer.
Definition: flatbuffer_editor.h:147
bool config_auto_commit() const
Get the Auto-commit mode: If true, then whenever the user edits the Flatbuffer fields, automatically update the Flatbuffer contents after the user finishes editing (presses Enter or clicks on another field).
Definition: flatbuffer_editor.h:122
bool HasFlatbufferData() const
Does this FlatbufferEditor have any Flatbuffer data?
Definition: flatbuffer_editor.h:79
float ui_spacing() const
Get the spacing of all the UI elements passed to FlatUI.
Definition: flatbuffer_editor.h:166
float ui_size() const
Get the size of all the UI elements passed to FlatUI.
Definition: flatbuffer_editor.h:159
void set_ui_size(float s)
Set the UI size. See ui_size().
Definition: flatbuffer_editor.h:162
bool config_read_only() const
Check if we are in Read-only mode: If true, draw the Flatbuffer using FlatUI's Label fields instead o...
Definition: flatbuffer_editor.h:112
bool keyboard_in_use() const
Is the keyboard in use? A field is being edited? You probably want to check this to make sure you don...
Definition: flatbuffer_editor.h:192
bool flatbuffer_modified() const
Has the Flatbuffer data been modified? If so, you probably want to reload whatever is using it...
Definition: flatbuffer_editor.h:100
void set_config_auto_commit(bool b)
Set the Auto-commit mode. See config_auto_commit().
Definition: flatbuffer_editor.h:125
const void * flatbuffer()
Get a pointer to the Flatbuffer we are working with, in case you want to manually copy it out...
Definition: flatbuffer_editor.h:107
float blank_field_width() const
When an editable text field is blank, we force the width of the gui Edit field to this value so that ...
Definition: flatbuffer_editor.h:173
void ClearFlatbufferModifiedFlag()
Once you have reloaded the Flatbuffer into whatever you are using it for, call this to reset the "mod...
void set_ui_spacing(float s)
Set the UI spacing. See ui_spacing().
Definition: flatbuffer_editor.h:169
void Update()
Update the internal state.
const std::string & root_id() const
See set_root_id().
Definition: flatbuffer_editor.h:199
std::unique_ptr< uint8_t > GetFlatbufferCopy()
Copy the modified Flatbuffer into a generic buffer and get a pointer.
void set_config_read_only(bool b)
Set Read-only mode. See config_read_only() for more information.
Definition: flatbuffer_editor.h:115
void Draw()
Draw the Flatbuffer edit fields. Call this INSIDE a gui::Run context.
Definition: flatbuffer_editor.h:43