| 1299 | } |
| 1300 | |
| 1301 | void IDrawableModule::LoadState(FileStreamIn& in, int rev) |
| 1302 | { |
| 1303 | if (!CanModuleTypeSaveState()) |
| 1304 | return; |
| 1305 | |
| 1306 | if (rev != -1 && ModularSynth::sLoadingFileSaveStateRev >= 423) |
| 1307 | { |
| 1308 | int moduleRev; |
| 1309 | in >> moduleRev; |
| 1310 | LoadStateValidate(moduleRev == rev); |
| 1311 | } |
| 1312 | |
| 1313 | int baseRev; |
| 1314 | in >> baseRev; |
| 1315 | |
| 1316 | if (baseRev > 2) |
| 1317 | { |
| 1318 | in >> mPinned; |
| 1319 | in >> mPinnedPosition.x; |
| 1320 | in >> mPinnedPosition.y; |
| 1321 | } |
| 1322 | |
| 1323 | int numUIControls; |
| 1324 | in >> numUIControls; |
| 1325 | for (int i = 0; i < numUIControls; ++i) |
| 1326 | { |
| 1327 | std::string uicontrolname; |
| 1328 | in >> uicontrolname; |
| 1329 | if (baseRev >= 2) |
| 1330 | { |
| 1331 | float rawValue; |
| 1332 | in >> rawValue; //we don't use this here, but it'll likely be useful in the future if an option is renamed/removed and we need to port the old data |
| 1333 | } |
| 1334 | UpdateOldControlName(uicontrolname); |
| 1335 | |
| 1336 | bool threwException = false; |
| 1337 | try |
| 1338 | { |
| 1339 | if (LoadOldControl(in, uicontrolname)) |
| 1340 | { |
| 1341 | //old data loaded, we're good now! |
| 1342 | } |
| 1343 | else |
| 1344 | { |
| 1345 | //ofLog() << "loading control " << uicontrolname; |
| 1346 | auto* control = FindUIControl(uicontrolname.c_str(), false); |
| 1347 | |
| 1348 | if (control == nullptr) |
| 1349 | throw UnknownUIControlException(); |
| 1350 | |
| 1351 | bool setValue = true; |
| 1352 | if (VectorContains(control, ControlsToNotSetDuringLoadState())) |
| 1353 | setValue = false; |
| 1354 | control->LoadState(in, setValue); |
| 1355 | } |
| 1356 | |
| 1357 | for (int j = 0; j < kControlSeparatorLength; ++j) |
| 1358 | { |
nothing calls this directly
no test coverage detected