| 1332 | } |
| 1333 | |
| 1334 | void Map::startMergeOperation(const std::string& sourceMap) |
| 1335 | { |
| 1336 | if (!os::fileOrDirExists(sourceMap)) |
| 1337 | { |
| 1338 | throw cmd::ExecutionFailure(fmt::format(_("File doesn't exist: {0}"), sourceMap)); |
| 1339 | } |
| 1340 | |
| 1341 | prepareMergeOperation(); |
| 1342 | |
| 1343 | auto sourceMapResource = GlobalMapResourceManager().createFromPath(sourceMap); |
| 1344 | |
| 1345 | try |
| 1346 | { |
| 1347 | if (sourceMapResource->load()) |
| 1348 | { |
| 1349 | assignRenderSystem(sourceMapResource->getRootNode()); |
| 1350 | |
| 1351 | // Compare the scenes and get the report |
| 1352 | auto result = scene::merge::GraphComparer::Compare(sourceMapResource->getRootNode(), getRoot()); |
| 1353 | |
| 1354 | // Create the merge actions |
| 1355 | _mergeOperation = scene::merge::MergeOperation::CreateFromComparisonResult(*result); |
| 1356 | |
| 1357 | if (_mergeOperation->hasActions()) |
| 1358 | { |
| 1359 | // Create renderable merge actions |
| 1360 | createMergeActions(); |
| 1361 | |
| 1362 | // Switch to merge mode |
| 1363 | setEditMode(EditMode::Merge); |
| 1364 | |
| 1365 | emitMapEvent(IMap::MapMergeOperationStarted); |
| 1366 | } |
| 1367 | else |
| 1368 | { |
| 1369 | radiant::NotificationMessage::SendInformation(_("The Merge Operation turns out to be empty, nothing to do.")); |
| 1370 | } |
| 1371 | |
| 1372 | // Dispose of the resource, we don't need it anymore |
| 1373 | sourceMapResource->clear(); |
| 1374 | } |
| 1375 | } |
| 1376 | catch (const IMapResource::OperationException& ex) |
| 1377 | { |
| 1378 | radiant::NotificationMessage::SendError(ex.what()); |
| 1379 | } |
| 1380 | } |
| 1381 | |
| 1382 | void Map::startMergeOperation(const std::string& sourceMap, const std::string& baseMap) |
| 1383 | { |
no test coverage detected