diff --git a/source/Irrlicht/CB3DJSONMeshFileLoader.cpp b/source/Irrlicht/CB3DJSONMeshFileLoader.cpp index 6a43c477..5c3d0267 100644 --- a/source/Irrlicht/CB3DJSONMeshFileLoader.cpp +++ b/source/Irrlicht/CB3DJSONMeshFileLoader.cpp @@ -211,9 +211,37 @@ std::tuple parseNode(json data, SMeshBuffer* meshBuffer) { /** * Returns (success, failure reason). + * [optional] */ std::tuple CB3DJSONMeshFileLoader::readChunkBRUS() { + //? Can skip number of BRUS because JSON. :D + //? note: BRUS is an array of objects. + + json brus; + + // We're checking the root of the JSON structure here. So we can just peak directly into the root. + if (JSONDataContainer.contains("BRUS") && JSONDataContainer["BRUS"].is_array()) { + + brus = JSONDataContainer["BRUS"]; + + } else { + + // We also want to warn developers if they're using {} instead of []. + if (JSONDataContainer.contains("BRUS") && !JSONDataContainer["BRUS"].is_array()) { + return {false, "BRUS is not an array."}; + } + + // Since it's optional, it succeeds if it's not there. + return {true, ""}; + } + + int index = 0; + for (auto reference = brus.begin(); reference != brus.end(); ++reference) { + + + index++; + } return {true, ""}; }