-------------------------------------------------------------------------------
| 228 | |
| 229 | //------------------------------------------------------------------------------- |
| 230 | void vtkSessionUpdateObjectFromState(vtkSession session, vtkSessionJson state) |
| 231 | { |
| 232 | char* stateJsonCString = session->StringifyJson(state); |
| 233 | auto stateJson = nlohmann::json::parse(stateJsonCString, nullptr, false); |
| 234 | free(stateJsonCString); |
| 235 | if (stateJson.is_discarded()) |
| 236 | { |
| 237 | vtkLog(ERROR, << "Failed to parse state!"); |
| 238 | return; |
| 239 | } |
| 240 | else if (auto idIter = stateJson.find("Id"); idIter != stateJson.end()) |
| 241 | { |
| 242 | if (auto classNameIter = stateJson.find("ClassName"); classNameIter != stateJson.end()) |
| 243 | { |
| 244 | if (*classNameIter == "vtkOSOpenGLRenderWindow") |
| 245 | { |
| 246 | *classNameIter = "vtkRenderWindow"; |
| 247 | } |
| 248 | } |
| 249 | if (auto objectImpl = session->Manager->GetObjectAtId(*idIter)) |
| 250 | { |
| 251 | const std::string className = objectImpl->GetClassName(); |
| 252 | if (auto propertiesIter = session->SkippedClassProperties.find(className); |
| 253 | propertiesIter != session->SkippedClassProperties.end()) |
| 254 | { |
| 255 | for (const auto& propertyName : propertiesIter->second) |
| 256 | { |
| 257 | stateJson.erase(propertyName); |
| 258 | } |
| 259 | } |
| 260 | } |
| 261 | } |
| 262 | session->Manager->UpdateObjectFromState(stateJson); |
| 263 | } |
| 264 | |
| 265 | //------------------------------------------------------------------------------- |
| 266 | void vtkSessionUpdateStateFromObject(vtkSession session, vtkObjectHandle object) |
no test coverage detected