TerraForge3D  2.3.1
3D Terrain And Landscape Generator

◆ Save()

nlohmann::json TextureNode::Save ( )
virtual

Implements NodeEditorNode.

Definition at line 158 of file TextureNode.cpp.

159{
160 nlohmann::json data;
161 data["type"] = MeshNodeEditor::MeshNodeType::Texture;
162 data["scale"] = scale;
163 data["isDefault"] = isDefault;
164 data["inv"] = inv;
165 data["npsc"] = npScale;
166 data["autoTiled"] = autoTiled;
167 data["numTiles"] = numTiles;
168 data["posiX"] = posi[0];
169 data["posiY"] = posi[1];
170 data["rota"] = rota;
171
172 if (!isDefault)
173 {
174 std::string hash = MD5File(texture->GetPath()).ToString();
175 data["texture"] = hash;
176
177 if (!ProjectManager::Get()->AssetExists(hash))
178 {
179 ProjectManager::Get()->SaveTexture(texture);
180 Log("Cached " + texture->GetPath());
181 }
182
183 else
184 {
185 Log("Texture already Cached : " + hash);
186 }
187 }
188
189 return data;
190}
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