| 423 | } |
| 424 | |
| 425 | void weldSelectedPatches(const cmd::ArgumentList& args) |
| 426 | { |
| 427 | if (args.size() > 0) |
| 428 | { |
| 429 | rWarning() << "Usage: WeldSelectedPatches" << std::endl; |
| 430 | return; |
| 431 | } |
| 432 | |
| 433 | auto& selectionInfo = GlobalSelectionSystem().getSelectionInfo(); |
| 434 | |
| 435 | if (selectionInfo.totalCount == 2 || selectionInfo.patchCount == 2) |
| 436 | { |
| 437 | // Special handling for exactly two selected patches: the selection order is important |
| 438 | // Merge them and preserve the properties of the first selected patch |
| 439 | auto patch1 = std::dynamic_pointer_cast<PatchNode>(GlobalSelectionSystem().penultimateSelected()); |
| 440 | auto patch2 = std::dynamic_pointer_cast<PatchNode>(GlobalSelectionSystem().ultimateSelected()); |
| 441 | |
| 442 | UndoableCommand cmd("WeldSelectedPatches"); |
| 443 | weldPatches(patch1, patch2); |
| 444 | } |
| 445 | else if (selectionInfo.patchCount >= 2) |
| 446 | { |
| 447 | // We have many things with at least two patches selected, try to find a matching combo |
| 448 | UndoableCommand cmd("WeldSelectedPatches"); |
| 449 | weldPatchPool(); |
| 450 | } |
| 451 | else |
| 452 | { |
| 453 | throw cmd::ExecutionFailure(_("Cannot weld patches, select (at least) two patches with the same parent entity.")); |
| 454 | } |
| 455 | } |
| 456 | |
| 457 | } // namespace |
| 458 |
nothing calls this directly
no test coverage detected