12#include <nlohmann/json.hpp>
15#include <unordered_map>
17using json = nlohmann::json;
92 std::unordered_map<kString, kString> *templateMap =
nullptr);
bool saveToFile(const kString &path)
Writes this prefab to a .prefab JSON file.
kString getUuid() const
Returns the prefab asset UUID.
Definition kprefab.h:63
bool loadFromFile(const kString &path)
Loads a .prefab JSON file from disk into this prefab.
kString getName() const
Returns the display name of the prefab.
Definition kprefab.h:67
kPrefab()
Constructs an empty prefab with no UUID, name, or root subtree.
const json & getRootJson() const
Returns the object subtree JSON (the "root" field).
Definition kprefab.h:72
json & getRootJson()
Returns a mutable reference to the object subtree JSON (the "root" field).
Definition kprefab.h:74
void setRootJson(const json &j)
Replaces the object subtree JSON.
Definition kprefab.h:76
void setName(const kString &v)
Sets the display name of the prefab.
Definition kprefab.h:69
~kPrefab()
Destroys the prefab and releases its stored JSON.
static json instantiateJson(const json &source, std::unordered_map< kString, kString > *templateMap=nullptr)
Generates a fresh-uuid copy of an object subtree.
void setUuid(const kString &v)
Sets the prefab asset UUID.
Definition kprefab.h:65
Core type aliases, enumerations, structs, and utility functions used throughout the engine.
Symbol visibility / linkage macro for the Kemena3D library.
#define KEMENA3D_API
Definition kexport.h:35
nlohmann::json json
Definition kobject.h:30
Top-level Kemena3D engine namespace.
Definition kanimation.h:23
std::string kString
Standard string alias.
Definition kdatatype.h:42