| 63 | } |
| 64 | |
| 65 | std::vector<BaseData::Pointer> SceneJsonFileReader::DoRead() |
| 66 | { |
| 67 | // The AbstractFileReader::DoRead contract returns BaseData only, so |
| 68 | // node properties and parent/child relationships are intentionally |
| 69 | // lost on this code path. Callers that need the scene graph should |
| 70 | // use Read(DataStorage&) instead. Data-less nodes are skipped here |
| 71 | // to avoid handing nullptrs back to IOUtil::Load. |
| 72 | std::vector<BaseData::Pointer> result; |
| 73 | |
| 74 | DataStorage::Pointer ds = StandaloneDataStorage::New().GetPointer(); |
| 75 | this->Read(*ds); |
| 76 | DataStorage::SetOfObjects::ConstPointer dataNodes = ds->GetAll(); |
| 77 | for (DataStorage::SetOfObjects::ConstIterator iter = dataNodes->Begin(), iterEnd = dataNodes->End(); |
| 78 | iter != iterEnd; |
| 79 | ++iter) |
| 80 | { |
| 81 | if (BaseData::Pointer data = iter.Value()->GetData()) |
| 82 | { |
| 83 | result.push_back(data); |
| 84 | } |
| 85 | } |
| 86 | return result; |
| 87 | } |
| 88 | |
| 89 | SceneJsonFileReader *SceneJsonFileReader::Clone() const { return new SceneJsonFileReader(*this); } |
| 90 | } |