MCPcopy Create free account
hub / github.com/codereader/DarkRadiant / weldSelectedPatches

Function weldSelectedPatches

radiantcore/patch/algorithm/General.cpp:425–455  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

423}
424
425void 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

Callers

nothing calls this directly

Calls 8

rWarningFunction · 0.85
weldPatchesFunction · 0.85
weldPatchPoolFunction · 0.85
ExecutionFailureClass · 0.85
_Function · 0.50
sizeMethod · 0.45
penultimateSelectedMethod · 0.45
ultimateSelectedMethod · 0.45

Tested by

no test coverage detected