TerraForge3D  2.3.1
3D Terrain And Landscape Generator

◆ Save()

nlohmann::json HeightmapNode::Save ( )
virtual

Implements NodeEditorNode.

Definition at line 140 of file HeightmapNode.cpp.

141{
142 nlohmann::json data;
143 data["type"] = MeshNodeEditor::MeshNodeType::Heightmap;
144 data["scale"] = scale;
145 data["isDefault"] = isDefault;
146 data["interpolated"] = interpolated;
147 data["inv"] = inv;
148 data["npsc"] = npScale;
149 data["autoTiled"] = autoTiled;
150 data["numTiles"] = numTiles;
151 data["posiX"] = posi[0];
152 data["posiY"] = posi[1];
153 data["rota"] = rota;
154
155 if (!isDefault)
156 {
157 std::string hash = MD5File(heightmap->GetPath()).ToString();
158 data["heightmap"] = hash;
159
160 if (!ProjectManager::Get()->AssetExists(hash))
161 {
162 ProjectManager::Get()->SaveResource("heightmaps", heightmap->GetPath());
163 Log("Cached " + heightmap->GetPath());
164 }
165
166 else
167 {
168 Log("Heightmap already cached : " + hash);
169 }
170 }
171
172 return data;
173}
a class to store JSON values
Definition: json.hpp:17860
std::size_t hash(const BasicJsonType &j)
hash a JSON value
Definition: json.hpp:5240